Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Camera image bridge from Gazebo to ROS 2 failing with OakD-Lite in PX4 SITL simulation #91

Open
sidharthmohannair opened this issue Mar 12, 2025 · 0 comments

Comments

@sidharthmohannair
Copy link

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

  1. Start PX4 SITL with the depth camera model:

    cd ~/PX4-Autopilot
    make px4_sitl gz_x500_depth
  2. 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
    
  3. 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
  4. Check that ROS 2 topics are created:

    ros2 topic list | grep -E 'camera|depth'

    Output includes:

    /camera/camera_info
    /camera/image_raw
    /depth_camera
    
  5. 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.

  6. 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

  1. Using parameter_bridge with different topic configurations
  2. Using ros_gz_image directly with the image topics
  3. Trying alternative topic names
  4. Cleaning shared memory: sudo rm -rf /dev/shm/rtps*
  5. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant