Skip to main content

PlaneLoop

Enum PlaneLoop 

Source
pub enum PlaneLoop {
    RollRate,
    PitchRate,
    Roll,
    Pitch,
}
Expand description

A loop of the PlaneStabilizer 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.

§

Roll

Roll angle loop: a probe sets the bank setpoint, in rad.

§

Pitch

Pitch angle loop: a probe sets the pitch setpoint, in rad.

Implementations§

Source§

impl PlaneLoop

Source

pub fn axis(self) -> usize

The body axis this loop flies: 0 roll, 1 pitch.

§Examples
use stable_flight::stabilizers::plane::PlaneLoop;

assert_eq!(PlaneLoop::Pitch.axis(), 1);
Source

pub fn is_rate(self) -> bool

Whether this is a rate loop (the others are angle loops).

Source

pub fn inner(self) -> Option<Self>

The rate loop under this angle loop; None for a rate loop.

§Examples
use stable_flight::stabilizers::plane::PlaneLoop;

assert_eq!(PlaneLoop::Roll.inner(), Some(PlaneLoop::RollRate));
assert_eq!(PlaneLoop::RollRate.inner(), None);
Source

pub fn gains(self, config: &PlaneStabilizerConfig) -> PlaneAxisGains

The gains of this loop’s axis in config.

§Examples
use stable_flight::stabilizers::plane::{PlaneLoop, PlaneStabilizerConfig};

let mut config = PlaneStabilizerConfig::default();
let mut gains = PlaneLoop::Pitch.gains(&config);
gains.time_constant_s = 0.6;
PlaneLoop::PitchRate.set_gains(&mut config, gains);
assert_eq!(config.time_constant_s.y, 0.6);
Source

pub fn set_gains( self, config: &mut PlaneStabilizerConfig, gains: PlaneAxisGains, )

Sets the gains of this loop’s axis in config.

Trait Implementations§

Source§

impl Clone for PlaneLoop

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for PlaneLoop

Source§

impl Debug for PlaneLoop

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for PlaneLoop

Source§

impl PartialEq for PlaneLoop

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for PlaneLoop

Source§

impl Tunable<PlaneLoop> for PlaneStabilizer

Source§

fn start_probe(&mut self, target: PlaneLoop, 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 the module docs).

§Examples
use stable_flight::stabilizers::plane::{PlaneLoop, PlaneStabilizer, PlaneStabilizerConfig};
use stable_flight::tuning::{ProbeConfig, ProbeStatus, StepConfig, Tunable};
use stable_flight::{PlaneSetpoint, Setpoint, Stabilizer, VehicleState};

let mut stabilizer = PlaneStabilizer::new(PlaneStabilizerConfig::default());
let step = StepConfig { amplitude: 0.3, duration_s: 1.0, settle_band: 0.1, filter_hz: 0.0 };
stabilizer.start_probe(PlaneLoop::Roll, ProbeConfig::Step(step));

// Level, with a level setpoint: the step asks for 0.3 rad of bank, so the wing rolls right.
let level = Setpoint::Plane(PlaneSetpoint { thrust: 0.6, ..Default::default() });
let output = stabilizer.stabilize(0.004, &level, &VehicleState::default());
assert!(output.moments.x > 0.0);

assert!(matches!(stabilizer.probe(), Some((PlaneLoop::Roll, ProbeStatus::Running(_)))));
stabilizer.stop_probe(); // hands the roll loop back
assert!(Tunable::<PlaneLoop>::probe(&stabilizer).is_none());
Source§

fn probe(&self) -> Option<(PlaneLoop, ProbeStatus)>

The current probe, if any: running, or finished and not yet stopped.
Source§

fn stop_probe(&mut self) -> Option<(PlaneLoop, ProbeStatus)>

Ends the probe, handing the loop back to its controller if the probe still flies it, and returns its last status.
Source§

fn probe_frame(&self) -> UnitQuaternion<f32>

The frame the probed loops fly in, expressed in the body frame: identity for loops that fly the body frame, a 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 more
Source§

impl Tunable<PlaneLoop> for QuadPlaneStabilizer

Plane probes, on the surfaces: they fly only while the plane side flies alone.

Source§

fn start_probe(&mut self, target: PlaneLoop, config: ProbeConfig)

Starts a probe on target with config, from the next tick. A running probe is handed back first. Read more
Source§

fn probe(&self) -> Option<(PlaneLoop, ProbeStatus)>

The current probe, if any: running, or finished and not yet stopped.
Source§

fn stop_probe(&mut self) -> Option<(PlaneLoop, ProbeStatus)>

Ends the probe, handing the loop back to its controller if the probe still flies it, and returns its last status.
Source§

fn probe_frame(&self) -> UnitQuaternion<f32>

The frame the probed loops fly in, expressed in the body frame: identity for loops that fly the body frame, a 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 more
Source§

impl Tunable<PlaneLoop> for TailsitterStabilizer

Plane probes, on the plane side: they fly only while it does, and a transition ramp interrupts them.

Source§

fn start_probe(&mut self, target: PlaneLoop, config: ProbeConfig)

Starts a probe on target with config, from the next tick. A running probe is handed back first. Read more
Source§

fn probe(&self) -> Option<(PlaneLoop, ProbeStatus)>

The current probe, if any: running, or finished and not yet stopped.
Source§

fn stop_probe(&mut self) -> Option<(PlaneLoop, ProbeStatus)>

Ends the probe, handing the loop back to its controller if the probe still flies it, and returns its last status.
Source§

fn probe_frame(&self) -> UnitQuaternion<f32>

The frame the probed loops fly in, expressed in the body frame: identity for loops that fly the body frame, a 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 more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,

Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.