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

Hi, I am using the basic software stack for simulating x500 on PX4 gazebo to try and use camera to run a few perception tasks. I am using ROS2 and PX4 with PX4 gz to try and get the simulation camera footage. The issue that I am running into is that I am not completely sure how to get the simulation camera footage in rviz2. I am using the ros_gz_bridge using this command below:

 keshav ~/PX4-Autopilot: ros2 run ros_gz_bridge parameter_bridge /camera@sensor_msgs/msg/Image@gz.msgs.Image

[INFO] [1742491673.362984944] [ros_gz_bridge]: Creating GZ->ROS Bridge: [/camera (gz.msgs.Image) -> /camera (sensor_msgs/msg/Image)] (Lazy 0)
[INFO] [1742491673.365093776] [ros_gz_bridge]: Creating ROS->GZ Bridge: [/camera (sensor_msgs/msg/Image) -> /camera (gz.msgs.Image)] (Lazy 0)

However, when I try to view the feed in rviz2, I get no image relayed

I also tried following the steps on ros_gz/ros_gz_bridge/README.md at 630b477ec12627563cc68cfa43d6b3657dc4e985 · gazebosim/ros_gz · GitHub
for Example 2: Run the bridge and exchange images

First we start Gazebo Sim (don't forget to hit play, or Gazebo Sim won't generate any images).
# Shell A:
gz sim sensors_demo.sdf

Let's see the topic where camera images are published.
# Shell B:
gz topic -l | grep image
/rgbd_camera/depth_image
/rgbd_camera/image

Then we start the parameter bridge with the previous topic.
# Shell B:
. ~/bridge_ws/install/setup.bash
ros2 run ros_gz_bridge parameter_bridge /rgbd_camera/image@sensor_msgs/msg/Image@gz.msgs.Image

Now we start the ROS GUI:
# Shell C:
. /opt/ros/rolling/setup.bash
ros2 run rqt_image_view rqt_image_view /rgbd_camera/image

However, when I run this as well. I get no image as seen in the image below:

@Benja I would love your help with this

I’m doing it this way:

source /opt/ros/humble/setup.bash
ros2 run ros_gz_image image_bridge /camera
make px4_sitl gz_x500_mono_cam
1 Like

Were you able to solve the issue?

1 Like

I am having the same issue, no clue still

1 Like

i solved the problem ,install ws_sensor_combined from here and build it ROS 2 User Guide | PX4 Guide (main)

and then make sure terminals
-MicroXRCEAgent udp4 -p 8888 working
one terminal publising
-cd ~/ws_sensor_combined
-source install/local_setup.bash
-ros2 run ros_gz_bridge parameter_bridge /world/default/model/x500_gimbal_0/link/camera_link/sensor/camera/image@sensor_msgs/msg/Image[gz.msgs.Image (make sure from gz topic -l )

and the other terminal or python code should be started under
-cd ws_sensor_combined
–source install/local_setup.bash
you can see with
ros2 topic list
ros2 run rqt_image_view rqt_image_view or
ros2 topic echo /world/default/model/x500_gimbal_0/link/camera_link/sensor/camera/image

1 Like

Hi, I am also facing same issue.
My gazebo is publishing video stream. I can see live stream in gazebo under “image” section.

root@System:~/ros2_ws# gz topic -l
/camera
/camera_info
/clock
/depth_camera
/depth_camera/points

root@System-:~/ros2_ws# gz topic -i -t /camera
gave me tcp://172.17.0.1:45935, gz.msgs.Image

a. I tried using ros2 run ros_gz_bridge parameter_bridge /camera@sensor_msgs/msg/Image[gz.msgs.Image

output was : [INFO] [1763635094.468501807] [ros_gz_bridge]: Creating GZ->ROS Bridge: [/camera (gz.msgs.Image) → /camera (sensor_msgs/msg/Image)] (Lazy 0)

b. Also tried :

ros2 run ros_gz_image image_bridge /camera

Neither of them gave anything on rqt_image_view or ros2 topic echo /camera or /camera/image is not giving out anything at all.

I double check namespace and sourcing. Installed ws_sensor_combined as well.
RUN mkdir -p /root/ws_sensor_combined/src &&
cd /root/ws_sensor_combined/src &&
git clone
GitHub - PX4/px4_msgs: ROS/ROS2 messages that match the uORB messages counterparts on the PX4 Firmware -b release/1.15 &&
git clone
GitHub - PX4/px4_ros_com: ROS2/ROS interface with PX4 through a Fast-RTPS bridge -b release/1.15 &
/bin/bash -c “source /opt/ros/humble/setup.bash && cd /root/ws_sensor_combined && colcon build”
RUN echo “source /root/ws_sensor_combined/install/setup.bash” >> /root/.bashrc

Any help appreciated.

Unfortunately , Its not working for me!

Hi N_J,

Are you able to echo and see the contents in the gazebo topic?

For example:
gz topic -e -t /front_camera

Also it might be good to check the camera topics in their respective sdf files
For example, in ~/PX4-Autopilot/Tools/simulation/gz/models/OakD-Lite:
The name of the gazebo topic is listed here in the sdf file

Hello, I have checked this already.

I can see data flowing for “gz topic -e -t /camera”.

The issue is how the bridge handling this gz topic and converting to ROS2 topic(or how I understand it ). Even with gz is publishing camera data, the command “ros2 run ros_gz_image image_bridge /camera” don’t give any output. Even attaching this topic to a subscriber with QoS settings did not help me.
Btw, I am using px4 1.15.2 , ros2 humble, Gazebo Harmonic(7.9.0).

Hi N_J,

Hmm, if its a ros_gz_bridge issue maybe can try some examples from here: ros_gz/ros_gz_bridge at ros2 · gazebosim/ros_gz · GitHub or build the package from source?
I ran ros2 run ros_gz_bridge parameter_bridge /camera@sensor_msgs/msg/Image[gz.msgs.Image

with the same output and I can see the image on my foxglove pane: [INFO] [1763635094.468501807] [ros_gz_bridge]: Creating GZ->ROS Bridge: [/camera (gz.msgs.Image) → /camera (sensor_msgs/msg/Image)] (Lazy 0)

Thanks.
I tried ros2 run ros_gz_bridge parameter_bridge /camera@sensor_msgs/msg/Image[gz.msgs.Image
[INFO] [1764827059.402891776] [ros_gz_bridge]: Creating GZ->ROS Bridge: [/camera (gz.msgs.Image) → /camera (sensor_msgs/msg/Image)] (Lazy 0)

Still nothing on foxglove or ros2 topic hz /camera even though I can see /camera as a topic in ros 2 topic list.

Now let me try building from source.

Meanwhile can you let me know the combination of Ubuntu, ROS2, gazebo version that you use ? Are you using a docker ?

Thanks again

Hi N_J,

Sorry for the late reply.

Currently i am using a docker container from GitHub - monemati/PX4-ROS2-Gazebo-YOLOv8: Aerial Object Detection using a Drone with PX4 Autopilot and ROS 2. PX4 SITL and Gazebo Garden used for Simulation. YOLOv8 used for Object Detection.

I believe its ubuntu 22.04, ros2 humble and gazebo garden

For me it works with the command ros2 run ros_gz_bridge parameter_bridge /camera@sensor_msgs/msg/Image[gz.msgs.Image

Hello,

I checked this docker already.

When I use the first option of pulling the image from dockerhub, yes ros2 run ros_gz_image image_bridge /camera works(even though i faced some issue with graphics, i managed to run with CPU alone!). But when I use the second option of building dockerfile give(and you see it uses main branch) it fails to execute ros2 run ros_gz_image image_bridge /camera. I then updated the dockerfile with 1.15.0 as mentioned in the description still not working.!
I dig deep, looks like he used v1.15.0-beta1-2622-gc9f64aeea8 , maybe that was the reason(with c9f64aeea8 tag).
Later I tested with c9f64aeea8, still not solved. This one is going in mystery. :frowning:

Hello,

I have also been trying out another simulation from ROSCON here:

In their launch file they just used:
Node(
package=“ros_gz_image”,
executable=“image_bridge”,
name=“camera_image_bridge”,
output=“screen”,
arguments=[
camera_topic,
],
remappings=[
(camera_topic, “/camera”),
(f"{camera_topic}/compressed", “/camera/compressed”),
],
)

Maybe you can take a look at this other simulation if it suits your project more

1 Like

Hi, have you managed to solve this issue? I’m also struggling with it. Ros2 humble, ubuntu 22.04, gazebo harmonic 8.10. I can see the camera topic, view it in gazebo, but the bridge is not working. I tried different drone setups, different PX4 release branches, to no avail.
I just want to be able to access the camera feed in ROS2 to do basic aruco tag detection but it’s taking forever.

Hello, I know that pain. :frowning:

I couldn’t solve it myself, but @monkescripts here suggested to use roscon-25-workshop docker. So I shifted completely to that and it worked. Here is my setup if it helps you. GitHub - rrajnidhi/px4_1.16_ros2_xrce_dds: Development project : PX4_1.16 + ROS 2 Humble on Ubuntu 22.04

1 Like