#[non_exhaustive]pub enum Setpoint {
Attitude(AttitudeSetpoint),
Rate(RateSetpoint),
BodyRate(BodyRateSetpoint),
Plane(PlaneSetpoint),
PlaneRate(BodyRateSetpoint),
Blend(BlendSetpoint),
}Expand description
What the Stabilizer should hold this tick, as produced by a Guidance.
A ControlInput says what the operator or mission wants (stick positions, a waypoint);
a Setpoint is the inner-loop target derived from it. Attitude targets are physical
angles in radians; rates and thrust are normalized. The stabilizer owns the physical
limits (maximum tilt and rates) and the thrust curve, and saturates out-of-range or NaN
inputs per the input policy.
#[non_exhaustive]: new setpoint kinds (e.g. fixed-wing) can be added without a breaking
change. A Stabilizer that can’t fly a variant must fall back to neutral, not panic (see
Stabilizer::stabilize).
§Examples
use stable_flight::{AttitudeSetpoint, Setpoint};
// Level, north-facing hover at half linear thrust.
let hover = Setpoint::Attitude(AttitudeSetpoint { thrust: 0.5, ..Default::default() });Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Attitude(AttitudeSetpoint)
Hold a roll/pitch attitude and an absolute heading.
Rate(RateSetpoint)
Hold body rates, as fractions of the stabilizer’s maximum.
BodyRate(BodyRateSetpoint)
Hold absolute body rates (rad/s): a copter stabilizer’s acro and maneuvers.
Plane(PlaneSetpoint)
Fly a wing-borne roll/pitch attitude, turns coordinated (no heading): a plane stabilizer’s.
PlaneRate(BodyRateSetpoint)
Hold absolute body rates (rad/s) on the wing, at any attitude: a plane stabilizer’s acro and maneuvers (rolls, loops).
Blend(BlendSetpoint)
Fly a hover and a wing-borne attitude at once, the lift rotors carrying
lift_share of theirs: a lift+cruise VTOL’s transitions.
Implementations§
Source§impl Setpoint
impl Setpoint
Sourcepub fn idle(&self) -> bool
pub fn idle(&self) -> bool
Whether guidance marked this setpoint ground idle (see
AttitudeSetpoint::idle); a plane attitude never is, a blend when its hover is.
§Examples
use stable_flight::{PlaneSetpoint, RateSetpoint, Setpoint};
assert!(Setpoint::Rate(RateSetpoint { idle: true, ..Default::default() }).idle());
assert!(!Setpoint::Plane(PlaneSetpoint::default()).idle());Sourcepub fn with_thrust(self, thrust: f32) -> Self
pub fn with_thrust(self, thrust: f32) -> Self
Trait Implementations§
impl Copy for Setpoint
Source§impl<'de> Deserialize<'de> for Setpoint
impl<'de> Deserialize<'de> for Setpoint
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl StructuralPartialEq for Setpoint
Auto Trait Implementations§
impl Freeze for Setpoint
impl RefUnwindSafe for Setpoint
impl Send for Setpoint
impl Sync for Setpoint
impl Unpin for Setpoint
impl UnsafeUnpin for Setpoint
impl UnwindSafe for Setpoint
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> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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.