This Gazebo/ROS plugin allows you to easily add a torsional spring to your robot in Gazebo.
cd ~/catkin_ws/src
git clone [email protected]:aminsung/gazebo_joint_torsional_spring_plugin.git
cd ~/catkin_ws
catkin_make
This plugin attaches to a joint, so the plugin needs to be given a reference to that link.
<robot>
<joint name="knee_joint">
... joint description ...
</joint>
<gazebo>
<!-- joint torsional spring plugin -->
<plugin name="knee_joint_torsional_spring" filename="libgazebo_joint_torsional_spring.so">
<kx>0.1</kx>
<set_point>0.5</set_point>
<joint>knee_joint</joint>
</plugin>
</gazebo>
</robot>
kx
: The spring coefficient in N-m
set_point
: The angle at which the joint would feel no force in radians
joint
: Name of the joint to add the torsional spring to
If you find a bug in the code, feel free to submit a pull request.