How to Distinguish Depth Camera Topics for Multiple Drones in Gazebo Harmonic?

Hello everyone,

I’m currently working on a Gazebo simulation project where I’m running multiple drones, each equipped with a depth camera. In the simulation, all the drones’ cameras are publishing to the same topics, such as /depth_camera and /camera_info. This makes it impossible for me to differentiate between the data from each drone when subscribing to these topics in ROS 2.

Problem:

When multiple drones are running simultaneously in a Gazebo environment, all of their depth cameras publish to the same default topics:

  • /depth_camera (depth image)
  • /camera_info (camera information)

Since all the drones share these topic names, I’m unable to distinguish which data belongs to which drone when processing the information in ROS 2. This creates confusion, especially in multi-drone scenarios where each drone’s data should be handled separately.

Proposed Solution:

I suggest that each drone’s camera topics should include the model name as a prefix, making it easier to identify data from different drones. For example, each drone could have unique topic namespaces like:

  • /x500_depth_0/depth_camera
  • /x500_depth_0/camera_info
  • /x500_depth_1/depth_camera
  • /x500_depth_1/camera_info

This way, each drone would have its own set of clearly distinguishable topics, preventing any overlap.

My startup commands:
python3 simulation-gazebo --world walls
PX4_GZ_STANDALONE=1 PX4_SYS_AUTOSTART=4001 PX4_SIM_MODEL=gz_x500_depth PX4_GZ_WORLD=walls ./build/px4_sitl_default/bin/px4
PX4_GZ_STANDALONE=1 PX4_SYS_AUTOSTART=4001 PX4_SIM_MODEL=gz_x500_depth PX4_GZ_WORLD=walls ./build/px4_sitl_default/bin/px4 -i 1

you can find the solution PX4 docs on Multi-Vehicle Sim in gazebo simulation section.

if you are running multi-agent you will need to set up an unique instance for each drone, try to set up two different instance

PX4_GZ_STANDALONE=1 PX4_SYS_AUTOSTART=4001 PX4_SIM_MODEL=gz_x500_depth 
PX4_GZ_WORLD=walls ./build/px4_sitl_default/bin/px4 -i 1

PX4_GZ_STANDALONE=1 PX4_SYS_AUTOSTART=4001 PX4_SIM_MODEL=gz_x500_depth 
PX4_GZ_WORLD=walls ./build/px4_sitl_default/bin/px4 -i 2