This topic explains how to simulate multiple vehicles using FlightGear in SITL. All vehicle instances have parameters defined by their startup scripts.
:::note This is the most environmentally realistic way to simulate multiple vehicles running PX4, and allows easy testing of multiple different types of vehicles. It is suitable for testing multi-vehicle support in QGroundControl, MAVSDK, etc.
Multi-Vehicle Simulation with Gazebo Classic should be used instead for: swarm simulations with many vehicles, and testing features like computer vision that are only supported by Gazebo Classic. :::
How to Start Multiple Instances
To start multiple instances (on separate ports and IDs):
Each instance should have its own startup script, which can represent a completely different vehicle type. For prepared scripts you should get the following view.
Multi-vehicle simulation using PX4 SITL and FlightGear
Ground stations such as QGroundControl connect to all instances using the normal UDP port 14550 (all traffic goes to the same port).
The number of simultaneously running instances is limited mainly by computer resources. FlightGear is a single-thread application, but aerodynamics solvers consume a lot of memory. Therefore splitting to multiple computers and using a multiplayer server is probably required to run many vehicle instances.
Additional Resources
See Simulation for more information about the port configuration.