Skip to content

Apply Torque Constraints from URDF in Controller #455

@Ahmadreza-Shahrokhshahi

Description

Dear @gergondet and @arntanguy,

I am currently working on applying torque constraints to the robot joints using the effort limits specified in the URDF file. Initially, I expected that the effort limits would be automatically applied by the system, similar to position and velocity limits. However, it appears that a dynamics constraint needs to be explicitly added to the controller to enforce the torque constraints.

To address this, I declared an object of the DynamicsConstraint class in the controller header as follows:
mc_solver::DynamicsConstraint robotTorqueConstraint = mc_solver::DynamicsConstraint(this->robots(), 0, this->timeStep, {0.01, 0.001, 0.05}, 1.0, false);

In declaration, I used the one with the damper and velocityPercent since the other one would cause a QP failure once it is called.

Then, I added this constraint to the solver in the controller:
robotTorqueConstraint.addToSolver(solver());

Additionally, I adjusted the default minimum and maximum torque values in Robot.cpp from zero to infinity to allow the robot to walk:
fill_bound(mb, "lower torque", bounds.at(4), &rbd::Joint::dof, -INFINITY, -INFINITY),
fill_bound(mb, "upper torque", bounds.at(5), &rbd::Joint::dof, INFINITY, INFINITY)
Without these adjustments, the robot exhibits sudden, erratic movements and is unable to walk.

At this point, the robot walks without any issues, but it seems that the torque constraints specified in the URDF file are not being applied to the system.

image

The above image shows that the robot walked a few steps with the effort limit set to 100 for all joints. The joint torques and limits are shown only for L_HIP_R and R_HIP_R for clarity, but the same issue is observed for the other joints. Despite this, it is evident that the joint torques exceed these limits. I have double-checked the torque limits in the controller, and they match the URDF.

Could you please advise if there are any additional modifications or steps required to ensure that the torque constraints are correctly enforced?

Thank you for your assistance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions