Reimplement computeTorque() for Accurate B1 Motor Simulation#89
Open
paulblum wants to merge 1 commit intounitreerobotics:masterfrom
Open
Reimplement computeTorque() for Accurate B1 Motor Simulation#89paulblum wants to merge 1 commit intounitreerobotics:masterfrom
computeTorque() for Accurate B1 Motor Simulation#89paulblum wants to merge 1 commit intounitreerobotics:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
This pull request addresses issue #66, which identifies the clamping of joint torque commands to ±55 Nm by
UnitreeJointController. This limitation hinders the accurate simulation of B1 motors, which have ±140 Nm capability.The impact is evident in the following visualizations, where B1 is commanded to trot in place:
Problem:
The issue lies in
UnitreeJointController's usage (line 180, below) of thecomputeTorque()function from unitree_ros/unitree_legged_control/lib, which inadvertently clamps its output to ±55 Nm.unitree_ros/unitree_legged_control/src/joint_controller.cpp
Lines 178 to 181 in 67ac212
Notably, this clamping is redundant, as the joint torque computation is already clamped to URDF specifications (line 181, above) by the
effortLimits()function.Solution:
This pull request proposes the removal of the ±55 Nm clamp from
computeTorque(), introducing the following implementation:calcTorque = servoCmd.torque + servoCmd.posStiffness*(servoCmd.pos - currentPos) + servoCmd.velStiffness*(servoCmd.vel - currentVel);Rationale:
This modification allows for the utilization of
UnitreeJointControllerto accurately simulate B1 control, while preserving its original functionality for smaller quadrupeds.