change_collision_sensitivity

This function configures the collision sensitivity of the robot controller.
A higher sensitivity value makes the robot more responsive to small contact forces, while a lower value allows for greater tolerance before triggering a collision stop.

Definition
DRFLEx.h within class CDRFLEx, public section

bool change_collision_sensitivity(float fSensitivity)
{
    return _change_collision_sensitivity(_rbtCtrl, fSensitivity);
};

Caution

On a real robot the call is accepted only with servo off, during initialisation, or in Manual mode with the robot stopped. Otherwise it returns false, an alarm is reported, the motion is quick-stopped and a running program is stopped.

Parameter

Parameter Name

Data Type

Default Value

Description

fSensitivity

float

Collision sensitivity level, 1 to 100. Values outside this range are refused: the call returns false and an alarm is reported.
1: Minimum sensitivity (less reactive)
100: Maximum sensitivity (most reactive)

Return

Value

Description

0

The call was refused.

1

No refusal was received. A return of true does not confirm that the setting was applied.

Example

// Enable automatic motion stop for safety
Drfl.set_auto_safety_move_stop(true);

// Set collision sensitivity to 20 (range: 1~100)
// A lower value increases sensitivity (e.g., for human-collaborative tasks)
Drfl.change_collision_sensitivity(20.0f);

// Example motion (pseudo-code)
// The robot will stop automatically upon detecting an external force
float target[6] = {500, 100, 300, 180, 0, 180};
float v[2] = {60, 60};
float a[2] = {60, 60};
// Drfl.movej(target, v, a);

// Wait to simulate motion duration
std::this_thread::sleep_for(std::chrono::seconds(5));

// Restore default sensitivity after task
Drfl.change_collision_sensitivity(50.0f);

This example enables automatic safety motion stop and adjusts the collision sensitivity to 20, which makes the robot more responsive to external contact. After the motion is finished, the sensitivity is reset to a normal level (50) for standard operation.