How does Gazebo compute joint effort limits?

asked 2019-11-14 21:53:59 -0600

dlodge440 gravatar image

In the past days, I've been trying to understand how Husky ROS commands are handed to Gazebo-9 and then translated into wheel torques. So far this is what I found out:

  • Husky diff_drive_controller, by default, doesn't use any PID gains (Question, ROS Documentation) and simply computes the right-wheels and left-wheels angular velocities using simple kinematic relations.
  • When Gazebo receives the wheels speed it computes the wheels effort using the DefaultRobotHWSim package (Gazebo Tutorial)
  • Within the DefaultRobotHWSim package, if no PID gains are found, Gazebo will directly set the wheel speeds (joints velocity) using the Joint Motors (Source Code, Gazebo Tutorial). Its logic is as follows:
    1. Compute the effort required to achieve the requested wheel angular velocity within a time step
    2. If it's smaller than the maximum joint effort limit (joint_effort_limits) then it will apply the computed torque/effort
    3. If the required torque is greater than the maximum joint effort limit (joint_effort_limits), it will try to achieve the commanded speed in the smallest number of iterations possible.

Now my questions are:

  1. Is everything I wrote above correct?
  2. Given that in the Husky description files (LINK) no joint effort limit is declared for the wheels, how does Gazebo evaluate them? What values does it use as joint_effort_limits? I tried to interpret the source code but couldn't find an answer.

Context: I'm trying to understand how the initial command (/cmd_vel expressed in linear velocity dx and angular velocity around z axes) is translated into wheel torques. The final goal is to represent the whole model in Simulink and develop some new controllers without having to run the simulation in Gazebo. It will only be used for future tests.

What I'm using: ROS Melodic, Gazebo-9 (intalled with ROS), Husky default packages

Thanks for your help!

edit retag flag offensive close merge delete



  1. The diff_drive_controller is based on the cinematic calculations of a diff drive base. There is a lot of literature addressing these kinematics.
  2. Whit DefaultRobotHWSim you are forced to have in your model description a <trasnmission> element that maps your joints to an actuator in order to let gazebo_ros_control apply efforts in the joints to move the wheels.
  3. That is correct
Weasfas gravatar imageWeasfas ( 2019-11-21 06:11:14 -0600 )edit

For the second question the <limit> tag is only compulsory for revolute and prismatic joint.

If you do not provide the limit, when you convert the Xacro into URDF and then in SDF by Gazebo, the limit effort tag takes the default value that is -1 meaning that limit is not enforced.

Besides the husky controller is not controlling the base with effort but velocity since the transmission is a VelocityJointInterface one.

Weasfas gravatar imageWeasfas ( 2019-11-21 06:17:29 -0600 )edit