Skip to content

Settings

Settings come from environment variables with the MCARDUPILOT_ prefix, or from a .env file in the working directory. The server and the library read the same ones: a Sitl in a script leases from the same pool and lock directory as the server unless you pass it other Settings.

Environment variableTypeDefaultWhat it does
MCARDUPILOT_ARDUPILOTPath~/ardupilotArduPilot tree; read and run only, never built or edited
MCARDUPILOT_BINARYPath | None<ardupilot>/build/sitl/bin/arduplaneSITL binary; default <ardupilot>/build/sitl/bin/arduplane
MCARDUPILOT_DATA_DIRPath~/.local/share/mcardupilotlease locks, session run directories, kept logs
MCARDUPILOT_INSTANCE_POOLstr (a pool spec)40-59instances this server may lease, "40-59" or "40,41,45-47"
MCARDUPILOT_WAIT_CAP_Sfloat85longest any waiting tool blocks
MCARDUPILOT_SESSION_IDLE_Sfloat1800close a session idle this long
MCARDUPILOT_REAP_INTERVAL_Sfloat30how often idle sessions are checked
MCARDUPILOT_STALL_Sfloat30a session's SITL whose clock stops this long is dead
MCARDUPILOT_LOG_BUDGET_GBfloat20kept dataflash logs prune past this
MCARDUPILOT_BUILD_TREESlist[Path][]trees build_sitl may build, separated by : or , (a patched tree goes here)
MCARDUPILOT_BUILD_PYTHONPath | NoneNonePython with ArduPilot's build packages (empy 3.3.4 and the rest); default ~/venv-ardupilot if it exists, else python3 on PATH outside this server's venv
MCARDUPILOT_BUILD_DEFAULT_TREEboolTruealso build the ardupilot tree while its checkout is clean
MCARDUPILOT_VIDEO_HOSTstr127.0.0.1where live feeds listen; 0.0.0.0 for the LAN
MCARDUPILOT_VIDEO_PORT_BASEint8400a session's live feed is on this plus its instance
MCARDUPILOT_VIDEO_SIZEstr960x540
MCARDUPILOT_VIDEO_FPSfloat30
MCARDUPILOT_VIDEO_ENCODER"auto" | "h264_nvenc" | "libx264"auto
MCARDUPILOT_VIDEO_FGVIEWboolTruelaunch SITL with --enable-fgview, so live feeds get its pose
MCARDUPILOT_TRANSPORT"stdio" | "http"stdiostdio for one client; http serves streamable HTTP for a shared deployment
MCARDUPILOT_HTTP_HOSTstr127.0.0.1address the http transport binds
MCARDUPILOT_HTTP_PORTint8374port the http transport listens on

MCARDUPILOT_INSTANCE_POOL takes a range, a list, or both: "40-59", "40,41,45-47". Instances are leased in the order written. The validator refuses three numbers outright:

Instance Why
0 autotest.py always uses it, and takes no lease
14, 15 their MAVLink ports, 5900 and 5910, sit in the range VNC servers use (5900 and up), which is a common clash on a workstation running remote desktops

It also refuses duplicates and numbers so high that SITL’s ports would pass 65535.

Every server and script sharing a machine should share MCARDUPILOT_DATA_DIR, since that is where the lease locks live. Pools may differ between them: list_instances reads every lock file in the directory, in the pool or not.

Path Holds
leases/instance-<n>.lock the flock lease files, one per instance ever leased
sessions/<n>/ a session’s SITL run directory: parameter files, scripts/, sitl.log, sitl.pid, and the live logs/
logs/ kept dataflash logs, held to MCARDUPILOT_LOG_BUDGET_GB, with <name>.BIN.pin beside any pinned one
run/<n>/ the library’s default run root for a Sitl started outside the server