Skip to content

Snapshot fields

A snapshot is one look at a session, built from the latest MAVLink message of each type the pump thread has received. snapshot returns one on demand. wait_until, arm, set_mode, disarm, set_speedup, set_wind and every step result carry one too.

The session asks SITL for these streams on top of the defaults: HEARTBEAT at 4 Hz, ATTITUDE, VFR_HUD and SERVO_OUTPUT_RAW at 10 Hz, SYS_STATUS, BATTERY_STATUS, MISSION_CURRENT and EXTENDED_SYS_STATE at 2 Hz, and SITL’s own truth (SIMSTATE, SIM_STATE) with SYSTEM_TIME at 20 Hz. A field whose message has not arrived yet is null.

FieldTypeMeaning
session_idstr
statestrstarting, open, died or closed
seqintmessages received so far; pass as since_seq to wait_until
t_sim_sfloatautopilot time since boot, s
speedupfloatthe speed SITL is running at now
viewersintpeople watching the live video feed; while any do, the session runs no faster than real time (idle pacing still applies)
instanceint | None
armedbool
modestr | None
mode_since_sfloat | Nonesim time the autopilot's reported mode last changed to this one
height_mfloatabove the pad since arm, else above home
latfloat | None
lonfloat | None
roll_degfloat | None
pitch_degfloat | None
yaw_degfloat | None
airspeed_mpsfloat | None
groundspeed_mpsfloat | None
climb_mpsfloat | None
throttle_pctfloat | None
voltsfloat | None
ampsfloat | None
mahfloat | Noneconsumed charge since the last battery reset
landedbool | Nonefrom EXTENDED_SYS_STATE; None until it arrives, and None after a disarm until a report newer than the disarm says (it comes at 2 Hz of sim time)
mission_seqint | Nonecurrent mission item (MISSION_CURRENT)
rclist[int]RC override this server sends, channels 1 to 8; empty when it sends none (an exact session, whose program's sticks are applied inside SITL)
servolist[int] | NoneSERVO_OUTPUT_RAW channels 1 to 8
textslist[Text]latest STATUSTEXTs, oldest first
winddict | Nonethe session's wind: mean, gusts, the gust now and what SITL got
errorstr | Nonewhy the session died, if it did

seq counts every message the session has received. It only grows, which is what makes it useful as since_seq.

height_m comes from SITL’s true position (SIM_STATE), measured from the pad, once the session has armed; before the first arm it is the autopilot’s own height above home. rc is what this server sends as RC override, not what the autopilot’s mixer chose; servo is the autopilot’s output.

landed is ArduPilot’s own landed state from EXTENDED_SYS_STATE. After a VTOL landing, ArduPlane can disarm while its last report still says in the air: its flying estimate decays over about three seconds, and the next report comes up to half a sim second later. Idle pacing holds the sim at 0.05 between calls, which stretches that half second to ten seconds of wall time. So for a disarmed vehicle whose latest report predates the disarm and says in the air, landed is null (not known yet) rather than false. wait_until with landed runs the sim at full speed and ends once the next report says so.

wind, when the session has one, holds the mean wind, the gust settings, profile (uniform or sitl, how the wind changes with height), gust_mps (the gust now, along, across and up) and sitl (the SIM_WIND_SPD, SIM_WIND_DIR and SIM_WIND_DIR_Z SITL was last given).

A snapshot from a hover on the stock quadplane, with texts=1. volts reads 0 because the stock parameters configure no battery monitor.

{
"session_id": "d79353", "state": "open", "seq": 8767, "t_sim_s": 67.961, "speedup": 0.05,
"instance": 40, "armed": true, "mode": "QLOITER", "mode_since_s": 10.264,
"height_m": 7.37, "lat": -35.3632629, "lon": 149.1652371,
"roll_deg": 0.11, "pitch_deg": -0.19, "yaw_deg": 355.45,
"airspeed_mps": 0.92, "groundspeed_mps": 0.022, "climb_mps": -0.008, "throttle_pct": 59.0,
"volts": 0.0, "amps": null, "mah": null, "landed": false, "mission_seq": 0,
"rc": [1500, 1500, 1500, 1500, 1800, 1500, 1500, 1500],
"servo": [1500, 1500, 1000, 1500, 1750, 1750, 1750, 1750],
"texts": [ { "seq": 6329, "t_sim_s": 49.563, "text": "Throttle armed" } ],
"wind": null, "error": null
}

One autopilot STATUSTEXT, with the seq it arrived at. The session keeps the latest 200.

FieldTypeMeaning
seqint
t_sim_sfloat
textstr
repeatedintearlier identical texts folded into this one (pre-arm retries)