pub struct ManeuverRunner { /* private fields */ }Expand description
Flies a Maneuver: its segments in order from the attitude it starts at, then a recovery
to level (RecoveryConfig), then nothing, so the caller (a script, a route) flies on.
The caller decides where it starts: level, at the speed and height the maneuver needs.
§Examples
use stable_flight::commanders::maneuver::{Maneuver, ManeuverPhase, ManeuverRunner};
use stable_flight::{ControlInput, VehicleState};
let mut runner = ManeuverRunner::default();
let level = VehicleState::default();
runner.start(Maneuver::roll(1.5).expect("a nonzero rate"), &level);
let Some(ControlInput::AbsoluteRate(rates)) = runner.next(0.004, &level) else {
unreachable!("a roll begins with a roll rate");
};
assert_eq!(rates.roll_radps, 1.5);
assert_eq!(runner.phase(), ManeuverPhase::Rotation { segment: 0 });Implementations§
Source§impl ManeuverRunner
impl ManeuverRunner
Sourcepub fn new(config: ManeuverConfig) -> Self
pub fn new(config: ManeuverConfig) -> Self
Sourcepub fn config(&self) -> &ManeuverConfig
pub fn config(&self) -> &ManeuverConfig
The settings.
Sourcepub fn start(&mut self, maneuver: Maneuver, state: &VehicleState)
pub fn start(&mut self, maneuver: Maneuver, state: &VehicleState)
Starts maneuver at state, replacing any in progress.
Sourcepub fn abort(&mut self)
pub fn abort(&mut self)
Cuts a maneuver’s segments short and recovers; a recovery or a finished maneuver is left alone.
Sourcepub fn phase(&self) -> ManeuverPhase
pub fn phase(&self) -> ManeuverPhase
Where the runner is.
Sourcepub fn next(&mut self, dt: f32, state: &VehicleState) -> Option<ControlInput>
pub fn next(&mut self, dt: f32, state: &VehicleState) -> Option<ControlInput>
This tick’s command: a segment’s body rate or the recovery’s level attitude, or None
once done (or idle). A segment that ends this tick hands over to the next phase in the
same tick.
§Panics
If dt is not positive and finite.
Trait Implementations§
Source§impl Clone for ManeuverRunner
impl Clone for ManeuverRunner
Source§impl Debug for ManeuverRunner
impl Debug for ManeuverRunner
Source§impl Default for ManeuverRunner
impl Default for ManeuverRunner
Source§fn default() -> Self
fn default() -> Self
A runner with ManeuverConfig::default.
Auto Trait Implementations§
impl Forget for ManeuverRunner
impl Freeze for ManeuverRunner
impl Move for ManeuverRunner
impl RefUnwindSafe for ManeuverRunner
impl Send for ManeuverRunner
impl Sync for ManeuverRunner
impl Unpin for ManeuverRunner
impl UnsafeUnpin for ManeuverRunner
impl UnwindSafe for ManeuverRunner
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
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
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
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.