A Docker container for running SITL testing with support for multiple simulation instances & mavp2p mavlink forwarding.
- Run multiple ArduPilot SITL instances with independent configurations
- Select specific ArduPilot releases per instance (e.g.,
Rover-4.6.3,ArduCopter-4.5.0) - Creates timestamped log directories for each session at
/ardupilot/logs/<timestamp> - Integrated mavp2p MAVLINK forwarding
Start a single ArduPilot SITL instance using docker-compose:
docker-compose upThe container will automatically:
- Start ArduPilot SITL and mavp2p and forward all output to the console
- Create a timestamped log directory at
/ardupilot/logs/<timestamp>(e.g.,/ardupilot/logs/20241215_143022)
Configuration is done through environment variables.
These variables control the behavior of the SITL launcher.
ARDUPILOT_NUM_INSTANCES- Number of simulator instances to spawn (default:1)
Prefix with ARDUPILOT_:
ARDUPILOT_RELEASE- ArduPilot release tag to use (e.g.,Rover-4.6.3).ARDUPILOT_VEHICLE- ArduPilot vehicle type (default:Rover)ARDUPILOT_LAT- Starting latitude (default:42.3898)ARDUPILOT_LON- Starting longitude (default:-71.1476)ARDUPILOT_ALT- Starting altitude (default:0)ARDUPILOT_DIR- Starting heading (default:0)ARDUPILOT_MODEL- Frame/model type (default:+)ARDUPILOT_SPEEDUP- Simulation speedup factor (default:1)ARDUPILOT_SITL_MAVLINK_OUTPUT_ADDRESS- MAVLink output address (default:udp:127.0.0.1:14550for instance 0)ARDUPILOT_MAVP2P_OUTPUT- mavp2p output address (default:udp:127.0.0.1:14560for instance 0)
Prefix with ARDUPILOT_INSTANCE_<X>_ where <X> is the instance ID (0, 1, 2, etc.):
ARDUPILOT_INSTANCE_<X>_RELEASE- ArduPilot release tag for this specific instanceARDUPILOT_INSTANCE_<X>_VEHICLE- Vehicle type for this instanceARDUPILOT_INSTANCE_<X>_LAT- Starting latitude for this instanceARDUPILOT_INSTANCE_<X>_LON- Starting longitude for this instanceARDUPILOT_INSTANCE_<X>_ALT- Starting altitude for this instanceARDUPILOT_INSTANCE_<X>_DIR- Starting heading for this instanceARDUPILOT_INSTANCE_<X>_MODEL- Frame/model type for this instanceARDUPILOT_INSTANCE_<X>_SPEEDUP- Simulation speedup for this instanceARDUPILOT_INSTANCE_<X>_SITL_MAVLINK_OUTPUT_ADDRESS- MAVLink output address for this instanceARDUPILOT_INSTANCE_<X>_MAVP2P_OUTPUT- mavp2p output address for this instance
Instance-specific variables override global variables for that instance. If not specified, instances use defaults based on their instance ID (e.g., port numbers increment: instance 0 uses port 14550, instance 1 uses 14551, etc.).
To run multiple simulator instances, set ARDUPILOT_NUM_INSTANCES:
environment:
ARDUPILOT_NUM_INSTANCES: 3Each instance will:
- Use incrementing port numbers (instance 0: 14550, instance 1: 14551, etc.)
- Have its own log output prefixed with
[SITL <id>] - Can be configured independently using instance-specific environment variables
Example with different configurations per instance:
environment:
ARDUPILOT_NUM_INSTANCES: 2
ARDUPILOT_VEHICLE: ArduCopter
ARDUPILOT_INSTANCE_0_VEHICLE: ArduCopter
ARDUPILOT_INSTANCE_0_LAT: 42.3898
ARDUPILOT_INSTANCE_0_LON: -71.1476
ARDUPILOT_INSTANCE_1_VEHICLE: Rover
ARDUPILOT_INSTANCE_1_LAT: 42.3900
ARDUPILOT_INSTANCE_1_LON: -71.1478To use a specific ArduPilot release, set the ARDUPILOT_RELEASE environment variable:
environment:
ARDUPILOT_RELEASE: Rover-4.6.3This will use /ardupilot/builds/Rover-4.6.3/Tools/autotest/sim_vehicle.py.
You can also specify different releases per instance:
environment:
ARDUPILOT_NUM_INSTANCES: 2
ARDUPILOT_RELEASE: Rover-4.6.3
ARDUPILOT_INSTANCE_0_RELEASE: Rover-4.6.3
ARDUPILOT_INSTANCE_1_RELEASE: ArduCopter-4.5.0The SITL Manager automatically creates a timestamped log directory at /ardupilot/logs/<timestamp> (format: YYYYMMDD_HHMMSS) when it starts. All programs (ArduPilot SITL and mavp2p) run with this directory as their working directory, so any files they create (logs, data files, etc.) will be saved there.
mavp2p is automatically started for each instance to allow multiple MAVLink connections. By default:
- Input: Connects to the SITL MAVLink output
- Output:
udp:127.0.0.1:14560(for instance 0, incrementing for additional instances)
You can customize the mavp2p output using ARDUPILOT_MAVP2P_OUTPUT or ARDUPILOT_INSTANCE_<X>_MAVP2P_OUTPUT.
TODO