set_singular_handling_force (Auto Mode)

This function configures the robot’s singularity handling policy for force and compliance control during Auto mode operation.

When a singularity is detected, force or compliance control may become unstable due to ill-conditioned Jacobian matrices. This function determines whether force-based commands are rejected with an error or allowed to proceed in such situations.

By default, force or compliance control is rejected within singularity regions to ensure safe and conservative operation.

Available modes

  • SINGULARITY_ERROR: Generates an error when force or compliance control is executed within a singularity region (default).

  • SINGULARITY_IGNORE: Ignores singularity-related restrictions and allows force or compliance control to proceed.

Definition
DRFLEx.h within class CDRFLEx, public section (line 987)

bool set_singularity_handling_force(SINGULARITY_FORCE_HANDLING eMode) {
    return _set_singular_handling_force(_rbtCtrl, eMode);
};

Parameter

Parameter Name

Data Type

Default Value

Description

eMode

SINGULARITY_FORCE_HANDLING

SINGULARITY_ERROR

Sets the singularity handling policy for force and compliance control.

Return

Value

Description

0

Failed to update singularity handling policy for force control.

1

Successfully applied the new singularity handling policy for force control.

Example

   CDRFLEx drfl;

    // Move to a near-singular joint pose (example)
    float q_sing[6] = { 0.0f, -40.0f, 80.0f, 0.0f, 40.0f, 0.0f };
    drfl.movej(q_sing, 10.0f, 10.0f);

    // Enable task compliance control
    float stiffness[6] = { 100.f, 100.f, 100.f, 20.f, 20.f, 20.f };
    drfl.task_compliance_ctrl(stiffness);

    // Desired force (example: Z- direction)
    float fd[6]   = { 0.f, 0.f, -10.0f, 0.f, 0.f, 0.f };
    unsigned char fdir[6] = { 0, 0, 1, 0, 0, 0 };

    // CASE 1
    drfl.set_singular_handling_force(SINGULARITY_ERROR);
    drfl.set_desired_force(fd, fdir);
    // Force control is rejected in singularity regions

    // CASE 2
    drfl.set_singular_handling_force(SINGULARITY_IGNORE);
    drfl.set_desired_force(fd, fdir);
    // Force control is allowed near singularity regions (use with caution)

    drfl.release_compliance_ctrl();
}

This example demonstrates how to configure the singularity handling strategy for force and compliance control in Auto mode. Allowing force control near singular regions may increase task flexibility, but should be used with caution due to potential instability or inaccurate force estimation.