speedl_rt

This function performs real-time task-space (TCP) velocity control from an external controller.
It commands the robot’s end-effector velocity and acceleration in Cartesian space and is typically used for smooth linear streaming control.

Definition
DRFLEx.h within class CDRFLEx, public section

bool speedl_rt(float fTargetVel[NUM_TASK],
               float fTargetAcc[NUM_TASK],
               float fTargetTime) {
    return _speedl_rt(_rbtCtrlUDP, fTargetVel, fTargetAcc, fTargetTime);
};

Parameter

Parameter Name

Data Type

Default Value

Description

fTargetVel

float[6]

Target TCP velocity [mm/s, deg/s].

fTargetAcc

float[6]

Target TCP acceleration [mm/s², deg/s²].
If set to -10000, acceleration is automatically computed from the target velocity.

fTargetTime

float

Target interpolation duration [s].

Note

  • Asynchronous command.

  • The internal motion profile interpolates to reach (fTargetVel, fTargetAcc) over fTargetTime.

  • If fTargetTime ≤ controller’s cycle (~1 ms), control is performed directly without interpolation.

  • If the next command is not received before fTargetTime expires, the previous velocity is maintained.

  • If no new command is received for 0.1 s, a timeout error is raised and motion stops.

  • When exceeding the global acceleration limit, the robot halts and an Info message is generated.

Caution

  • In the current version, this function is not linked with Operation Speed [%].

  • Not compatible with force/compliance control mode.

  • Not compatible with DR_VAR_VEL option near singularities;
    automatically switches to DR_AVOID behavior when detected.

  • For consistent motion, send commands at 1 ms intervals and
    ensure fTargetTime is slightly larger than the communication cycle.

Return

Value

Description

1

The command datagram was sent.

0

The command datagram could not be sent.

Note

This function is asynchronous. It returns as soon as the datagram is sent and does not wait for the controller to accept or reject the command, so a return value of 1 does not confirm that the robot acted on it. Rejected commands and motion faults are reported through set_on_rt_log_alarm.

Example

// Connect and configure RT streaming
drfl.connect_rt_control("192.168.137.100", 12347);

std::string version = "v1.0";
float period = 0.001f; // 1 ms cycle
int lossCount = 4;

drfl.set_rt_control_input(version, period, lossCount);
drfl.set_rt_control_output(version, period, lossCount);
drfl.start_rt_control();

// Define velocity and acceleration targets
float fTargetVel[6] = {150.0f, 0.0f, 100.0f, 0.0f, 0.0f, 0.0f};
float fTargetAcc[6] = {800.0f, 800.0f, 800.0f, 100.0f, 100.0f, 100.0f};
float fTargetTime = 0.06f; // 60 ms

// Send real-time TCP velocity command
if (drfl.speedl_rt(fTargetVel, fTargetAcc, fTargetTime))
    printf("TCP velocity command successful.\n");
else
    printf("TCP velocity command failed.\n");

drfl.stop_rt_control();
drfl.disconnect_rt_control();

This example demonstrates continuous task-space velocity control where the TCP moves in a straight-line direction with real-time updates.

Tips

  • Use speedl_rt for Cartesian velocity streaming with low latency.

  • Combine with feedback from read_data_rt to implement closed-loop control.

  • For position-based real-time control, use servol_rt.