This topic explains how to simulate multiple UAV (multicopter) vehicles using JMAVSim and SITL. All vehicle instances are started at the same position in the simulation.
This is the easiest way to simulate multiple vehicles running PX4. It is suitable for testing multi-vehicle support in QGroundControl (or the Dronecode SDK, etc.). Multi-Vehicle Simulation with Gazebo should be used for swarm simulations with many vehicles, or for testing features like computer vision that are only supported by Gazebo.
JMAVSim multi-vehicle simulation works on PX4 v1.8.0 and later.
To start multiple instances (on separate ports):
- Build PX4
- Run sitl_multiple_run.sh, specifying the number of instances to start (e.g. 2):
- Start the first instance:
- Start subsequent instances, specifying the simulation TCP port for the instance:
The port should be set to
./Tools/jmavsim_run.sh -p 4561
QGroundControl and developer APIs (e.g. Dronecode SDK) connect to all instances using the normal/default ports (14550 and 14540, respectively).
- See Simulation for more information about the port configuration.