pub struct BodyRateControllerConfig {
pub roll_gains: Gains,
pub pitch_gains: Gains,
pub yaw_gains: Gains,
pub max_integral: f32,
pub yaw_max_integral: f32,
}Expand description
Configures the BodyRateController with PID gains and operational limits.
Gains map rate error (rad/s) straight to a normalized moment in [-1, 1]: p is moment per
rad/s, i per rad of accumulated error, and d per rad/s².
Fields§
§roll_gains: GainsPID gains for the roll rate.
pitch_gains: GainsPID gains for the pitch rate.
yaw_gains: GainsPID gains for the yaw rate.
max_integral: f32Maximum absolute value of the integrated roll and pitch rate error, in rad, each. Prevents integral windup by limiting error accumulation.
yaw_max_integral: f32Maximum absolute value of the integrated yaw rate error, in rad: the yaw I term holds
at most yaw_gains.i · yaw_max_integral of trim moment.
Implementations§
Source§impl BodyRateControllerConfig
impl BodyRateControllerConfig
Sourcepub fn validate(&self) -> Result<(), InvalidConfig>
pub fn validate(&self) -> Result<(), InvalidConfig>
Checks the config: max_integral and yaw_max_integral must be non-negative and
finite.
§Examples
use stable_flight::controllers::BodyRateControllerConfig;
assert!(BodyRateControllerConfig::default().validate().is_ok());
let bad = BodyRateControllerConfig { max_integral: -1.0, ..Default::default() };
assert!(bad.validate().is_err());Trait Implementations§
Source§impl Clone for BodyRateControllerConfig
impl Clone for BodyRateControllerConfig
impl Copy for BodyRateControllerConfig
Source§impl Debug for BodyRateControllerConfig
impl Debug for BodyRateControllerConfig
Source§impl Default for BodyRateControllerConfig
impl Default for BodyRateControllerConfig
Source§impl PartialEq for BodyRateControllerConfig
impl PartialEq for BodyRateControllerConfig
impl StructuralPartialEq for BodyRateControllerConfig
Auto Trait Implementations§
impl Freeze for BodyRateControllerConfig
impl RefUnwindSafe for BodyRateControllerConfig
impl Send for BodyRateControllerConfig
impl Sync for BodyRateControllerConfig
impl Unpin for BodyRateControllerConfig
impl UnsafeUnpin for BodyRateControllerConfig
impl UnwindSafe for BodyRateControllerConfig
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.