Multi-Vehicle Simulation

This page explains how to simulate multiple vehicles using TF-Simulator in PX4 SITL. All vehicle instances have parameters defined by their startup scripts.

Start Multiple Instances

To start multiple instances (on separate ports and IDs):

  1. Checkout the PX4 branch that supports multiple vehicles:

    git clone https://github.com/ThunderFly-aerospace/PX4Firmware.git
    cd PX4Firmware
    git checkout flightgear-multi
    
  2. Build the PX4 Firmware using the standard toolchain (with FlightGear installed).
  3. Start the first instance using the predefined scripts:

    cd ./Tools/flightgear_bridge/scripts
    ./vehicle1.sh
    
  4. Start subsequent instances using another script:

    ./vehicle2.sh
    

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 the way how to run many vehicle instances.