Expand description
Flight-control core for the Stable Flight controller: the pipeline traits (Commander,
StateSource + Actuator = Vehicle, Guidance, Stabilizer, Mixer,
TelemetryPublisher), the data passed between them, copter guidance, the cascaded-PID
stabilizers, the mixers, and FlightLoop, which sequences one control tick.
This crate is no_std and has no simulator, I/O, or timing dependencies, so the same code
runs in software-in-the-loop simulation
(stable-flight-sitl) and, later, on flight
hardware. See the
architecture overview.
Re-exports§
pub use nalgebra;
Modules§
- commanders
- Hardware-independent
Commanderimplementations. - composition
- Combinators that build one pipeline component out of several.
- controllers
- Flight Control Controllers
- flight_
loop - One control-loop tick, independent of how ticks are scheduled.
- guidance
- Outer-loop
Guidanceimplementations: turn commands into the setpoints aStabilizertracks. - mixers
- Provides functionality to translate generalized control outputs (thrust and moments) into specific actuator commands tailored to the vehicle configuration.
- params
- A flat name →
f32view over the config tree, for live tuning from a ground station. - stabilizers
- Inner-loop control: track a
Setpointfrom guidance against vehicle state feedback. - testing
- Test doubles for the pipeline traits. Enabled by the
testingfeature (and in this crate’s own tests); off by default. - timing
- Fixed-rate scheduling driven by the flight loop’s
dt, for streams (telemetry, heartbeats) that run slower than the loop.
Macros§
- conformance_
tests - Generates a backend’s conformance tests: one
#[test]per listed scenario, plusconformance_covers_every_scenario, which fails if any scenario inSCENARIOShas no test.
Structs§
- Absolute
Attitude Command - An absolute attitude and collective thrust, for
ControlInput::AbsoluteAttitude: what an offboard app (e.g. MAVLinkSET_ATTITUDE_TARGET) asks for, as opposed to the normalized stick positions of anAttitudeCommand. - Actuator
Command - One tick’s actuator outputs: motors and servos, as generic slots.
- Attitude
Command - Represents direct manual control of an aircraft’s attitude (orientation).
- Attitude
Setpoint - Attitude target for the
Stabilizer; seeSetpoint. - Command
- One tick’s command from a
Commander: whether the vehicle should be armed, and what to fly. - Composed
Vehicle - A
Vehiclemade of a separate state source and actuator. - Control
Output - Represents the high-level control outputs from the stabilization system.
- Flight
Loop - Sequences one control tick: commander → estimate → guide → stabilize → mix → actuate → telemetry.
- Land
Command - Where to land, for
ControlInput::Land: guidance holdsposition_mwhile it descends. - Rate
Command - Represents direct manual control of an aircraft’s rotational rates.
- Rate
Setpoint - Body-rate target for the
Stabilizer; seeSetpoint. - Saturation
- Which limits the pipeline hit on one tick, as reported by
Guidance::saturation,Stabilizer::saturation, andMixer::saturation, merged byFlightLoopintoTelemetryRecord::saturation. - Telemetry
Record - One control-loop tick, as handed to a
TelemetryPublisher. - Vehicle
State - Represents the physical state of a vehicle in 3D space.
- Waypoint
Command - Represents a navigational waypoint for autonomous flight.
Enums§
- Control
Input - The control input part of a
Command: what the flight system should fly. - Control
Mode - The kind of a
ControlInput, one variant per input variant: the flight mode, compact enough for a heartbeat. FromControlInput::mode. - Failsafe
State - Which commander a
FailsafeCommanderlet fly: its link-fed primary, or the fallback after the link went stale. - Setpoint
- What the
Stabilizershould hold this tick, as produced by aGuidance.
Constants§
- GRAVITY
- Standard gravity, in m/s².
Traits§
- Actuator
- Component responsible for controlling the vehicle’s actuators.
- Commander
- Represents an entity that produces flight control commands.
- Configurable
- A pipeline component whose gains and limits can be read and replaced between ticks.
- Guidance
- Turns the commander’s
ControlInputinto an inner-loopSetpoint. - Mixer
- Component responsible for converting control outputs to actuator commands.
- Stabilizer
- Component responsible for flight control and stabilization: the inner loop.
- State
Source - Where the flight loop’s vehicle state comes from.
- Telemetry
Publisher - Component responsible for publishing telemetry data from the flight system.
- Vehicle
- Represents a physical vehicle that can be controlled by the flight system.
Functions§
- euler_
angles - ZYX Euler angles
(roll, pitch, yaw)in radians of an attitude quaternion, in the frame contract’s convention (the same asUnitQuaternion::euler_angles). Use this rather than nalgebra’s method to read Euler angles fromVehicleState::attitude. - wrap_
angle - Wraps an angle in radians to [-π, π); non-finite input gives NaN.