-
Notifications
You must be signed in to change notification settings - Fork 782
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_effort
plugin.
Read more about the migration of gazebo_ros_api_plugin
at ROS 2 Migration: gazebo_ros_api_plugin.
The usage is similar to ROS1, except for the changes in call while specifying start_time
and duration
due to changes in rclcpp::Time.
First, run Gazebo with the plugin:
gazebo --verbose -s libgazebo_ros_effort.so
Now call the apply_body_wrench
service from the command line, for example:
ros2 service call /apply_body_wrench gazebo_msgs/srv/ApplyBodyWrench '{body_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 apply_body_wrench
service from the command line, for example:
ros2 service call /clear_body_wrench gazebo_msgs/srv/BodyRequest '{body_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_forces
service from the command line, for example:
ros2 service call /clear_joint_forces gazebo_msgs/srv/JointRequest '{joint_name: "joint"}'