Skip to main content

Envelope

Struct Envelope 

Source
pub struct Envelope {
    pub max_tilt_rad: f32,
    pub max_rate_radps: f32,
    pub max_altitude_loss_m: f32,
    pub settle: Settle,
    pub settle_timeout_s: f32,
    pub recovery_s: f32,
    pub max_stale_s: f32,
}
Expand description

Limits that end a stage, and how still the vehicle must be before a probe starts.

Fields§

§max_tilt_rad: f32

Roll or pitch from level beyond this aborts the stage, in rad, in the probed loops’ frame (Tunable::probe_frame): a tailsitter’s view, where nose-up hover is level.

§max_rate_radps: f32

A rate about any of the probed loops’ axes beyond this aborts the stage, in rad/s.

§max_altitude_loss_m: f32

Sinking more than this below the altitude at Autotune::start aborts, in m.

§settle: Settle

Level and still enough to start a probe, unless the stage’s method sets its own (Method::settle).

§settle_timeout_s: f32

How long to wait for a settle, in s. At the timeout a step fails the stage, and an identification starts anyway: a fit only gains excitation from a ringing loop.

§recovery_s: f32

After a probe on candidate gains ends, how long the vehicle has on the committed gains to come back inside the limits before a breach fails the stage, in s. A breach while the candidate flies fails only the candidate. After a freeze (Autotune::note_stall), breaches don’t count for as long. Non-negative.

§max_stale_s: f32

How long the host may go without a fresh vehicle state (Autotune::set_state_stale) before the run fails HostFault, in s: meanwhile the vehicle flies on unseen. Positive.

Implementations§

Source§

impl Envelope

Source

pub fn large_copter() -> Self

Default’s limits, waiting up to 30 s to settle: a full-size multirotor brakes a step’s sideways speed slowly, and the Alia 250’s sim model doesn’t level within the default 10 s (#351).

The wait alone isn’t enough on a slow angle loop (angle P near 1, against 9 on the sim airframes): guidance’s lateral loop must be slowed to match it too, or after a large rate step the position hold and the angle loop swing against each other for longer than the wait. At the Alia’s angle P (1.03), quad_x on core’s lateral loop swung at up to 4 m/s and was still swinging after 30 s; on the Alia’s slower one it settled (#588).

§Examples
use stable_flight::tuning::autotune::Envelope;

assert_eq!(Envelope::large_copter().settle_timeout_s, 30.0);
Source

pub fn validate(&self) -> Result<(), InvalidConfig>

Checks that every limit and time is positive and finite, and that settling (check_settle) is tighter than aborting.

Source

pub fn check_settle(&self, settle: &Settle) -> Result<(), InvalidConfig>

Checks that settle is positive and tighter than the abort limits, that its hold fits in settle_timeout_s, and that its speed is positive and finite.

Trait Implementations§

Source§

impl Clone for Envelope

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 Envelope

Source§

impl Debug for Envelope

Source§

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

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

impl Default for Envelope

Source§

fn default() -> Self

Copter limits: 35° tilt, 4 rad/s, 3 m sink; settle within 6° of the attitude target and 0.3 rad/s for 1 s, waiting up to 10 s; 1 s to recover from a candidate; 2 s without a fresh state. RealFlight’s reconnects come 0.5, 1.5, and 3.5 s into an outage, so the run rides through the first two; a QuadCopterX unseen for 3.5 s mid-step rolled over (#309).

Source§

impl PartialEq for Envelope

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 Envelope

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.