RobotecAI / RGLGazeboPlugin

Other
61 stars 11 forks source link

Issue with using `ros_gz_bridge` with PointCloud topics #21

Closed adamsj-ros closed 1 year ago

adamsj-ros commented 1 year ago

I followed the basic instructions to start ign gazebo sonoma_with_rgl.sdf and that works. I can see all the Gazebo topics with ign topic -l and examine the types with ign topic -i -t /.... The problem occurs when I try to run the ROS2/GZ bridge. I've used the bridge before with other topics so I was wondering if anyone has tried this/experienced this with this plugin and had the same problem.

I ran:

❯ ros2 run ros_gz_bridge parameter_bridge /rgl_lidar@sensor_msgs/msg/PointCloud2@ign_msgs.PointCloudPacked
[INFO] [1694118962.187882535] [ros_gz_bridge]: Creating GZ->ROS Bridge: [/rgl_lidar (ign_msgs.PointCloudPacked) -> /rgl_lidar (sensor_msgs/msg/PointCloud2)] (Lazy 0)
[WARN] [1694118962.188055765] [ros_gz_bridge]: Failed to create a bridge for topic [/rgl_lidar] with ROS2 type [sensor_msgs/msg/PointCloud2] to topic [/rgl_lidar] with Gazebo Transport type [ign_msgs.PointCloudPacked]

Even though it's a WARN. It's definitely not working.

The message types should be compatible as shown at this link. https://github.com/gazebosim/ros_gz/tree/ros2/ros_gz_bridge#bridge-communication-between-ros-and-gazebo

msz-rai commented 1 year ago

@adamsj-ros I encountered the same problem when I was configuring ros_gz_bridge with command line parameters. The solution that worked for me was to switch the bridge configuration method to YAML. I created a new YAML file with content:

- topic_name: "rgl_lidar"
  ros_type_name: "sensor_msgs/msg/PointCloud2"
  gz_type_name: "ignition.msgs.PointCloudPacked"
- topic_name: "rgl_lidar/world"
  ros_type_name: "sensor_msgs/msg/PointCloud2"
  gz_type_name: "ignition.msgs.PointCloudPacked"

and ran:

ros2 run ros_gz_bridge parameter_bridge --ros-args -p config_file:=/full/path/to/your/config.yaml

If anyone knows why command line topics configuration doesn't work we will be grateful for the information.

adamsj-ros commented 1 year ago

That worked well. Thank you!