Trouble with ROS 2 offboard control for multi-vehicle simulation

Hello everyone,

I’m currently working on a multi-vehicle simulation (drones + rovers) using Gazebo Garden, Ubuntu 22.04, and ROS 2 Humble. My goal is to control multiple vehicles (at least 5 of each) in offboard mode.

I’m starting with a two-vehicle setup to test the basics, but I’ve run into a communication issue. Here is my current launch process:

  1. Start the Micro XRCE-DDS Agent:

    MicroXRCEAgent udp4 -p 8888
    
    
  2. Run a simple ROS 2 listener node.

  3. Launch QGroundControl.

  4. Launch the first vehicle using the standard make command:

    make px4_sitl gz_x500
    
  5. launch the second vehicle with a unique instance ID

    PX4_SYS_AUTOSTART=4001 PX4_SIM_MODEL=gz_x500 ./build/px4_sitl_default/bin/px4 -i 1
    

After these steps, when I check ros2 topic list, I can see topics for both the default vehicle (/fmu/*) and the namespaced vehicle (/px4_1/fmu/*).

The Problem

I can successfully send offboard commands to the first vehicle launched with the make command. Whether I publish directly to the /fmu/in/offboard_control_mode topic or use the example ros2 run px4_ros_com offboard_control, it works perfectly.

However, the second vehicle (px4_1) does not respond to any ROS 2 commands. I’ve tried targeting its specific topics, but there seems to be no connection.

I also attempted the method described in the official PX4 documentation for multi-vehicle simulation, which involves setting namespaces in three separate terminals (px4_1, px4_2, etc.). When I follow that guide, I lose all ROS 2 communication with the vehicles entirely.

I have searched through the forums for similar issues but haven’t found a definitive solution that works for this Gazebo Garden and ROS 2 Humble environment.

Could someone please provide some guidance or point me to a working example? I am looking for the correct procedure to establish ROS 2 topic communication with two or more vehicles so they can be independently controlled in offboard mode.

Thank you in advance for your help!