Skip to content

ApplyJointForce plugin

gazebo source demo world

ApplyJointForce is model plugin that Apply joint raw force/torque to specific joint, create subscriber the names /model/<model named>/joint/<joint name>/cmd_force can control from cli using

joint force using cli
1
2
3
# joint_force_example is the model name
# j1 is the joint name
gz topic -t "/model/joint_force_example/joint/j1/cmd_force" -m gz.msgs.Double  -p "data: 0.001"
plugin xml declaration
1
2
3
4
5
<plugin
    filename="gz-sim-apply-joint-force-system"
    name="gz::sim::systems::ApplyJointForce">
        <joint_name>j1</joint_name>
</plugin>


force

Constant force (or torque for revolute joints) Units:

  • Revolute → Nm (torque)
  • Prismatic → N (linear force)

Don't forget joint damping

<joint name="j1" type="revolute">
    <pose>0 0 -0.5 0 0 0</pose>
    <parent>base_link</parent>
    <child>rotor</child>
    <axis>
      <xyz>0 0 1</xyz>
      <dynamics>
        <damping>0.0001</damping>
      </dynamics>
    </axis>
  </joint>

torque apply to joint

Not to the link


Reference