Skip to main content

StepTestPlan

Struct StepTestPlan 

Source
pub struct StepTestPlan {
    pub step: StepConfig,
    pub pairs: usize,
    pub settle: Settle,
    pub max_saturated_s: f32,
    pub max_invalid: usize,
    pub max_stalled: usize,
}
Expand description

A step test: pairs pairs of steps, alternating +step and −step so a trim or CG offset shows as asymmetry rather than bias, each from a Settle. A step clipped for longer than max_saturated_s (a clipped step measures the limit, not the loop) is invalid and runs again; max_invalid in a row fail the stage. A step flagged stalled (Autotune::note_stall) runs again too, on its own budget: a stall says nothing about the loop, so max_stalled in a row (the host can’t keep time) fail the stage.

Fields§

§step: StepConfig

The step, in its positive direction.

§pairs: usize

Pairs of steps to measure. At least 1.

§settle: Settle

Level before each step.

§max_saturated_s: f32

How long a step may be clipped and still count, in s. Non-negative and finite: a D kick clips the first tick or so of a rate step.

§max_invalid: usize

Clipped steps in a row that fail the stage. At least 1.

§max_stalled: usize

Stalled steps in a row that fail the stage. At least 1.

Implementations§

Source§

impl StepTestPlan

Source

pub fn plane(target: PlaneLoop, config: &PlaneStabilizerConfig) -> Self

The plane defaults for target on a plane flying config: three pairs of PLANE_RATE_STEP (roll and pitch rate), PLANE_ROLL_STEP (roll), or PLANE_PITCH_STEP (pitch), each no larger than config’s bank or pitch limit, from PLANE_STEP_SETTLE, each clipping for up to PLANE_MAX_SATURATED_S, allowing 3 clipped and 10 stalled steps in a row. A step replaces the saturated setpoint, so a step past the limit would fly an attitude the airframe’s limit forbids: the Alia 250’s 20° bank limit holds its roll steps to 20°, and at 30° its roll stage sank past the envelope’s 40 m.

§Examples
use stable_flight::stabilizers::plane::{PlaneLoop, PlaneStabilizerConfig};
use stable_flight::tuning::autotune::{PLANE_PITCH_STEP, StepTestPlan};

let config = PlaneStabilizerConfig { max_bank_rad: 0.2, ..Default::default() };
assert_eq!(StepTestPlan::plane(PlaneLoop::Pitch, &config).step, PLANE_PITCH_STEP);
assert_eq!(StepTestPlan::plane(PlaneLoop::Roll, &config).step.amplitude, 0.2);
Source§

impl StepTestPlan

Source

pub fn copter(target: TunedLoop) -> Self

The copter defaults for target: three pairs of COPTER_RATE_STEP (roll and pitch rate), COPTER_YAW_RATE_TEST_STEP (yaw rate), COPTER_TILT_STEP (roll and pitch), or COPTER_HEADING_STEP (heading), from COPTER_STEP_SETTLE, each clipping for up to COPTER_MAX_SATURATED_S, allowing 3 clipped steps in a row and 10 stalled steps in a row (RealFlight’s proxy has frozen for 100 ms dozens of times a run).

§Examples
use stable_flight::stabilizers::copter::TunedLoop;
use stable_flight::tuning::autotune::{COPTER_TILT_STEP, StepTestPlan};

assert_eq!(StepTestPlan::copter(TunedLoop::Roll).step, COPTER_TILT_STEP);
Source

pub fn large_copter(target: TunedLoop) -> Self

copter for roll or pitch, on a full-size multirotor’s steps (LARGE_COPTER_RATE_STEP or LARGE_COPTER_TILT_STEP), clipping for up to LARGE_COPTER_MAX_SATURATED_S. Yaw rate and heading are copter’s unchanged.

§Examples
use stable_flight::stabilizers::copter::TunedLoop;
use stable_flight::tuning::autotune::{LARGE_COPTER_TILT_STEP, StepTestPlan};

assert_eq!(StepTestPlan::large_copter(TunedLoop::Roll).step, LARGE_COPTER_TILT_STEP);
Source

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

Checks the step (StepConfig::validate) and the counts and clip allowance.

Trait Implementations§

Source§

impl Clone for StepTestPlan

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 StepTestPlan

Source§

impl Debug for StepTestPlan

Source§

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

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

impl PartialEq for StepTestPlan

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 StepTestPlan

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.