How to see PX4-Gazebo camera topic in ROS 2 Foxy? (Can see in gz topic but not ros2 topic)

Hello everyone,

I’m facing a classic Gazebo-to-ROS 2 communication problem with my PX4 setup and I’m looking for the best way forward.

My Goal:

I am running a PX4 drone simulation in Gazebo. The drone has a depth camera. I want to access the camera’s image data within my ROS 2 Foxy application (e.g., using ros2 topic echo).

My Setup:

  • OS: Ubuntu 20.04 (in a VM with 8 CPU cores and 8GB RAM)

  • ROS Version: ROS 2 Foxy

  • Simulation: PX4 SITL with Gazebo

What’s Working:

The simulation runs correctly. I can use the Gazebo command-line tool and successfully see the camera topic being published. The command gz topic -l clearly shows the topic, which is /gazebo/default/iris_depth_camera/depth_camera/link/depth_camera/image. This proves the camera data exists inside Gazebo.

The Core Problem:

When I run ros2 topic list, the camera topic does not appear. My ROS 2 nodes cannot see or subscribe to the camera data from Gazebo.

What I Have Tried So Far:

  1. I learned that a “bridge” is needed to translate Gazebo topics to ROS 2 topics. For my Foxy version, this bridge package is called ros_ign_bridge.

  2. I first tried to install it with sudo apt install ros-foxy-ros-gz-bridge, but discovered the package is no longer available in the official repositories, most likely because ROS Foxy is End-of-Life (EOL).

  3. This left me with only one option: building the bridge from source. I cloned the ros_gz repository (the foxy branch) into my workspace.

  4. When I try to compile it using colcon build --packages-select ros_ign_bridge, the process consumes all my system memory and causes my entire VM to freeze. I have to force a reboot. I even tried limiting the process to a single core with colcon build --parallel-workers 1, but it still freezes my machine.

My Question:

Given that apt install is not an option and compiling from source freezes my 8GB RAM machine, what is the recommended way to solve my original problem?

Is there any other, more lightweight method to get this Gazebo camera data into ROS 2 Foxy? Or is there a known workaround for the high memory usage during compilation?

I would be very grateful for any advice. Thank you.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.