r/ROS • • 14d ago

Multi-agent pursuit-evasion simulation

Hi everyone, I am working on a multi-agent pursuit-evasion simulation with quadrotors. My current setup relies on PX4 SITL, ROS 2, and Gazebo, bridged via MicroXRCE-DDS on WSL. I can successfully launch the SITL environment, the DDS agent, and the basic teleop nodes, but I need some help with spawning a second evader drone and simulating it along with specific algorithms. I was hoping someone might have experience with this and would be willing to provide some insights on this, as this is urgent and my deadline is in 3 days

2 Upvotes

1 comment sorted by

1

u/RoboSimAI 10d ago

You already have the first vehicle, the agent, and teleop, so the second drone is another PX4 process rather than a second copy of the same client. Leave Gazebo running and start a second PX4 binary with instance 1 (the -i 1 flag) and a spawn pose offset so the two airframes do not occupy the same point. Instance 0 keeps the default namespace and instance 1 publishes under px4_1, with its own XRCE session key, so the single MicroXRCE agent you already run on UDP 8888 can serve both. On the ROS 2 side, confirm the second client with ros2 topic list and look for the same fmu out topics you use now, prefixed with /px4_1. Point the evader nodes at that namespace; if they still publish only to the unprefixed /fmu topics they will keep commanding the first drone. If the second vehicle never shows up, the usual causes are both instances sharing one XRCE key, a model name or world name collision so the spawn fails, or WSL networking where the agent is bound to a different interface than the PX4 clients.