Skip to content

[Explicit Compliance and Safety][2/3] Add optional feedforward compensation torques to DynamicConstraint in TVM and Tasks backends#501

Open
mathieu-celerier wants to merge 6 commits intojrl-umi3218:masterfrom
mathieu-celerier:topic/add-compensation-torques-dynamic-constraint
Open

[Explicit Compliance and Safety][2/3] Add optional feedforward compensation torques to DynamicConstraint in TVM and Tasks backends#501
mathieu-celerier wants to merge 6 commits intojrl-umi3218:masterfrom
mathieu-celerier:topic/add-compensation-torques-dynamic-constraint

Conversation

@mathieu-celerier
Copy link
Copy Markdown
Contributor

This PR extends the previous torque propagation framework by introducing feedforward compensation torques into the DynamicConstraint for both the TVM and Tasks backends.

For the TVM backend, a new boolean flag is added to mc_tvm::DynamicFunction to enable external torque disturbance compensation. The flag defaults to false to avoid breaking existing behavior. When enabled, feedforward compensation torques are retrieved directly within DynamicFunction from Robot, using mc_tvm::Robot::tauCompensation() when available, or falling back to the estimated external torques otherwise.

For the Tasks backend, a similar boolean flag is added to DynamicConstraint to activate disturbance compensation, also defaulted to false.
The feedforward torques are explicitly passed as Eigen::VectorXd to Tasks’ MotionConstr and MotionSpringConstr, using mc_rbdyn::Robot::compensationTorques() when provided, or mc_rbdyn::Robot::externalTorques() as a fallback.

Together, these changes enable optional feedforward disturbance rejection in the solver while preserving backward compatibility.

This PR include the content/commits of #500 and extend it.
It is also dependent on this PR in Tasks.

mathieu-celerier and others added 3 commits February 5, 2026 16:19
…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
@mathieu-celerier mathieu-celerier force-pushed the topic/add-compensation-torques-dynamic-constraint branch from 41e9a8e to 80e828f Compare March 23, 2026 10:11
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.

2 participants