gazebosim / ros_gz

Integration between ROS (1 and 2) and Gazebo simulation
https://gazebosim.org
Apache License 2.0
209 stars 125 forks source link

ros_gz_bridge support for gz.msgs.EntityWrench #566

Closed Vtn21 closed 1 day ago

Vtn21 commented 1 week ago

Hello, I would like to apply external forces to robot links in Gazebo using the apply_link_wrench plugin and exposing its corresponding Gazebo topics to ROS topics.

However, apply_link_wrench uses the gz.msgs.EntityWrench message, which is not included in the correspondence table of ros_gz_bridge.

Desired behavior

Implement a corresponding ROS message type (something like ros_gz_interfaces/msg/EntityWrench) and a bridge mapping between it and gz.msgs.EntityWrench.

Alternatives considered

Considered using the apply_joint_force plugin instead, as it uses the gz.msgs.Double type, which is included in ros_gz_bridge. Specifically for my use case it would be enough, however loading this plugin stops the controller (ros2_control) from working. In contrast, the apply_link_wrench plugin can be loaded (attached to the world) without interfering with the controller.

Implementation suggestion

The new message type can be similar to the already implemented ros_gz_interfaces/msg/JointWrench as follows:

std_msgs/Header header
std_msgs/String entity
geometry_msgs/Wrench wrench

Suggested fields correspond to the gz.msgs.EntityWrench message, enabling ros_gz_bridge to convert between them.

Additional context

As the apply_body_wrench service that was available in Gazebo Classic seems to have no direct replacement in modern Gazebo, I believe the suggested interface together with the already available apply_link_wrench public is a welcome feature.

If all this makes sense, I would be pleased to help with the implementation. Thanks in advance!

Vtn21 commented 5 days ago

572 adds EntityWrench to the iron branch; upon merging, I can also implement the feature on humble and ros2 branches.