Skip to main content

Module tuning

Module tuning 

Source
Expand description

PID autotune: measure a loop, turn the measurement into gains, and run it per loop.

Method and rules: docs/architecture/autotune.md#autotune.

§Examples

use stable_flight::tuning::autotune::COPTER_RATE_STEP;
use stable_flight::tuning::{LoopSignals, Probe, ProbeConfig};

// A 1 rad/s step on a rate loop at rest: the loop runs on the stepped setpoint.
let mut probe = Probe::new(ProbeConfig::Step(COPTER_RATE_STEP));
let setpoint = probe.step(0.004, &LoopSignals::default());
assert_eq!(setpoint, COPTER_RATE_STEP.amplitude);

Re-exports§

pub use design::DesignError;
pub use design::LoopShapingConfig;
pub use design::design_angle_p;
pub use design::design_rate;
pub use identify::IdentifyAbort;
pub use identify::IdentifyConfig;
pub use identify::IdentifyExtension;
pub use identify::IdentifyProbe;
pub use identify::IdentifyStatus;
pub use identify::MAX_DELAY_TICKS;
pub use identify::RateModel;
pub use probe::LoopSignals;
pub use probe::Measurement;
pub use probe::Probe;
pub use probe::ProbeAbort;
pub use probe::ProbeConfig;
pub use probe::ProbeStatus;
pub use probe::Progress;
pub use step::Stat;
pub use step::StepAbort;
pub use step::StepConfig;
pub use step::StepMetrics;
pub use step::StepProbe;
pub use step::StepStatus;
pub use step::StepSummary;
pub use wing::design::WingDesign;
pub use wing::design::WingDesignConfig;
pub use wing::design::WingDesignStatus;
pub use wing::WingIdentifyProbe;
pub use wing::WingModel;
pub use wing::WingStatus;

Modules§

autotune
The autotune supervisor (Supervisor), generic over the loops it tunes (Side); a copter’s is Autotune.
design
Gains from an identified RateModel by loop shaping: see design_rate and design_angle_p.
identify
Closed-loop identification of a rate axis: see IdentifyProbe.
probe
What an autotune stage runs inside the tick: see Probe.
step
Step-response measurement of a loop: see StepProbe.
wing
Closed-loop identification of a wing’s roll or pitch axis: see WingIdentifyProbe.

Traits§

Tunable
A stabilizer that hosts autotune stages: one of its loops handed to a Probe inside the tick, then handed back. FlightLoop forwards these between ticks (FlightLoop::start_probe and friends), so a supervisor never needs &mut access to the stabilizer itself.