You're reading the documentation for an older, but still supported version (1.33.4).
For information on the latest version, please have a look at 1.33.5.

get_joint_torque

This function retrieves the measured joint torque values from the robot’s internal torque sensors. Each joint torque value represents the applied load or motor-generated torque in real time, which can be used for diagnostics, gravity compensation, or compliance control.

Definition
DRFLEx.h within class CDRFLEx, public section

LPROBOT_FORCE get_joint_torque() {
    return _get_joint_torque(_rbtCtrl);
};

Parameter
None

Return

Value

Description

LPROBOT_FORCE

Pointer to a structure containing the measured torque values for each robot joint (J1–J6).
Units: N·m

Note

Returns the most recent monitoring value. All fields are 0 until monitoring data has been received: after open_connection, after setup_monitoring_version, and after a reconnect. The returned pointer is never NULL. Before using the value, wait for the first monitoring callback after connecting.

Example

// Assume connection and initialization completed

LPROBOT_FORCE lpForce = drfl.get_joint_torque();
if (lpForce) {
    printf("Joint Torque Readings [N·m]:\n");
    for (int i = 0; i < NUMBER_OF_JOINT; ++i) {
        printf("J%d: %.3f\n", i + 1, lpForce->_fForce[i]);
    }
} else {
    fprintf(stderr, "Failed to retrieve torque data.\n");
}

This example reads the current torque applied at each joint and prints the values in N·m, which are useful for monitoring joint load, detecting external disturbances, or validating force-control behavior.