Description
When using the ros_gz_bridge package to connect Gazebo camera topics to ROS 2 for visualization, the bridge establishes but no data flows through. The camera topics exist in Gazebo and appear in ROS 2 after bridging, but no messages are received by ROS 2 subscribers. This prevents visualization and use of camera data in ROS 2 applications.
Environment
- OS: Ubuntu 22.04
- ROS 2: Humble
- Gazebo: Garden/Harmonic
- PX4 Version: Latest main branch
- Hardware: GPU-based system
- ROS_GZ Packages: ros-humble-ros-gz-bridge, ros-humble-ros-gz-image
Drone Model
Using x500_depth which includes the OakD-Lite camera:
<?xml version="1.0" encoding="UTF-8"?>
<sdf version='1.9'>
<model name='x500_depth'>
<include merge='true'>
<uri>x500</uri>
</include>
<include merge='true'>
<uri>model://OakD-Lite</uri>
<pose>.12 .03 .242 0 0 0</pose>
</include>
<joint name="CameraJoint" type="fixed">
<parent>base_link</parent>
<child>camera_link</child>
<pose relative_to="base_link">.12 .03 .242 0 0 0</pose>
</joint>
</model>
</sdf>
Steps to Reproduce
-
Start PX4 SITL with the depth camera model:
cd ~/PX4-Autopilot
make px4_sitl gz_x500_depth
-
Verify camera topics exist in Gazebo:
gz topic -l | grep -i camera
Output includes:
/camera_info
/depth_camera
/depth_camera/points
/gui/camera/pose
/world/default/model/x500_depth_0/link/camera_link/sensor/IMX214/camera_info
/world/default/model/x500_depth_0/link/camera_link/sensor/IMX214/image
/world/default/model/x500_depth_0/link/camera_link/sensor/camera_imu/imu
-
Start the ROS-Gazebo bridge:
# Using parameter_bridge with a config file containing:
- topic_name: "/world/default/model/x500_depth_0/link/camera_link/sensor/IMX214/image"
ros_type_name: "sensor_msgs/msg/Image"
gz_type_name: "gz.msgs.Image"
direction: GZ_TO_ROS
lazy: false
- topic_name: "/depth_camera"
ros_type_name: "sensor_msgs/msg/Image"
gz_type_name: "gz.msgs.Image"
direction: GZ_TO_ROS
lazy: false
-
Check that ROS 2 topics are created:
ros2 topic list | grep -E 'camera|depth'
Output includes:
/camera/camera_info
/camera/image_raw
/depth_camera
-
Attempt to monitor message frequency:
ros2 topic hz /camera/image_raw
# or
ros2 topic hz /depth_camera
# or
ros2 topic hz /world/default/model/x500_depth_0/link/camera_link/sensor/IMX214/image
No messages are detected.
-
Launch rqt_image_view and select the camera topics:
ros2 run rqt_image_view rqt_image_view
Window appears but shows no images.
Error Messages
From the bridge:
[parameter_bridge-1] Unknown message type [8].
[parameter_bridge-1] Unknown message type [9].
[parameter_bridge-1] Unknown message type [9].
When trying to use ros_gz_image:
2025-03-12 11:49:32.647 [RTPS_TRANSPORT_SHM Error] Failed init_port fastrtps_port7415: open_and_lock_file failed -> Function open_port_internal
Expected Behavior
- Camera topics should bridge successfully from Gazebo to ROS 2
- ROS 2 subscribers should receive camera image data
rqt_image_view should display the camera feed when selecting the appropriate topic
Actual Behavior
- Bridge starts without errors but reports "Unknown message type" warnings
- No messages flow through the bridge
rqt_image_view shows no images
ros2 topic hz reports no messages received
Attempted Solutions
- Using
parameter_bridge with different topic configurations
- Using
ros_gz_image directly with the image topics
- Trying alternative topic names
- Cleaning shared memory:
sudo rm -rf /dev/shm/rtps*
- Ensuring correct permissions:
sudo chmod 777 /dev/shm
Possible Related Issues
- Message type compatibility between Gazebo and ROS 2
- Shared memory transport issues
- Potential mismatch in image format or encoding
Any guidance or solutions to get the camera feed working properly would be greatly appreciated.
Description
When using the
ros_gz_bridgepackage to connect Gazebo camera topics to ROS 2 for visualization, the bridge establishes but no data flows through. The camera topics exist in Gazebo and appear in ROS 2 after bridging, but no messages are received by ROS 2 subscribers. This prevents visualization and use of camera data in ROS 2 applications.Environment
Drone Model
Using
x500_depthwhich includes the OakD-Lite camera:Steps to Reproduce
Start PX4 SITL with the depth camera model:
Verify camera topics exist in Gazebo:
gz topic -l | grep -i cameraOutput includes:
Start the ROS-Gazebo bridge:
Check that ROS 2 topics are created:
Output includes:
Attempt to monitor message frequency:
No messages are detected.
Launch
rqt_image_viewand select the camera topics:Window appears but shows no images.
Error Messages
From the bridge:
When trying to use ros_gz_image:
Expected Behavior
rqt_image_viewshould display the camera feed when selecting the appropriate topicActual Behavior
rqt_image_viewshows no imagesros2 topic hzreports no messages receivedAttempted Solutions
parameter_bridgewith different topic configurationsros_gz_imagedirectly with the image topicssudo rm -rf /dev/shm/rtps*sudo chmod 777 /dev/shmPossible Related Issues
Any guidance or solutions to get the camera feed working properly would be greatly appreciated.