pub struct ControlOutput {
pub thrust: f32,
pub moments: Vec3,
pub cruise: Option<CruiseOutput>,
}Expand description
Represents the high-level control outputs from the stabilization system.
This struct encapsulates the desired thrust and moments to be applied to the
vehicle, which are later translated to specific actuator commands by a Mixer.
Most vehicles fly one set of actuators per output: thrust and moments reach every
motor and servo the mixer drives. A lift+cruise VTOL (quadplane) flies two at once, its
lift rotors on thrust and moments and its pusher and control surfaces on
cruise.
§Examples
Creating a control output for a simple hover command:
use stable_flight::{ControlOutput, Vec3};
let output = ControlOutput::new(
0.5, // 50% thrust
Vec3::zeros() // No roll, pitch, or yaw moments
);A quadplane in cruise: lift rotors stopped, the pusher and surfaces flying.
use stable_flight::{ControlOutput, CruiseOutput, Vec3};
let output = ControlOutput {
cruise: Some(CruiseOutput { thrust: 0.6, moments: Vec3::new(0.1, 0.0, 0.0) }),
..Default::default()
};Fields§
§thrust: f32Normalized thrust value, typically ranging from 0.0 (no thrust) to 1.0 (maximum thrust). On a lift+cruise VTOL, the lift rotors’ collective.
moments: Vec3Control moments in roll (x), pitch (y), and yaw (z) axes. Values are typically normalized between -1.0 and 1.0, where the magnitude represents the proportion of maximum control authority in each axis. On a lift+cruise VTOL, the lift rotors’ moments only.
cruise: Option<CruiseOutput>A lift+cruise VTOL’s cruise actuators, flown alongside the lift rotors: the pusher’s
thrust and the control surfaces’ moments. None for every other vehicle, whose servos
take moments.
Implementations§
Source§impl ControlOutput
impl ControlOutput
Sourcepub fn new(thrust: f32, moments: Vec3) -> ControlOutput
pub fn new(thrust: f32, moments: Vec3) -> ControlOutput
Creates a new ControlOutput with the specified thrust and control moments, and no
cruise output.
§Parameters
thrust: Normalized thrust value, typically between 0.0 and 1.0.moments: Control moments as a 3D vector (roll, pitch, yaw).
§Returns
A new ControlOutput instance with the specified parameters.
Trait Implementations§
Source§impl Clone for ControlOutput
impl Clone for ControlOutput
impl Copy for ControlOutput
Source§impl Debug for ControlOutput
impl Debug for ControlOutput
Source§impl Default for ControlOutput
impl Default for ControlOutput
Source§impl<'de> Deserialize<'de> for ControlOutput
impl<'de> Deserialize<'de> for ControlOutput
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>,
Source§impl PartialEq for ControlOutput
impl PartialEq for ControlOutput
Source§impl Serialize for ControlOutput
impl Serialize for ControlOutput
impl StructuralPartialEq for ControlOutput
Auto Trait Implementations§
impl Forget for ControlOutput
impl Freeze for ControlOutput
impl Move for ControlOutput
impl RefUnwindSafe for ControlOutput
impl Send for ControlOutput
impl Sync for ControlOutput
impl Unpin for ControlOutput
impl UnsafeUnpin for ControlOutput
impl UnwindSafe for ControlOutput
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.