pub struct AttitudeControllerConfig {
pub gains: Gains,
pub max_angles_rad: Vec2,
pub max_integral: f32,
pub max_rate_radps: Vec2,
}Expand description
Configures the attitude controller for a vehicle. Defines PID gains, maximum angles, and maximum angular rates for roll and pitch control. Yaw is typically handled separately by a dedicated yaw controller.
Fields§
§gains: GainsPID gains for roll and pitch control (Kp, Ki, Kd).
max_angles_rad: Vec2Maximum angles in radians for roll (x) and pitch (y) (e.g., π/4 = 45°). Limits the vehicle’s tilt in each axis.
max_integral: f32Maximum absolute value of the integrated angle error, in rad·s, per axis. Prevents integral windup by limiting error accumulation.
max_rate_radps: Vec2Maximum angular rates in radians/second for roll (x) and pitch (y). Limits the output rates sent to the rate controller.
Implementations§
Source§impl AttitudeControllerConfig
impl AttitudeControllerConfig
Sourcepub fn validate(&self) -> Result<(), InvalidConfig>
pub fn validate(&self) -> Result<(), InvalidConfig>
Checks the config: max_angles_rad, max_rate_radps, and max_integral must be
non-negative and finite.
§Examples
use stable_flight::controllers::AttitudeControllerConfig;
use stable_flight::Vec2;
assert!(AttitudeControllerConfig::default().validate().is_ok());
let bad = AttitudeControllerConfig {
max_angles_rad: Vec2::new(-1.0, 0.5),
..Default::default()
};
assert!(bad.validate().is_err());Trait Implementations§
Source§impl Clone for AttitudeControllerConfig
impl Clone for AttitudeControllerConfig
impl Copy for AttitudeControllerConfig
Source§impl Debug for AttitudeControllerConfig
impl Debug for AttitudeControllerConfig
Source§impl Default for AttitudeControllerConfig
impl Default for AttitudeControllerConfig
Source§impl PartialEq for AttitudeControllerConfig
impl PartialEq for AttitudeControllerConfig
impl StructuralPartialEq for AttitudeControllerConfig
Auto Trait Implementations§
impl Freeze for AttitudeControllerConfig
impl RefUnwindSafe for AttitudeControllerConfig
impl Send for AttitudeControllerConfig
impl Sync for AttitudeControllerConfig
impl Unpin for AttitudeControllerConfig
impl UnsafeUnpin for AttitudeControllerConfig
impl UnwindSafe for AttitudeControllerConfig
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> 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.