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: StepConfigThe step, in its positive direction.
pairs: usizePairs of steps to measure. At least 1.
settle: SettleLevel before each step.
max_saturated_s: f32How 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: usizeClipped steps in a row that fail the stage. At least 1.
max_stalled: usizeStalled steps in a row that fail the stage. At least 1.
Implementations§
Source§impl StepTestPlan
impl StepTestPlan
Sourcepub fn plane(target: PlaneLoop, config: &PlaneStabilizerConfig) -> Self
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
impl StepTestPlan
Sourcepub fn copter(target: TunedLoop) -> Self
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);Sourcepub fn large_copter(target: TunedLoop) -> Self
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);Sourcepub fn validate(&self) -> Result<(), InvalidConfig>
pub fn validate(&self) -> Result<(), InvalidConfig>
Checks the step (StepConfig::validate) and the counts and clip allowance.
Trait Implementations§
Source§impl Clone for StepTestPlan
impl Clone for StepTestPlan
impl Copy for StepTestPlan
Source§impl Debug for StepTestPlan
impl Debug for StepTestPlan
Source§impl PartialEq for StepTestPlan
impl PartialEq for StepTestPlan
impl StructuralPartialEq for StepTestPlan
Auto Trait Implementations§
impl Forget for StepTestPlan
impl Freeze for StepTestPlan
impl Move for StepTestPlan
impl RefUnwindSafe for StepTestPlan
impl Send for StepTestPlan
impl Sync for StepTestPlan
impl Unpin for StepTestPlan
impl UnsafeUnpin for StepTestPlan
impl UnwindSafe for StepTestPlan
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.