pub struct ConstantCommander { /* private fields */ }Expand description
A commander that emits the same command every tick. The default is a disarmed, zero-throttle attitude command.
§Examples
use stable_flight::testing::ConstantCommander;
use stable_flight::{AttitudeCommand, Command, Commander, ControlInput, VehicleState};
let hover = Command::armed(ControlInput::Attitude(AttitudeCommand {
throttle: 0.5,
..Default::default()
}));
let mut commander = ConstantCommander::new(hover);
let command = commander.next_command(0.004, &VehicleState::default());
assert!(command.arm);
assert!(matches!(
command.input,
ControlInput::Attitude(AttitudeCommand { throttle: 0.5, .. })
));Implementations§
Trait Implementations§
Source§impl Clone for ConstantCommander
impl Clone for ConstantCommander
Source§impl Commander for ConstantCommander
impl Commander for ConstantCommander
Source§fn next_command(&mut self, _dt: f32, _current_state: &VehicleState) -> Command
fn next_command(&mut self, _dt: f32, _current_state: &VehicleState) -> Command
Produces the next command to be executed by the flight control system. Read more
Source§fn failsafe(&self) -> Option<FailsafeState>
fn failsafe(&self) -> Option<FailsafeState>
Which commander a failsafe let fly on the last
next_command
call, for a commander that has one
(FailsafeCommander). FlightLoop puts it in
the tick’s TelemetryRecord::failsafe. The default reports none, so a commander that
wraps another must forward this to report the inner one’s.impl Copy for ConstantCommander
Source§impl Debug for ConstantCommander
impl Debug for ConstantCommander
Auto Trait Implementations§
impl Forget for ConstantCommander
impl Freeze for ConstantCommander
impl Move for ConstantCommander
impl RefUnwindSafe for ConstantCommander
impl Send for ConstantCommander
impl Sync for ConstantCommander
impl Unpin for ConstantCommander
impl UnsafeUnpin for ConstantCommander
impl UnwindSafe for ConstantCommander
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.