pub enum TunedLoop {
RollRate,
PitchRate,
YawRate,
Roll,
Pitch,
Heading,
}Expand description
A loop of the CopterStabilizer that a tuning stage can replace.
Variants§
RollRate
Roll rate loop: a probe sets the roll rate setpoint, in rad/s.
PitchRate
Pitch rate loop: a probe sets the pitch rate setpoint, in rad/s.
YawRate
Yaw rate loop: a probe sets the yaw rate setpoint, in rad/s.
Roll
Roll angle loop: a probe sets the roll angle setpoint, in rad.
Pitch
Pitch angle loop: a probe sets the pitch angle setpoint, in rad.
Heading
Heading loop: a probe sets the heading setpoint, in rad.
Implementations§
Source§impl TunedLoop
impl TunedLoop
Sourcepub fn gains(self, config: &CopterStabilizerConfig) -> Gains
pub fn gains(self, config: &CopterStabilizerConfig) -> Gains
The gains this loop flies in config.
§Examples
use stable_flight::stabilizers::copter::{CopterStabilizerConfig, TunedLoop};
let mut config = CopterStabilizerConfig::default();
TunedLoop::Heading.gains_mut(&mut config).p = 4.0;
assert_eq!(config.yaw.gains.p, 4.0);
assert_eq!(TunedLoop::Heading.gains(&config).p, 4.0);Sourcepub fn gains_mut(self, config: &mut CopterStabilizerConfig) -> &mut Gains
pub fn gains_mut(self, config: &mut CopterStabilizerConfig) -> &mut Gains
The gains this loop flies in config, to retune them.
Sourcepub fn is_rate(self) -> bool
pub fn is_rate(self) -> bool
Whether this is a rate loop (the others are angle and heading loops).
§Examples
use stable_flight::stabilizers::copter::TunedLoop;
assert!(TunedLoop::YawRate.is_rate());
assert!(!TunedLoop::Heading.is_rate());Sourcepub fn inner(self) -> Option<Self>
pub fn inner(self) -> Option<Self>
The rate loop under this angle or heading loop, which flies its rate setpoint; None
for a rate loop.
§Examples
use stable_flight::stabilizers::copter::TunedLoop;
assert_eq!(TunedLoop::Roll.inner(), Some(TunedLoop::RollRate));
assert_eq!(TunedLoop::RollRate.inner(), None);Sourcepub fn outer(self) -> Option<Self>
pub fn outer(self) -> Option<Self>
The angle or heading loop over this rate loop, which sets its setpoint; None for an
angle or heading loop.
§Examples
use stable_flight::stabilizers::copter::TunedLoop;
assert_eq!(TunedLoop::PitchRate.outer(), Some(TunedLoop::Pitch));
assert_eq!(TunedLoop::Pitch.outer(), None);Trait Implementations§
impl Copy for TunedLoop
impl Eq for TunedLoop
impl StructuralPartialEq for TunedLoop
Source§impl Tunable<TunedLoop> for CopterStabilizer
impl Tunable<TunedLoop> for CopterStabilizer
Source§fn start_probe(&mut self, target: TunedLoop, config: ProbeConfig)
fn start_probe(&mut self, target: TunedLoop, config: ProbeConfig)
Starts a probe on target: from the next stabilize,
a Probe with config sets that loop’s setpoint (see the “Tuning” section on
CopterStabilizer).
§Examples
use stable_flight::stabilizers::copter::{
CopterStabilizer, CopterStabilizerConfig, TunedLoop,
};
use stable_flight::tuning::autotune::COPTER_RATE_STEP;
use stable_flight::tuning::{ProbeConfig, ProbeStatus, Tunable};
use stable_flight::{RateSetpoint, Setpoint, Stabilizer, VehicleState};
let mut stabilizer = CopterStabilizer::new(CopterStabilizerConfig::default());
stabilizer.start_probe(TunedLoop::RollRate, ProbeConfig::Step(COPTER_RATE_STEP));
// At rest with a zero rate setpoint: the step asks for 1 rad/s of roll, so the loop
// pushes right.
let state = VehicleState::default();
let output = stabilizer.stabilize(0.004, &Setpoint::Rate(RateSetpoint::default()), &state);
assert!(output.moments.x > 0.0);
assert!(matches!(stabilizer.probe(), Some((TunedLoop::RollRate, ProbeStatus::Running(_)))));
stabilizer.stop_probe(); // hands the roll rate loop back
assert!(stabilizer.probe().is_none());Source§fn probe(&self) -> Option<(TunedLoop, ProbeStatus)>
fn probe(&self) -> Option<(TunedLoop, ProbeStatus)>
Source§fn stop_probe(&mut self) -> Option<(TunedLoop, ProbeStatus)>
fn stop_probe(&mut self) -> Option<(TunedLoop, ProbeStatus)>
Source§fn probe_frame(&self) -> UnitQuaternion<f32>
fn probe_frame(&self) -> UnitQuaternion<f32>
View’s rotation for loops run in it (nose-up
hover reads level in a tailsitter’s view). The autotune supervisor reads tilt and
per-axis rates in this frame, so its envelope and settle judge the axes the loops fly. Read moreSource§impl Tunable<TunedLoop> for QuadPlaneStabilizer
Hover probes, on the lift rotors: they fly only while the hover side flies alone.
impl Tunable<TunedLoop> for QuadPlaneStabilizer
Hover probes, on the lift rotors: they fly only while the hover side flies alone.
Source§fn start_probe(&mut self, target: TunedLoop, config: ProbeConfig)
fn start_probe(&mut self, target: TunedLoop, config: ProbeConfig)
target with config, from the next tick. A running probe is handed
back first. Read moreSource§fn probe(&self) -> Option<(TunedLoop, ProbeStatus)>
fn probe(&self) -> Option<(TunedLoop, ProbeStatus)>
Source§fn stop_probe(&mut self) -> Option<(TunedLoop, ProbeStatus)>
fn stop_probe(&mut self) -> Option<(TunedLoop, ProbeStatus)>
Source§fn probe_frame(&self) -> UnitQuaternion<f32>
fn probe_frame(&self) -> UnitQuaternion<f32>
View’s rotation for loops run in it (nose-up
hover reads level in a tailsitter’s view). The autotune supervisor reads tilt and
per-axis rates in this frame, so its envelope and settle judge the axes the loops fly. Read moreSource§impl Tunable<TunedLoop> for TailsitterStabilizer
Hover probes, on the hover side in its view: they fly only while the hover side does.
impl Tunable<TunedLoop> for TailsitterStabilizer
Hover probes, on the hover side in its view: they fly only while the hover side does.
Source§fn probe_frame(&self) -> UnitQuaternion<f32>
fn probe_frame(&self) -> UnitQuaternion<f32>
The hover view’s: autotune judges the hover in its view axes.
Source§fn start_probe(&mut self, target: TunedLoop, config: ProbeConfig)
fn start_probe(&mut self, target: TunedLoop, config: ProbeConfig)
target with config, from the next tick. A running probe is handed
back first. Read moreSource§fn probe(&self) -> Option<(TunedLoop, ProbeStatus)>
fn probe(&self) -> Option<(TunedLoop, ProbeStatus)>
Source§fn stop_probe(&mut self) -> Option<(TunedLoop, ProbeStatus)>
fn stop_probe(&mut self) -> Option<(TunedLoop, ProbeStatus)>
Auto Trait Implementations§
impl Forget for TunedLoop
impl Freeze for TunedLoop
impl Move for TunedLoop
impl RefUnwindSafe for TunedLoop
impl Send for TunedLoop
impl Sync for TunedLoop
impl Unpin for TunedLoop
impl UnsafeUnpin for TunedLoop
impl UnwindSafe for TunedLoop
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> Scalar for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.