-
Notifications
You must be signed in to change notification settings - Fork 773
ROS 2 Migration: Body Wrench and Joint Effort
In ROS 1, services for applying wrenches on links and efforts on joints in simulation were provided by the gazebo_ros_api_plugin
. In ROS 2, this feature is provided by the gazebo_ros_force_system
plugin.
Read more about the migration of gazebo_ros_api_plugin
at ROS 2 Migration: gazebo_ros_api_plugin.
- Usage of
body
in services have been replaced bylink
to match the gazebo specs. -
clear_joint_forces
has been renamed toclear_joint_efforts
to match the rest of the API.
ROS 1 | ROS 2 | |
---|---|---|
Service names | apply_body_wrench |
apply_link_wrench |
clear_body_wrenches |
clear_link_wrenches |
|
apply_joint_effort |
apply_joint_effort |
|
clear_joint_forces |
clear_joint_efforts |
|
Service types | gazebo_msgs/ApplyBodyWrench |
gazebo_msgs/ApplyLinkWrench |
gazebo_msgs/BodyRequest |
gazebo_msgs/LinkRequest |
|
gazebo_msgs/ApplyJointEffort |
gazebo_msgs/ApplyJointEffort |
|
gazebo_msgs/JointRequest |
gazebo_msgs/JointRequest |
|
First, run Gazebo with the plugin:
gazebo --verbose -s libgazebo_ros_force_system.so
Now call the apply_link_wrench
service from the command line, for example:
ros2 service call /apply_link_wrench gazebo_msgs/srv/ApplyLinkWrench '{link_name: "box::link", reference_frame: "", reference_point: { x: 100, y: 0, z: 0 }, wrench: { force: { x: 10, y: 0, z: 0 }, torque: { x: 0, y: 0, z: 0 } }, start_time: {sec: 0, nanosec: 0}, duration: {sec: -1, nanosec: 0} }'
Call the clear_link_wrenches
service from the command line, for example:
ros2 service call /clear_link_wrenches gazebo_msgs/srv/LinkRequest '{link_name: "box::link"}'
Call the apply_joint_effort
service from the command line, for example:
ros2 service call /apply_joint_effort gazebo_msgs/srv/ApplyJointEffort '{joint_name: "joint", effort: -1.0, start_time: {sec: 0, nanosec: 0}, duration: {sec: 2000, nanosec: 0} }'
Call the clear_joint_efforts
service from the command line, for example:
ros2 service call /clear_joint_efforts gazebo_msgs/srv/JointRequest '{joint_name: "joint"}'