Ros_gz_bridge not working. Unable to use rviz2 to fetch PX4 Gazebo x500_mono_cam image topic

Hi, I am trying to simulate a perception task in PX4 Gazebo. I am using: ROS2 Humble, PX4-Autopilot main branch, gz-harmonic, rviz2, ros-humble-ros-gz-bridge to get the camera feed of x500_mono_cam onto rviz2 via the bridge so that I can automate some tasks. However, I am running into the issue that my x500_mono_cam feed is not relayed to rviz2.

#Terminal 1: I do this for both PX4 from source and my fork of PX4

px4_sitl gz_x500_mono_cam

#Terminal 2: Official PX4 from source

gz topic --list
/clock
/gazebo/resource_paths
/gui/camera/pose
/gui/currently_tracked
/gui/track
/model/x500_mono_cam_0/command/gimbal_pitch
/model/x500_mono_cam_0/command/gimbal_roll
/model/x500_mono_cam_0/command/gimbal_yaw
/model/x500_mono_cam_0/command/motor_speed
/model/x500_mono_cam_0/servo_0
/model/x500_mono_cam_0/servo_1
/model/x500_mono_cam_0/servo_2
/model/x500_mono_cam_0/servo_3
/model/x500_mono_cam_0/servo_4
/model/x500_mono_cam_0/servo_5
/model/x500_mono_cam_0/servo_6
/model/x500_mono_cam_0/servo_7
/sensors/marker
/stats
/world/default/clock
/world/default/dynamic_pose/info
/world/default/model/x500_mono_cam_0/link/base_link/sensor/air_pressure_sensor/air_pressure
/world/default/model/x500_mono_cam_0/link/base_link/sensor/imu_sensor/imu
/world/default/model/x500_mono_cam_0/link/base_link/sensor/magnetometer_sensor/magnetometer
/world/default/model/x500_mono_cam_0/link/base_link/sensor/navsat_sensor/navsat
/world/default/model/x500_mono_cam_0/link/camera_link/sensor/imager/camera_info
/world/default/model/x500_mono_cam_0/link/camera_link/sensor/imager/image
/world/default/pose/info
/world/default/scene/deletion
/world/default/scene/info
/world/default/state
/world/default/stats
/x500_mono_cam_0/command/motor_speed
/model/x500_mono_cam_0/odometry_with_covariance
/world/default/light_config
/world/default/material_color
/world/default/model/x500_mono_cam_0/link/airspeed_link/sensor/air_speed/air_speed
/world/default/model/x500_mono_cam_0/link/camera_link/sensor/camera_imu/imu
/world/default/model/x500_mono_cam_0/link/flow_link/sensor/optical_flow/optical_flow
/world/default/model/x500_mono_cam_0/link/lidar_sensor_link/sensor/lidar/scan
/world/default/model/x500_mono_cam_0/link/link/sensor/lidar_2d_v2/scan
/world/default/wrench
/world/default/wrench/clear
/world/default/wrench/persistent

There is no /camera topic for x500_mono_cam in the official PX4 from source so I was not sure which topic to create a bridge for

#Terminal 2: My fork of PX4

gz topic --list
/camera_info
/clock
/gazebo/resource_paths
/gui/camera/pose
/gui/currently_tracked
/gui/track
/model/x500_mono_cam_0/command/gimbal_pitch
/model/x500_mono_cam_0/command/gimbal_roll
/model/x500_mono_cam_0/command/gimbal_yaw
/model/x500_mono_cam_0/command/motor_speed
/model/x500_mono_cam_0/servo_0
/model/x500_mono_cam_0/servo_1
/model/x500_mono_cam_0/servo_2
/model/x500_mono_cam_0/servo_3
/model/x500_mono_cam_0/servo_4
/model/x500_mono_cam_0/servo_5
/model/x500_mono_cam_0/servo_6
/model/x500_mono_cam_0/servo_7
/sensors/marker
/stats
/thermal_camera
/world/default/clock
/world/default/dynamic_pose/info
/world/default/model/x500_mono_cam_0/link/base_link/sensor/air_pressure_sensor/air_pressure
/world/default/model/x500_mono_cam_0/link/base_link/sensor/imu_sensor/imu
/world/default/model/x500_mono_cam_0/link/base_link/sensor/navsat_sensor/navsat
/world/default/pose/info
/world/default/scene/deletion
/world/default/scene/info
/world/default/state
/world/default/stats
/x500_mono_cam_0/command/motor_speed
/model/x500_mono_cam_0/odometry_with_covariance
/world/default/light_config
/world/default/material_color
/world/default/model/x500_mono_cam_0/link/airspeed_link/sensor/air_speed/air_speed
/world/default/model/x500_mono_cam_0/link/camera_link/sensor/camera_imu/imu
/world/default/model/x500_mono_cam_0/link/lidar_sensor_link/sensor/lidar/scan
/world/default/model/x500_mono_cam_0/link/link/sensor/lidar_2d_v2/scan
/world/default/wrench
/world/default/wrench/clear
/world/default/wrench/persistent

There is also no /camera topic for x500_mono_cam in my fork of PX4 but we created a /thermal_camera topic which works for one of my co-workers

#Terminal 3: Using ros_gz_bridge for /thermal_camera

ros2 run ros_gz_bridge parameter_bridge /thermal_camera@sensor_msgs/msg/Image@gz.msgs.Image
[INFO] [1743979773.704502650] [ros_gz_bridge]: Creating GZ->ROS Bridge: [/thermal_camera (gz.msgs.Image) -> /thermal_camera (sensor_msgs/msg/Image)] (Lazy 0)
[INFO] [1743979773.707870940] [ros_gz_bridge]: Creating ROS->GZ Bridge: [/thermal_camera (sensor_msgs/msg/Image) -> /thermal_camera (gz.msgs.Image)] (Lazy 0)

#Terminal 4: rviz2

I have no idea why this is not working for me. It works for two of my co-workers who have had PX4 for 2 years on their laptops. However, everyone else who just downloaded PX4 (by just I mean over the past 8 months) does not have image topic working on rviz2. I would love and appreciate any help regarding this

This is the camera topic. When you bridge it, you have to define a static tf transform between the sensor frame and the base_link frame and then broadcast a tf transformation between the base_link and the map frame. This way you can visualize the camera feed in RViz. Otherwise, you can also use rqt_image_view or an application like Foxglove.

P.S. You should start with using the Image Display option in Gazebo to check if you have a camera feed.

1 Like

Hii, I am facing the same issue. I have tried in rqt_image_view also, it didn’t work. I don’t know where its going wrong.