osrf / vrx

Virtual RobotX (VRX) resources.
Apache License 2.0
421 stars 189 forks source link

move tf to ros #698

Closed j-herman closed 1 year ago

j-herman commented 1 year ago

This PR is an alternative to PR 664 which also resolves many of the TF issues in 681. It changes the way we publish TF information on the ROS side by:

A launch file to start an instance of RViz with a custom config file is included for testing and for the tutorial.

UNKNOWN, help needed: Is any other process on the Gazebo side using the transforms from the sdf that PosePublisher was producing previously? I think not, as we have access to the truth data, but if so this PR will likely break something and needs to be reworked.

To test:

ros2 launch vrx_gz competition.launch.py world:=stationkeeping_task ros2 launch vrx_gazebo rviz.launch.py

Confirm the wamv appears with all components drawn and in the right place.

ros2 topic pub /wamv/thrusters/left/pos std_msgs/msg/Float64 "{data: -1}"

Watch the left engine/propeller move in RViz as it moves in Gazebo.

ros2 run tf2_tools view_frames

Confirm the new TF tree is structured correctly.

I still haven't looked into the extra "wamv/" prepended on the PosePublisher's output, so this code adds the prefix to all ROS-generated link names instead, in order to make the sensor sdf links connect correctly. This is minor but annoying, so if we decide to implement this I will take another look at it.

j-herman commented 1 year ago

@M1chaelM @caguero This is ready for a look, but we'll need to discuss. I do think it fixes the tf issues but I'm not sure if/when we want to make a significant change. Marked both this and the other option (tutorial hack only) as draft pending decisions.

j-herman commented 1 year ago

I don't think the extra cameras and lidar are necessary - it's super easy to add them, and one topic is shown as an example - but there's no reason not to have them all if you think that would look better for the demo. Whichever you prefer works for me!