1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
//! PID autotune: measure a loop, turn the measurement into gains, and run it per loop.
//!
//! - [`Probe`]: one loop's excitation and measurement, run inside the tick: a
//! [`StepProbe`] whose [`StepMetrics`] describe the loop's step response, or an
//! [`IdentifyProbe`] that fits its axis's [`RateModel`].
//! - [`design_rate`] and [`design_angle_p`]: gains from a [`RateModel`] by loop shaping.
//! - [`Tunable`]: a stabilizer that hosts a probe on one of its loops
//! ([`CopterStabilizer`](crate::stabilizers::copter::CopterStabilizer)).
//! - [`autotune::Autotune`]: the copter supervisor, run between ticks: executes each stage's
//! procedure (which probes to run, what gains follow), guards the envelope, and commits or
//! reverts gains.
//!
//! Method and rules: `architecture.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);
//! ```
use UnitQuaternion;
pub
pub use ;
pub use ;
pub use ;
pub use ;
/// A stabilizer that hosts autotune stages: one of its loops handed to a [`Probe`] inside the
/// tick, then handed back. [`FlightLoop`](crate::FlightLoop) forwards these between ticks
/// ([`FlightLoop::start_probe`](crate::FlightLoop::start_probe) and friends), so a supervisor
/// never needs `&mut` access to the stabilizer itself.
///
/// Implemented by [`CopterStabilizer`](crate::stabilizers::copter::CopterStabilizer), whose
/// targets are [`TunedLoop`](crate::stabilizers::copter::TunedLoop)s.