Unit 18 · Flight in simulation · 100 min core
Autopilot architecture
Mission: Trace a small roll request through one craft and its signal workbench; explain how old or noisy observations change a correction.
The interactive version of this unit needs JavaScript. Below are its steps as text.
Steps
1. Request a small roll
Select “Show the request”, then compare the diagram and the live SIMULATED readout.
Why it matters: A target describes what is wanted, not what has happened.
2. Observe the craft
Select “Show a reading”, then compare the diagram and the live SIMULATED readout.
Why it matters: A sensor gives an observation. Noise is a deterministic disturbance in this toy.
3. Make an estimate
Select “Show the estimate”, then compare the diagram and the live SIMULATED readout.
Why it matters: An estimator combines observations into a state estimate. This simple average is not an EKF and cannot recover unknown truth.
4. Choose a correction
Select “Show the correction”, then compare the diagram and the live SIMULATED readout.
Why it matters: The command is limited to ±30 deg/s² in this toy. The vehicle response feeds another reading.
5. Retrieve: sampling
Select “Show sample and hold”, then compare the diagram and the live SIMULATED readout.
Why it matters: The interval is 0.1 s in this example. Sample-and-hold applies the last command until the next sample.
6. Age the observation
Select “Show delayed feedback”, then compare the diagram and the live SIMULATED readout.
Why it matters: Delay uses a FIFO of acquired samples. During startup the initial observation is held until enough samples exist.
7. Add sensor noise
Select “Show noisy feedback”, then compare the diagram and the live SIMULATED readout.
Why it matters: Compare the same sampling interval, delay, gains and seed. Averaging can smooth noise while adding lag.
8. Orientation is not position
Select “Show the distinction”, then compare the diagram and the live SIMULATED readout.
Why it matters: Attitude says how the craft is oriented. Position describes where it is; one is not the other.
9. Route the correction
Select “Show allocation”, then compare the diagram and the live SIMULATED readout.
Why it matters: Control allocation maps control requests to configured actuators. The toy draws this boundary but does not model individual motors.
10. Trace nested loops
Select “Show the optional outer loop”, then compare the diagram and the live SIMULATED readout.
Why it matters: Attitude and rate control are nested conceptually, with rate generally faster than outer loops. Flight mode determines which loops are active.
11. Mark your boundary
Select “Show integration”, then compare the diagram and the live SIMULATED readout.
Why it matters: PX4 handles configured estimation, control and allocation. Integration does not replace the engineering of those components.
12. Prepare the diagram
Select “Show the complete path”, then compare the diagram and the live SIMULATED readout.
Why it matters: Draw the data flow and annotate roles and fields. The example is synthetic and no ULog is produced.
Go deeper
Toy equations and limits
The toy observes an angle directly as a teaching stand-in. Real inertial sensors do not provide perfect roll truth: PX4 estimates attitude from configured sensors and estimation algorithms. The browser has no connection to an aircraft.
estimate[k] = 0.5 × estimate[k−1] + 0.5 × reading[k] command = clamp(2 × (target − delayed estimate) − 1.2 × rate, −30, +30) deg/s² age = current time − selected observation acquisition time
The illustrative plant integrates angular acceleration and damping at 0.02 s. Positive roll is right side down, consistent with Unit 17. Rate is deg/s and angle is degrees. The simulated rate is directly available to the toy controller; this is not PX4 EKF, PID, allocation, a flight solver or a basis for hardware tuning. Delay does not always cause instability.
PX4 v1.17.0 message-field mappings (not outputs of this browser toy): vehicle_attitude.q is a unit quaternion in w,x,y,z order, not roll degrees; timestamp_sample is the underlying data acquisition timestamp in microseconds; timestamp is time since system start; vehicle_angular_velocity.xyz is rad/s; vehicle_local_position.x/y/z is metres and validity matters; vehicle_rates_setpoint.roll/pitch/yaw is rad/s; actuator_motors.control is a normalized thrust setpoint (−1 to +1 with reversible/output semantics), not a measured force; it is a command, not measured RPM or thrust. Topic availability and logging depend on configuration; no topic is assumed automatically logged.
Video question: What does an autopilot actually do? Unit 19 owns actual SITL installation.