pub struct RateCommand {
pub throttle: f32,
pub roll_rate: f32,
pub pitch_rate: f32,
pub yaw_rate: f32,
}Expand description
Represents direct manual control of an aircraft’s rotational rates.
This struct encapsulates pilot inputs from control devices like joysticks,
yokes, or keyboard/mouse combinations to control the aircraft’s rate of rotation
(roll rate, pitch rate, yaw rate) and throttle. It is typically used within a
ControlInput::Rate variant to issue manual flight commands to the flight system.
The “rate” refers to the speed of rotation around each axis, typically measured
in a normalized range where -1.0 and 1.0 represent the maximum rates supported
by the flight system (e.g., radians per second, scaled to system limits).
§Value Ranges
throttle:0.0(idle) to1.0(full power)roll_rate:-1.0(maximum left roll rate) to1.0(maximum right roll rate)pitch_rate:-1.0(maximum nose-down rate) to1.0(maximum nose-up rate)yaw_rate:-1.0(maximum left yaw rate) to1.0(maximum right yaw rate)
Note: The specified ranges are conventional and recommended for typical use. Values outside these ranges may be clamped, ignored, or cause undefined behavior depending on the flight system’s implementation.
§Examples
Creating a RateCommand for a moderate right roll and slight nose-up rate:
use stable_flight::RateCommand;
let cmd = RateCommand {
throttle: 0.6, // 60% throttle
roll_rate: 0.3, // Moderate right roll rate
pitch_rate: 0.1, // Slight nose-up rate
yaw_rate: 0.0, // No yaw rate
};§Default Implementation
The Default trait is implemented for RateCommand, providing the following
default values:
throttle:0.0roll_rate:0.0pitch_rate:0.0yaw_rate:0.0
Fields§
§throttle: f32Controls the engine power output, ranging from 0.0 (idle) to 1.0 (maximum).
roll_rate: f32Controls the aircraft’s roll rate, ranging from -1.0 (maximum left roll rate)
to 1.0 (maximum right roll rate).
pitch_rate: f32Controls the aircraft’s pitch rate, ranging from -1.0 (maximum nose-down rate)
to 1.0 (maximum nose-up rate).
yaw_rate: f32Controls the aircraft’s yaw rate, ranging from -1.0 (maximum left yaw rate)
to 1.0 (maximum right yaw rate).
Trait Implementations§
Source§impl Clone for RateCommand
impl Clone for RateCommand
impl Copy for RateCommand
Source§impl Debug for RateCommand
impl Debug for RateCommand
Source§impl Default for RateCommand
impl Default for RateCommand
Source§impl<'de> Deserialize<'de> for RateCommand
impl<'de> Deserialize<'de> for RateCommand
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 From<&RateCommand> for RateSetpoint
Passes the sticks through as rates, with throttle as thrust.
impl From<&RateCommand> for RateSetpoint
Passes the sticks through as rates, with throttle as thrust.
§Examples
use stable_flight::{RateCommand, RateSetpoint};
let command = RateCommand {
throttle: 0.6,
roll_rate: 0.1,
pitch_rate: -0.2,
yaw_rate: 0.3,
};
let setpoint = RateSetpoint::from(&command);
assert_eq!(
setpoint,
RateSetpoint { roll_rate: 0.1, pitch_rate: -0.2, yaw_rate: 0.3, thrust: 0.6, idle: false }
);Source§fn from(command: &RateCommand) -> Self
fn from(command: &RateCommand) -> Self
Source§impl PartialEq for RateCommand
impl PartialEq for RateCommand
Source§impl Serialize for RateCommand
impl Serialize for RateCommand
impl StructuralPartialEq for RateCommand
Auto Trait Implementations§
impl Freeze for RateCommand
impl RefUnwindSafe for RateCommand
impl Send for RateCommand
impl Sync for RateCommand
impl Unpin for RateCommand
impl UnsafeUnpin for RateCommand
impl UnwindSafe for RateCommand
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.