servoj_g (Auto Mode)
This function sends an asynchronous joint-space motion command for continuous trajectory execution using blended velocity and acceleration profiles. It updates the target joint position in real time and smoothly transitions to the next motion command.
This API operates only in Auto (Run) mode. It is not available in Manual (Teach) mode.
Definition
DRFLEx.h within class CDRFLEx, public section
bool servoj_g(float fTargetPos[NUM_JOINT],
float fTargetVel[NUM_JOINT],
float fTargetAcc[NUM_JOINT],
float fTargetTime = 0.f)
{
return _servoj_g(_rbtCtrl, fTargetPos, fTargetVel, fTargetAcc, fTargetTime);
}
Parameter
Parameter Name |
Data Type |
Default Value |
Description |
|---|---|---|---|
fTargetPos |
float[6] |
Target pose in the BASE coordinate system [X, Y, Z in mm; Rx, Ry, Rz as fixed X-Y-Z angles in deg]. The function computes the joint position with inverse kinematics and writes it back into the array. |
|
fTargetVel |
float[6] |
Joint velocity limit for each axis. |
|
fTargetAcc |
float[6] |
Joint acceleration limit for each axis. |
|
fTargetTime |
float |
0.0f |
Target transition time [sec] |
Caution
The function overwrites all six elements of fTargetPos with the joint position [deg] from inverse kinematics. Pass a fresh copy of the target pose on every call; reusing the same array sends the joint values as a pose on the next call.
The joint position is the inverse-kinematics solution in solution space 2 (Lefty, Above, No Flip; see movejx) for the pose in the BASE coordinate system. Each call waits for this result from the controller and stores it in the data that the CDRFLEx object shares with get_current_posx, get_desired_posx, fkin, ikin, ikin_norm, trans, coord_transform, calc_coord, get_user_home, get_user_cart_coord and flange_serial_read, so a pointer returned earlier by one of them refers to overwritten data after servoj_g returns; copy the structure first. Do not call servoj_g inside a callback; see Rules for callback functions.
Return
Value |
Description |
|---|---|
0 |
Failed |
1 |
Success |
Example
// Preconditions: Connected, servo ON, Auto mode active
// Target pose in BASE [X, Y, Z in mm; Rx, Ry, Rz in deg]
const float target[6] = {400.f, 200.f, 300.f, 180.f, 0.f, 180.f};
float qvel[6] = {10.f, 10.f, 10.f, 10.f, 10.f, 10.f};
float qacc[6] = {20.f, 20.f, 20.f, 20.f, 20.f, 20.f};
// servoj_g overwrites its first argument, so pass a fresh copy on every call
float pose[6];
for (int i = 0; i < 6; ++i)
pose[i] = target[i];
drfl.servoj_g(pose, qvel, qacc, 0.3f);
Note
servoj_gperforms joint interpolation with blending for smooth transitions.If
fTargetTimeexceeds hardware limits, it is automatically adjusted.servoj_gis ideal for real-time control and streaming-based trajectory updates.It is not linked with
force/stiffness controlorchange_operation_speed().Recommended for use in dynamic path control, adaptive motion, or trajectory replay applications.