Skip to content

[Explicit Compliance and Safety] Introduce CBF formulation for collision and joint constraints - #531

Open
bastien-muraccioli wants to merge 10 commits into
jrl-umi3218:masterfrom
bastien-muraccioli:feature/cbf-constraints
Open

[Explicit Compliance and Safety] Introduce CBF formulation for collision and joint constraints#531
bastien-muraccioli wants to merge 10 commits into
jrl-umi3218:masterfrom
bastien-muraccioli:feature/cbf-constraints

Conversation

@bastien-muraccioli

Copy link
Copy Markdown
Contributor

This PR introduces Control Barrier Function (CBF) constraints for collision avoidance and joint position/velocity limits, targeting closed-loop torque-controlled robots.

The standard velocity damper formulation can become fragile in closed-loop settings, where sensor noise and feedback effects may lead to constraint violations.
This PR reformulates these constraints using a CBF-based approach, improving robustness and safety during execution.

This includes:

  • CBF-based formulation of:
    • collision constraints
    • joint position constraints
    • joint velocity constraints
  • Additional logging for collision constraints

The implementation follows the approach described in:
Safe Execution of RL Policies via Acceleration-based CBF-QP Constraint Enforcement for Real-World Robotic Deployments

The CBF formulation is only supported by the TVM backend and requires the following PR to be merged first:
Add closed-loop velocity damper#59

This PR builds upon and extends the work from #500, #501, and #502.

mathieu-celerier and others added 10 commits May 4, 2026 13:25
…heir equivalent joint accelerations to `Robot`

Add the new members `externalTorques_`, `compensationTorques_`,
`exteralTorquesAcc_` and `compensationTorquesAcc_` to `mc_rbdyn::Robot`.
Allong with their setters and getters `setExternalTorques`,
`setCompensationTorques`, `setExternalTorquesAcc`,
`setCompensationTorquesAcc`.
Note that the compensation torques and associated equivalent
accelerations are set as std::optional.
This is intended for later use for external forces compensation and
explicit compliance.
…asks backend and closedLoop feedback type in both TVM and Tasks

Since Tasks backend doesn't benefit from a computation graph, the joint
acceleration equivalent to the external/compensation torques should be
computed once before hand for later use by tasks in the solver.
For both Tasks and TVM, the information of external torques in robot are
updated from realRobot.
…raint` in the Tasks backend

Add an additional boolean argument to `DynamicConstraint` to enable
compensation of external torques disturbance estimation.
The boolean is defaulted to false to prevent breaking change.
The feedforward compensation torques are passed as an `Eigen::VectorXd`
to
Tasks' `MotionConstr` and `MotionSpringConstr`.
The compensation torques are obtained from
`mc_rbdyn::Robot::compensationTorques()` if available or
`mc_rbdyn::Robot::externalTorques()` otherwise.
…raint` in the TVM backend

Add an additional boolean argument to `mc_tvm::DynamicFunction` to
enable
compensation of external torques disturbance estimation.
The boolean is defaulted to false to prevent breaking change.
The feedforward compensation torques are obtained directly in the
`DynamicFunction` using `Robot`.
The compensation torques are obtained from
`mc_tvm::Robot::tauCompensation()` if available or
`mc_rbdyn::Robot::tauExternal()` otherwise.
…setExternalTorques funtion of Tasks MotionConstr
…ckend

New compliant alternative for tasks are:
- CompliantPostureTask
- CompliantPositionTask
- CompliantOrientationTask
- CompliantEndEffectorTask
Impacted tasks:
- CompliantPostureTask
- CompliantPositionTask
- CompliantOrientationTask
- CompliantEndEffectorTask
@mergify

mergify Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants