> ## Documentation Index
> Fetch the complete documentation index at: https://docs.altnautica.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Aircraft setup

> The agent-run setup and tuning wizards: the ground and air steps for ArduCopter, ArduPlane, VTOL and PX4, the parameter snapshot and revert, and the fc-setup routes.

Aircraft setup takes a flight controller from fresh firmware to a tuned aircraft that [ADOS Pilot](https://docs.altnautica.com/drone-agent/pilot.md) can fly. The drone's agent runs it, not the ground station: the setup engine lives in the pilot daemon, talks to the flight controller over MAVLink, and keeps its state on the drone. Any surface can show it; Mission Control renders it on **Settings › Aircraft setup** and on the drone's **Setup** tab.

## Two wizards

| Wizard | Where | What it does |
| - | - | - |
| `ground` | On the bench, props off | Detection, calibrations, radio, outputs, battery, a starting tune, and the parameter profile ADOS Pilot needs. |
| `air` | In flight, flown by the pilot | Preconditions, a first hover or first flight, in-flight filter and trim measurement, autotune and a verification flight. The operator can take over at any time. |

Each step can also be run again on its own later. State is kept per flight controller (by its `AUTOPILOT_VERSION` uid) under `/var/ados/fc-setup`, and every parameter is snapshotted before the first step that changes one, so you can revert.

### Steps by firmware

| Firmware | `ground` | `air` |
| - | - | - |
| ArduCopter | `detect`, `frame`, `accel`, `level`, `compass`, `radio`, `rc_ados_switch`, `outputs`, `battery`, `initial_params`, `notch_static`, `ados_profile`, `ados_intro` | `preflight`, `first_hover`, `notch_air`, `autotune`, `verify` |
| ArduPlane | `detect`, `frame`, `accel`, `level`, `compass`, `airspeed`, `radio`, `rc_ados_switch`, `outputs`, `battery`, `initial_params`, `ados_profile`, `ados_intro` | `preflight`, `first_flight`, `trim_air`, `airspeed_cal`, `tecs_measure`, `autotune`, `verify` |
| ArduPlane VTOL | The ArduPlane list plus `notch_static` | `preflight`, `first_hover`, `notch_air`, `trim_air`, `airspeed_cal`, `tecs_measure`, `autotune`, `verify` |
| PX4 | `detect`, `frame`, `accel`, `level`, `gyro`, `compass`, `radio`, `outputs`, `battery`, `ados_profile`, `ados_intro` | `preflight`, `first_hover`, `autotune`, `verify` |

### What the steps do

| Step | Purpose |
| - | - |
| `detect` | Reads firmware, version, vehicle class and the full parameter table. |
| `frame` | Frame class and type (copter, VTOL), wing outputs (plane) or airframe (PX4), plus the prop, motor and battery facts later steps use. |
| `accel` | Six-position accelerometer calibration. |
| `level`, `gyro`, `airspeed` | One-command calibrations. |
| `compass` | Onboard magnetometer calibration. |
| `radio` | Captures RC minimum, maximum and trim. |
| `rc_ados_switch` | Assigns one flight-mode switch position to GUIDED, labelled ADOS. |
| `outputs` | Motor order and spin direction, control-surface directions. Motors spin one at a time behind a "Propellers are removed" hold-confirm. |
| `battery` | Monitor type, capacity, cell count and the voltage multiplier corrected against a multimeter reading. |
| `initial_params` | The starting tune from prop size and cell count. |
| `notch_static`, `notch_air` | The harmonic notch filter, from ESC telemetry on the ground or from the hover throttle in flight. |
| `ados_profile` | The flight controller parameters ADOS Pilot depends on, including the battery failsafe actions. |
| `ados_intro` | "Meet ADOS Pilot": the operator chooses the control mode and declares whether an RC transmitter flies with the vehicle. |
| `preflight` | The air wizard's preconditions: a completed ground wizard, every pilot readiness item green, the operator's open-area confirmation and a battery at 80 % or more. |
| `first_hover` | Take off to 3 m, hover 45 s, land, measuring vibration, hover throttle, tracking error and rate oscillation. A VTOL also transitions to forward flight and back. |
| `first_flight`, `trim_air`, `airspeed_cal`, `tecs_measure` | The fixed-wing air steps, each from and back to a GUIDED loiter over the tuning box. |
| `autotune` | The flight controller's own autotune, with the pilot as the RC proxy. |
| `verify` | Flies the tuned aircraft and compares it with the first flight. |

An air step aborts below 30 % battery or above 8 m/s wind. Moving the sticks past 30 % deflection takes over a step that does not blend operator input; the pilot then holds.

> [!WARNING]
>
> The `outputs` step spins motors and the air wizard flies the aircraft. Remove the propellers for ground steps that ask for it, and fly the air wizard in an open area. Read [Safety](https://docs.altnautica.com/operations/safety.md) first.

## Routes

The routes take the pairing key like every other write. MCP tokens cannot reach them, because setup spins motors and flies the aircraft.

| Method | Path | Effect |
| - | - | - |
| GET | `/api/v1/fc-setup` | The wizards, their steps and the setup report. |
| POST | `/api/v1/fc-setup/{wizard}/start` | Start `ground` or `air`. |
| POST | `/api/v1/fc-setup/{wizard}/resume` | Continue a wizard an agent restart interrupted, at its first unfinished step. |
| POST | `/api/v1/fc-setup/{wizard}/abort` | Abort the running wizard. |
| POST | `/api/v1/fc-setup/{wizard}/steps/{step}/run` | Run one step on its own. |
| POST | `/api/v1/fc-setup/{wizard}/steps/{step}/actions/{action}` | Answer a step (`{"args": {...}}`), for example "Next" in a calibration. |
| POST | `/api/v1/fc-setup/revert` | Restore the parameter snapshot (`{"snapshot": ...}` optional). |
| WS | `/api/v1/fc-setup/stream` | Step and wizard frames while a wizard runs. |

A refusal returns `{"ok": false, "err": "<code>"}`. `bad_args`, `bad_wizard`, `unknown_step`, `unknown_action`, `unsupported` and `unsupported_frame` are `422`; `no_snapshot` is `404`; `setup_unavailable` and an unreachable pilot are `503`; every other refusal is `409`.

The stream needs a ticket for scope `fc.setup` from `POST /api/_ws/ticket`. While a wizard runs it sends `{"kind": "step" | "wizard", "ts_ms", "data"}` at 5 Hz, otherwise `{"kind": "keepalive", "ts_ms"}` once a second.

## In Mission Control

Open **Settings › Aircraft setup**, pick a drone with a reachable agent, and the page shows a tab per wizard with the connected flight controller. Each wizard opens on an overview (progress, component cards and one primary button: **Start**, **Continue** or **Run again**) with a guided one-step-at-a-time flow behind it. The parameter-snapshot revert and the setup report follow.

`/config/aircraft-setup?drone=<id>&step=<id>` opens a drone's setup at a given step, which is where an alert's "Open setup" link lands. The same view is on the drone's **Setup** tab as **Aircraft setup**.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.