How does Gazebo compute joint effort limits?
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 diffdrivecontroller, 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:
- Compute the effort required to achieve the requested wheel angular velocity within a time step
- If it's smaller than the maximum joint effort limit (jointeffortlimits) then it will apply the computed torque/effort
- If the required torque is greater than the maximum joint effort limit (jointeffortlimits), it will try to achieve the commanded speed in the smallest number of iterations possible.
Now my questions are:
- Is everything I wrote above correct?
- 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 jointeffortlimits? 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!
Asked by dlodge440 on 2019-11-14 22:53:59 UTC
Comments
Hi,
DefaultRobotHWSim
you are forced to have in your model description a<trasnmission>
element that maps your joints to an actuator in order to letgazebo_ros_control
apply efforts in the joints to move the wheels.Asked by Weasfas on 2019-11-21 07:11:14 UTC
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.Asked by Weasfas on 2019-11-21 07:17:29 UTC