Issues with Multi-UAV Simulation on Gazebo Harmonic

I am currently trying to simulate multiple quadcopters in Gazebo Harmonic and control them using a custom Python script with pymavlink. I am using the ardupilot_gazebo models as a base.

I’ve been following a few older posts, most of which use Gazebo 8. From what I understand, I need to modify the drone model’s configuration and model files by giving each drone a unique name and defining the fdm_port_in as 9002, 90012, 90022, etc. Additionally, I need to create a custom world file that includes my drone models.

I successfully spawned the drones in Gazebo, but now, when I run my SITL, I get a “link down” error indicating that my SITL isn’t interfacing with Gazebo Harmonic. I didn’t encounter this issue when I spawned only one drone. I hope someone can help me debug this issue, as most of the documentation I’ve found seems outdated.

Hello @samnt178, the link is down because the simulation pauses until each drone has a corresponding SITL instance running. In addition to defining a separate port for each vehicle in the Gazebo plugin, each vehicle must have a separate instance of the arducopter binary running (with the appropriate instance number incremented).

I tried running all three SITL instances simultaneously as @rhys recommended.
i’m following this pdf btw
https://discuss.ardupilot.org/uploads/default/original/2X/d/d7083377f747deab79798e7a9cef58d433ff5f66.pdf
Instead of using
./sim_vehicle.py -v ArduCopter -f gazebo-iris --console -I <instance no.>
i added the --model JSON argument when using sim_vehicle.py
./sim_vehicle.py -v ArduCopter -f gazebo-iris --console --model JSON -I <instance no.>
After I leave the simulation for awhile, i get link 1 OK statuses but after a few seconds the status turns back to no link.

Update
Got everything working now, just had to reinstall ardupilot_gazebo… Thank you so much @rhys for the help

1 Like

hey,did you fix this problem. currently i am working on same thing and stuck at same point.can you help me out here1