pub struct ActuatorCommand {
pub motors: [f32; 8],
pub servos: [f32; 8],
}Expand description
One tick’s actuator outputs: motors and servos, as generic slots.
The Mixer decides what each slot does
(QuadCopterMixer’s motor 0 is front-left; a
tricopter’s servo 0 might be its tail tilt); the backend’s mapping decides which output
channel each slot drives. Slots a mixer doesn’t use stay at their default.
The default (all zeros: motors off, servos centered) is what FlightLoop actuates while
disarmed.
§Examples
A quadcopter uses the first four motors:
use stable_flight::ActuatorCommand;
let mut cmd = ActuatorCommand::default();
cmd.motors[..4].copy_from_slice(&[0.5; 4]); // Four motors at 50% powerA tricopter adds a tail servo for yaw:
use stable_flight::ActuatorCommand;
let mut cmd = ActuatorCommand::default();
cmd.motors[..3].copy_from_slice(&[0.5; 3]);
cmd.servos[0] = 0.2; // Tail tilted for a slight yawFields§
§motors: [f32; 8]Motor outputs, from 0.0 (off) to 1.0 (full power). The mixer sets which physical motor each index is.
servos: [f32; 8]Servo outputs, from -1.0 to 1.0, with 0.0 centered. The mixer sets what each index moves (a control surface, a tilt servo).
Trait Implementations§
Source§impl Clone for ActuatorCommand
impl Clone for ActuatorCommand
impl Copy for ActuatorCommand
Source§impl Debug for ActuatorCommand
impl Debug for ActuatorCommand
Source§impl Default for ActuatorCommand
impl Default for ActuatorCommand
Source§impl<'de> Deserialize<'de> for ActuatorCommand
impl<'de> Deserialize<'de> for ActuatorCommand
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for ActuatorCommand
impl PartialEq for ActuatorCommand
Source§impl Serialize for ActuatorCommand
impl Serialize for ActuatorCommand
impl StructuralPartialEq for ActuatorCommand
Auto Trait Implementations§
impl Freeze for ActuatorCommand
impl RefUnwindSafe for ActuatorCommand
impl Send for ActuatorCommand
impl Sync for ActuatorCommand
impl Unpin for ActuatorCommand
impl UnsafeUnpin for ActuatorCommand
impl UnwindSafe for ActuatorCommand
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,
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>
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.