Skip to main content

PlaneTuneHoldConfig

Struct PlaneTuneHoldConfig 

Source
pub struct PlaneTuneHoldConfig {
    pub thrust: f32,
    pub thrust_per_m: f32,
    pub max_thrust_trim: f32,
    pub thrust_time_constant_s: f32,
    pub trim_airspeed_mps: f32,
    pub pitch_per_mps: f32,
    pub trim_time_constant_s: f32,
    pub max_trim_rad: f32,
    pub return_radius_m: f32,
    pub turn_bank_rad: f32,
    pub recover_to: FlightRegime,
}
Expand description

PlaneTuneHold settings.

Fields§

§thrust: f32

The thrust the hold flies, in [0, 1], before its altitude trim: the airframe’s cruise thrust, or the thrust it flies level on.

§thrust_per_m: f32

How much the thrust trim adds per m below the altitude the hold started at (takes off above it), as a pilot holds height with the throttle. Higher: holds the height tighter, and moves the thrust under a pitch step more. 0 turns it off. Non-negative.

§max_thrust_trim: f32

The farthest the thrust trim moves the thrust from thrust. Non-negative.

§thrust_time_constant_s: f32

How slowly the thrust trim follows the altitude, in s (a first-order time constant).

§trim_airspeed_mps: f32

The airspeed the pitch trim holds, in m/s: the plane stabilizer’s trim airspeed.

§pitch_per_mps: f32

How far the trim pitches the nose per m/s of airspeed off trim, in rad per m/s: down when slow, up when fast. Higher: holds the airspeed tighter, and stirs the phugoid.

§trim_time_constant_s: f32

How slowly the trim follows the airspeed, in s (a first-order time constant): slow enough that a probe’s few seconds don’t see it move.

§max_trim_rad: f32

The farthest the trim pitches the nose from where the hold started, in rad.

§return_radius_m: f32

Beyond this distance from where the hold started, the hold turns back toward it between probes (allow_turn), in m.

§turn_bank_rad: f32

The bank of that turn, in rad.

§recover_to: FlightRegime

What recover flies: a hover where the vehicle is (FlightRegime::Copter, for a VTOL), or wings level (FlightRegime::Plane).

Implementations§

Source§

impl PlaneTuneHoldConfig

Source

pub fn new(thrust: f32, trim_airspeed_mps: f32) -> Self

A hold at thrust, trimming pitch toward trim_airspeed_mps by 1° per m/s over 5 s and within 10° of the start (a pilot’s FBWA trim; the sim’s airplane held its airspeed through a tune this way, and slowed past its minimum within a few steps without it, #533), trimming thrust by 0.01 per m below the start over 10 s and within 0.1 (the Alia 250 sank 0.2 m/s on its thrust alone, past the envelope’s 40 m within 3 minutes, #534), turning back at 20° of bank beyond 600 m, and recovering wings level.

§Examples
use stable_flight::commanders::PlaneTuneHoldConfig;

let config = PlaneTuneHoldConfig::new(0.55, 18.0);
assert!(config.validate().is_ok());
Source

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

Checks that thrust is in [0, 1], its trim’s gain and limit non-negative, the airspeed, gains, time constants, trim limit, and radius positive, and the turn’s bank in (0, 60°].

Trait Implementations§

Source§

impl Clone for PlaneTuneHoldConfig

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 PlaneTuneHoldConfig

Source§

impl Debug for PlaneTuneHoldConfig

Source§

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

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

impl PartialEq for PlaneTuneHoldConfig

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 PlaneTuneHoldConfig

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.