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_external_torque

This function retrieves the external torque values acting on each robot joint, as estimated by the torque sensors and dynamic model inside the controller. These values represent the external interaction torques due to contact, load, or environmental forces.

Definition
DRFLEx.h within class CDRFLEx, public section

LPROBOT_FORCE get_external_torque() {
    return _get_external_torque(_rbtCtrl);
};

Parameter
None

Return

Value

Description

LPROBOT_FORCE

Pointer to a structure containing the external torque (interaction torque) of each 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 robot is connected and in operation mode

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

This example queries and prints the estimated external torque on each joint in Newton-meters (N·m). These values are typically small when the robot is free of contact, but increase when external forces (e.g., collisions or human interaction) occur.