Skip to content

Library modules

The MCP tools are a thin layer over a library you can import on its own. Everything below is in the mcardupilot package. Nothing in it knows an airframe: frames, parameters, Lua scripts and scoring belong to the caller.

Module What it holds
mcardupilot.sitl Sitl, one SITL instance and the MAVLink link to it: lease, run directory, launch in its own process group, connect, wait for home, pump, wait, wait_text, set, get, height, truth, arm_on_pad, disarm, fresh_pack, close. The tick(kind, msg) hook and the Bridge protocol for an external physics process. kill_instance(instance, run_root) for a SITL a SIGKILLed script left behind. Constants DEFAULT_RC, CMAC (the default home), NO_OVERRIDE
mcardupilot.mission Item, nav, do, upload (retries while ArduPilot ignores mission traffic after boot), download, box_mission, to_latlon, to_ne. Items are in metres from home
mcardupilot.frames frame_defaults(binary, frame): a frame’s default parameter files, read from the tree’s own vehicleinfo.json as sim_vehicle.py reads them
mcardupilot.provenance binary_provenance(binary): the binary, its build time, the tree’s short SHA, the hash of any uncommitted patch, and patched files newer than the build
Module What it holds
mcardupilot.leases LeasePool(lock_dir, pool) with acquire(owner, instance=None, check=None), release, the lease(...) context manager, status() and lock_instances(). python -m mcardupilot.leases status prints the holders
mcardupilot.procs launch_group, kill_group (SIGKILL to the group, by recorded start ticks), alive, start_ticks, port_free, busy_ports, port_holder, wait_ports_free, pid files
mcardupilot.config Settings, plus mavlink_port(n) (5760 + 10n), json_port(n) (9002 + 10n), parse_pool, format_pool, RESERVED_INSTANCES
mcardupilot.errors McardupilotError and its subclasses SitlDied, LeasePoolExhausted, InstanceBusy, ArmRefused. Messages are written for the caller to act on
Module What it holds
mcardupilot.logs Keep policies (never, last, all), collect, latest_bin, pin, unpin, is_pinned, prune (dry run unless apply=True), enforce_budget. python -m mcardupilot.logs prune --root DIR [--budget-gb N] [--apply]
mcardupilot.logread summary(path), fields(path, msg, names, ...), messages(path, types, ...), open_log, read: what log_summary, log_fields and log_messages return
mcardupilot.logcompare compare(a, b, params=True) as log_compare returns it, plus align (phase alignment by longest common subsequence), param_diff and text_diff
Module What it holds
mcardupilot.turbulence Dryden(seed=None, method="exact") with step(t, mean_wind, h_m, airspeed), scales(h_m, mean_wind) (the MIL-F-8785C sigmas and lengths), and sitl_wind(speed, from_deg, gust, up) (mean wind plus gust as SITL’s three SIM_WIND_* values)
mcardupilot.wind WindSpec, parse, and Wind, a session’s wind advanced on sim time
Module What it holds
mcardupilot.server build_server(settings=None) and main(), the mcardupilot script
mcardupilot.sessions SessionManager and Session: one Sitl and its pump thread, waiters, idle pacing, reconcile at start, the idle reaper
mcardupilot.steps step program validation and execution inside the pump
mcardupilot.models the pydantic result and argument models on these pages
mcardupilot.tools one module per tool group, each with register(mcp)