Skip to content

Tools

The server exposes 29 tools. This page is generated from the server itself: names, parameters, defaults, descriptions and result types are read from the tool definitions, so they match the code that ships. The descriptions are written for the calling agent, and they are the source of truth for behaviour.

Tools marked read-only change nothing. Destructive ones stop a SITL. A failure the caller can act on (a busy instance, an unknown mode, a refused request) comes back as a tool error whose message says what to do; an arm the autopilot refuses comes back as a normal result with armed: false and the autopilot’s own reason.

Every tool that waits returns within wait_cap_s, about 85 s. A long flight is a loop of bounded waits, each passing since_seq back in.

A session is one SITL and the link to it. open_sitl returns the session_id the rest take.

open_sitl

Start a SITL on a leased instance and keep a MAVLink link to it. Returns once home is set, with the session id every other session tool takes. This server's thread then keeps the link alive (GCS heartbeat, RC overrides) between calls. Throttle starts low (RC3 1000). Channel 5 starts at 1800, which is a flight-mode switch position on many parameter sets (FLTMODE_CH 5), so a vehicle may boot in whatever mode that maps to: pass rc={5: <pwm>} to choose, and arm(mode=...) switches before arming either way. The six FLTMODE1 to FLTMODE6 positions are PWM below 1231, 1231 to 1360, 1361 to 1490, 1491 to 1620, 1621 to 1749, and 1750 up; pick a value inside a band (1425 is position 3).

At speedup N, every second you spend between calls passes N sim seconds with the last RC held. idle_speedup=0.05 runs the sim nearly still whenever no call is in flight, which makes your pace irrelevant to the flight. Close it with close_sitl; idle sessions close themselves after session_idle_s.

ParameterTypeDefaultMeaning
modelstr"quadplane"SITL frame, e.g. "quadplane" or "plane", or "<frame>:<path to a model .json>" for a frame that reads a model file
paramslist[str][]parameter files, loaded in order (absolute or ~ paths)
setdict[str, float]{}parameters to set at boot, loaded after the files
lualist[str][]Lua scripts to load (paths)
speedupfloat10simulation speed against real time, 1 to 50
rcdict[int, int]{}RC override at boot, channel (1 to 8) to PWM, on top of the default 1500, 1500, 1000, 1500, 1800, 1500, 1500, 1500
idle_speedupfloat | NoneNonerun SITL at this speed whenever no tool call is in flight (e.g. 0.05), and at speedup while one is, so your thinking time does not move the sim; recommended for flights you pace by hand
windWindModel | NoneNonewind and gusts from the start, as set_wind takes them
binarystr | NoneNonefly another SITL binary (another build, to compare against); default the server's
treestr | NoneNonefly the binary built in this ArduPilot tree (<tree>/build/sitl/bin/<the server's binary name>)
instanceint | NoneNonea pool instance; omit to lease the first free one
keep_logs"never" | "last" | "all""last"dataflash logs to keep at close: never, last or all
labelstr | NoneNonea name for the session and its log
default_paramsbool | NoneNoneprepend the frame's default parameter files from the ArduPilot tree (what sim_vehicle.py loads) and turn on SITL's simulated battery (BATT_MONITOR 4) unless set says otherwise; default: only when params is empty

Returns OpenResult

snapshotread-only

The session's state now: armed, mode, height, attitude, speeds, battery, RC sent, servo outputs, mission item, recent autopilot texts, and seq for wait_until.

ParameterTypeDefaultMeaning
session_idstrrequiredfrom open_sitl
textsint10latest STATUSTEXTs to include

Returns Snapshot

get_paramread-only

Read parameters back from the autopilot.

ParameterTypeDefaultMeaning
session_idstrrequiredfrom open_sitl
nameslist[str]required

Returns dict[str, float]

set_param

Set parameters and return the values the autopilot reports back.

ParameterTypeDefaultMeaning
session_idstrrequiredfrom open_sitl
paramsdict[str, float]required

Returns dict[str, float]

set_mode

Switch flight mode (QLOITER, QHOVER, QLAND, QRTL, AUTO, FBWA, RTL, ...) and confirm it from the autopilot's HEARTBEAT within 5 sim seconds.

ParameterTypeDefaultMeaning
session_idstrrequiredfrom open_sitl
modestrrequired

Returns Snapshot

arm

Throttle low, switch mode, arm, retrying every 3 sim seconds while pre-arm checks settle. On refusal returns armed false with the autopilot's last PreArm text. Heights are measured from where it armed.

ParameterTypeDefaultMeaning
session_idstrrequiredfrom open_sitl
modestr | NoneNonemode to arm in; default the current one
timeout_sfloat60sim seconds to keep trying

Returns ArmResult

disarm

Force a disarm, in the air too.

ParameterTypeDefaultMeaning
session_idstrrequiredfrom open_sitl
reset_batteryboolTruefit a fresh pack and zero consumed mAh (and clear injected wind and engine faults), so the next arm is not refused

Returns Snapshot

set_speedup

Change how fast the session's SITL runs, live. Slow it down to think or to watch a manoeuvre closely, speed it up for cruise legs. wait_until's then_speedup does the same the instant a condition is met.

ParameterTypeDefaultMeaning
session_idstrrequiredfrom open_sitl
speedupfloatrequiredsimulation speed against real time, 0.05 to 50; SITL cannot pause, but 0.05 is nearly still

Returns Snapshot

rc_override

Set the RC override this server sends with every pump.

ParameterTypeDefaultMeaning
session_idstrrequiredfrom open_sitl
channelsdict[int, int]{}channel (1 to 8) to PWM (800 to 2200), e.g. {3: 1700} for throttle; held until changed
enabledbool | NoneNonefalse stops sending overrides altogether
script_channelslist[int] | NoneNonechannels a Lua script drives: 65535 goes out there so the override does not overwrite the script

Returns dict

upload_mission

Upload a mission in metres from home. Home goes in as item 0, so items[i] is mission item i + 1. Retries while ArduPilot ignores mission traffic after boot.

ParameterTypeDefaultMeaning
session_idstrrequiredfrom open_sitl
itemslist[MissionItem]required

Returns dict

wait_untilread-only

Wait until a condition holds, its timeout of sim time passes, or SITL dies. Always returns a snapshot and a reason: met, timeout, died, cap, or closed if the session was closed meanwhile. One call blocks at most about 85 s of wall time (reason cap): loop with since_seq for longer flights.

At speedup N every second you spend between calls is N sim seconds with the old RC still held, so "wait, then react" overshoots. then_rc, then_mode and then_speedup react in the same tick the condition is met, applied by the server: wait_until altitude >= 5 with then_rc {3: 1500} stops a climb at 5 m. For timing, use sim_time with a target read off snapshot.t_sim_s ("hover until t = 230"), not time, which counts from this call. When the wait settles inside the server (met, timeout, died) the snapshot is taken in that same tick: a measurement at that moment.

ParameterTypeDefaultMeaning
session_idstrrequiredfrom open_sitl
condition"altitude" | "airspeed" | "mode" | "armed" | "disarmed" | "text" | "waypoint" | "time" | "sim_time" | "landed"requiredaltitude (height_m), airspeed, waypoint (mission item), time (sim seconds to let pass, counted from this call), sim_time (until the autopilot clock reads value, as in snapshot.t_sim_s), mode, text (a STATUSTEXT containing value), armed, disarmed, landed
valuefloat | str | NoneNonethe number, mode name or text to wait for
op">=" | "<=" | "=="">="comparison for numeric conditions
timeout_sfloat60sim seconds before reason timeout
since_seqint | NoneNoneseq of the last snapshot you saw: a text that arrived after it counts even if it came before this call
then_rcdict[int, int] | NoneNoneRC override to apply the instant the condition is met, e.g. {3: 1500} to stop a QLOITER climb at the target height
then_modestr | NoneNonemode to switch to the instant the condition is met
relativeboolFalsesim_time only: value is seconds after the tick the previous wait on this session settled (hover 15 s after the climb ended)
then_speedupfloat | NoneNoneSIM_SPEEDUP to set the instant the condition is met; 0.05 holds the moment nearly still while you decide what to do next

Returns WaitResult

close_sitldestructive

Kill the session's SITL, free its instance, and move the kept dataflash logs out to the server's log directory. A session that died is removed the same way; its logs were already handled by its own keep_logs when it died, so keep_logs here applies only to a live session.

ParameterTypeDefaultMeaning
session_idstrrequiredfrom open_sitl
keep_logs"never" | "last" | "all" | NoneNoneoverride the session's keep_logs

Returns CloseResult

list_sessionsread-only

This server's sessions, open or died (a died session stays until close_sitl).

Returns list[SessionInfo]

A step program runs a manoeuvre inside the server, applying each step’s actions in the tick it starts. The step fields are on Step, wind and mission fields.

fly_steps

Fly a sequence of steps inside the server, with no round trip between them. A step applies its actions (rc, mode, speedup, params) in the tick it starts, then waits until its condition holds (the same conditions as wait_until) or timeout_s sim seconds pass; the next step starts in that same tick. A step without until ends as soon as its actions apply.

Every step is checked (mode names, channels, PWM, values, speedup range) before anything runs, and one bad step rejects the program. Arm with the arm tool first; a program cannot arm or upload a mission. One program per session at a time.

Returns within about 85 s: status done, failed or aborted with every step's result (reason, start and end sim time, a snapshot taken in its settling tick), or status running with the steps settled so far and the current index, followed with steps_status. On an idle-paced session a running program keeps the sim at full speed, waited on or not, and idle applies once it ends.

Hover hop, after arm(mode="QLOITER"): [{rc: {3: 2000}, until: "altitude", value: 5}, {rc: {3: 1500}, until: "sim_time", value: 15, relative: true}, {mode: "QLAND", until: "disarmed", timeout_s: 120}].

ParameterTypeDefaultMeaning
session_idstrrequiredfrom open_sitl
stepslist[StepModel]requiredthe steps, run in order with no delay between them

Returns StepsResult

steps_statusread-only

The session's latest step program: its status, the current step, and the results so far. Follow a program longer than one fly_steps call with this.

ParameterTypeDefaultMeaning
session_idstrrequiredfrom open_sitl
waitboolTruewait up to about 85 s for the program to end; false answers at once

Returns StepsResult

abort_steps

Stop the running step program after the current tick. RC stays as last set, so set the throttle (rc_override) or a mode next. A finished program is returned unchanged.

ParameterTypeDefaultMeaning
session_idstrrequiredfrom open_sitl

Returns StepsResult

Mean wind and gusts, applied on sim time. The fields are on Step, wind and mission fields.

set_wind

Set the session's wind: a mean speed and direction, an optional updraft, and gusts. Dryden gusts are computed by the server every 0.05 sim s from the current height and airspeed and sent to SITL as SIM_WIND_*, so they evolve through every wait. {speed_mps: 0} stops the wind. A step program's wind action does the same mid-program.

ParameterTypeDefaultMeaning
session_idstrrequiredfrom open_sitl
windWindModelrequiredA mean wind and its gusts, applied by the server on sim time.

Returns Snapshot

wind_historyread-only

The gusts the session flew: rows of sim time, the gust along the mean wind (u), across it (v) and up (w), and the SIM_WIND_* values SITL was given.

ParameterTypeDefaultMeaning
session_idstrrequiredfrom open_sitl
secondsfloat30how far back, up to 120 sim s
step_sfloat0.5one row per this many sim seconds

Returns dict

Compile a SITL binary with waf as a background job, and follow it. Which trees may be built, and the Python waf runs under, are in Build a SITL binary.

build_sitl

Build a SITL binary with ArduPilot's waf, as a background job: ./waf configure --board sitl when needed, then ./waf plane (or another vehicle). Waits up to about 85 s and returns the job's state; a longer build keeps going, so follow it with build_status. A first build takes minutes, an incremental one about half a minute. Only trees named in MCARDUPILOT_BUILD_TREES are built, plus the default tree while its git checkout is clean, so a patched tree other runs depend on is never rebuilt by accident. On success the result carries the binary's path and provenance (tree SHA, patch hash, build time).

Container mode (give image and commit) builds explicit inputs instead: a fresh checkout of commit from tree (submodules from the tree's own, offline), patches applied in order, built in the image with no network. The output goes to <data_dir>/builds/<build_id>/ in tree layout with manifest.json; open_sitl's tree argument flies it. build_id is a hash of the inputs, so the same inputs answer from the finished build at once (cached: true).

ParameterTypeDefaultMeaning
treestr | NoneNoneArduPilot tree; default the server's ardupilot tree
vehicle"plane" | "copter" | "heli" | "rover" | "sub" | "antennatracker" | "blimp""plane"waf target
boardstr"sitl"waf board
configurebool | NoneNonerun ./waf configure first; default only when the tree is not configured for this board
configure_argslist[str] | NoneNoneextra configure flags, e.g. ["--debug"] or ["--no-submodule-update"]; given, configure runs
imagestr | NoneNonecontainer mode: the build image by digest, name@sha256:...; tree is then the source repository, only read
commitstr | NoneNonecontainer mode: the commit to build (a SHA)
patcheslist[str] | NoneNonecontainer mode: patch files applied in order after the checkout
reproduceboolFalsecontainer mode: build a second time from a fresh checkout and record whether the binary came out byte for byte the same

Returns dict

build_statusread-only

A build's state: queued, staging, configuring, building, verifying, done, failed or cancelled, with waf's step count, and on failure the last log lines.

ParameterTypeDefaultMeaning
build_idstrrequiredfrom build_sitl
waitboolTruewait up to about 85 s for it to finish
tailint0last log lines to include

Returns dict

cancel_builddestructive

Stop a running build (its whole process group). The tree is left as waf left it; the next build carries on from there.

ParameterTypeDefaultMeaning
build_idstrrequiredfrom build_sitl

Returns dict

list_buildsread-only

This server's builds, newest last.

Returns list[dict]

A log is named by a session id (its live log, while the session is open), a kept log’s name from list_logs, or a path to a .BIN. Over the HTTP transport, only paths under the server’s data directory are read.

list_logsread-only

Dataflash logs this server keeps (close_sitl moves them here), newest first, and the live log of each open session.

ParameterTypeDefaultMeaning
limitint50newest first

Returns list[dict]

log_summaryread-only

A flight by phase: each span between flight-mode changes (and, in AUTO, mission items) with its duration and averages of airspeed, groundspeed, throttle, lift motors, pitch, peak roll, angle of attack, current and voltage, and peak height; plus the firmware, every autopilot text with its time, and message counts. Times are seconds since boot, as in the log.

ParameterTypeDefaultMeaning
logstrrequireda session id (its current log), a kept log's name from list_logs, or a path to a .BIN

Returns dict

log_fieldsread-only

A time series from the log: rows of [t_s, *fields] with each column's unit. An unknown message or column is answered with the ones the log does have.

ParameterTypeDefaultMeaning
logstrrequireda session id (its current log), a kept log's name from list_logs, or a path to a .BIN
msgstrrequiredmessage type, e.g. ATT, ARSP, BAT, CTUN, XKF1
fieldslist[str]requiredcolumns to return, e.g. [Roll, Pitch]
t0float | NoneNonefrom, seconds since boot
t1float | NoneNoneto, seconds since boot
stepfloat | NoneNoneone row per this many seconds
instanceint | NoneNonesensor or core instance, for types that have one
max_rowsint2000at most 5000; the step widens to fit

Returns dict

log_messagesread-only

Whole log messages of the given types in time order, every field included; "more" says the limit cut the list short.

ParameterTypeDefaultMeaning
logstrrequireda session id (its current log), a kept log's name from list_logs, or a path to a .BIN
typeslist[str]requirede.g. [MSG, MODE, ERR, EV, CMD]
t0float | NoneNonefrom, seconds since boot
t1float | NoneNoneto, seconds since boot
limitint200at most 1000

Returns dict

log_compareread-only

Flight B against flight A, for an A/B test (the same flight with a parameter or model file changed). Every number is {a, b, delta, pct}: delta is b - a, pct is delta as a percent of |a|, null when a is 0 or missing.

phases: each flight's log_summary phases are keyed by (mode, armed, mission_item) and matched in order, by longest common subsequence: a phase only one flight has is listed under only_in_a or only_in_b with its index, and every later pair still lines up. matched holds each pair's indexes, times and metrics (duration_s, energy_wh, airspeed, throttle, lift, current, peak height and the rest). totals: whole-log duration, energy in Wh (BAT volts times amps, integrated), peak height and peak current. params: changed {name: {a, b}}, only_in_a and only_in_b {name: value}, and how many are the same; often the whole point of the comparison, so check it first. Values ArduPilot rewrites itself every flight (STAT_*, *_GND_PRESS) are kept apart under bookkeeping. texts: autopilot messages one flight printed and the other did not, ignoring times, the firmware banner and the build hash line; messages that differ only in their numbers ("Reached waypoint #2 dist 91m" against 77m) are grouped under numbers_differ by a template with {n} for each number. same_firmware compares the banners, which carry the build's git hash.

ParameterTypeDefaultMeaning
astrrequireda session id (its current log), a kept log's name from list_logs, or a path to a .BIN
bstrrequireda session id (its current log), a kept log's name from list_logs, or a path to a .BIN
paramsboolTruealso diff the parameters (PARM, last value per name)

Returns dict

pin_log

Spare a kept log from pruning, or let pruning take it again. Kept logs past log_budget_gb (server_info) are deleted oldest first whenever a close keeps one.

ParameterTypeDefaultMeaning
logstrrequireda kept log's name from list_logs, or a path inside logs_dir
pinnedboolTrueFalse unpins

Returns dict

Leases for SITLs you launch yourself, and the view of who holds what.

lease_instance

Reserve a SITL instance for something you launch yourself (a script, sim_vehicle.py -I <n>). The instance's lock is held by this server until release_instance or the server exits, and other sessions and scripts skip it. open_sitl leases its own instance; sessions do not need this.

ParameterTypeDefaultMeaning
ownerstrrequiredwho holds it, shown to every other caller
instanceint | NoneNonea pool instance to ask for; omit for the first free

Returns dict

release_instance

Give back an instance taken with lease_instance. Sessions release theirs at close_sitl.

ParameterTypeDefaultMeaning
instanceintrequired

Returns dict

kill_instancedestructive

Stop whatever SITL runs on an instance. This server's own session there is closed (its logs kept per its keep_logs). A SITL that no lease covers (a stray from a crashed script, autotest.py, make fly) is killed if the process on its ports is a SITL binary. An instance leased by someone else is refused, with the holder named: only its holder may stop it.

ParameterTypeDefaultMeaning
instanceintrequired
forceboolFalsealso act outside the pool or on a reserved instance (0 is autotest.py's); scripts that take no leases may be using those

Returns dict

list_instancesread-only

Every instance that is leased (by any process, in or out of the pool) or has its ports taken without a lease, with the holder, this server's session on it, and the process on each taken port.

ParameterTypeDefaultMeaning
all_poolboolFalselist free pool instances too, not only busy ones

Returns list[InstanceInfo]

server_inforead-only

Server version, the ArduPilot tree and SITL binary (with its build time), the instance pool and who holds each leased instance, and the server's limits.

Returns ServerInfo

The result types the tools above return that have no page of their own. Snapshot is on Snapshot fields, WaitResult on Wait conditions and reasons, and the step results on Step, wind and mission fields.

FieldTypeMeaning
session_idstr
instanceint
mavlink_portintMAVLink TCP; this server owns the link
pidint
run_dirstr
defaultslist[str]parameter files SITL loaded, in order
lua_loadedlist[str]
provenancedictbinary, its build time, tree SHA and patch hash
snapshotSnapshot
FieldTypeMeaning
armedbool
refusedstr | Nonethe autopilot's last PreArm or Arm text
snapshotSnapshot
FieldTypeMeaning
session_idstr
instanceint | None
keptlist[str]dataflash logs kept, at their new paths
prunedlist[str]older kept logs deleted to stay under log_budget_gb (pin_log spares one)
statestr
FieldTypeMeaning
session_idstr
labelstr | None
statestr
instanceint | None
pidint | None
run_dirstr | None
speedupfloat
idle_speedupfloat | None
keep_logsstr
opened_atstr
idle_sfloat
FieldTypeMeaning
instanceint
in_poolbool
mavlink_portint
holderstr | Nonelease holder, any process
session_idstr | Nonethis server's session on the instance
leased_hereboolheld through lease_instance by this server
busy_portslist[str]ports taken, with the process holding each
FieldTypeMeaning
versionstr
ardupilotstrArduPilot tree the SITL binary comes from
binarystrSITL binary sessions launch
binary_existsbool
binary_mtimestr | NoneUTC build time of the binary; a change mid-flight means a rebuild
instance_poolstrinstances this server leases; instance n uses MAVLink TCP 5760 + 10n and SITL's JSON backend 9002 + 10n
leases_helddict[str, str]instance -> holder for every held instance, from any process, including leases taken outside the pool
leases_dirstr
sessions_openint
reconciledlist[str]SITLs a dead server left, killed at start
data_dirstr
transportstr
wait_cap_sfloatlongest any waiting tool blocks before returning
session_idle_sfloat
log_budget_gbfloatkept logs past this are pruned, oldest first
logs_used_gbfloatsize of the kept logs now