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: f32Most moment the roll and pitch I terms hold, each, in normalized moment: the trim they
can carry, and their windup limit. Like ArduPilot’s rate IMAX and PX4’s
MC_RR_INT_LIM, it doesn’t depend on the I gain.
yaw_max_integral: f32Most moment the yaw I term holds, in normalized 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 in [0, 1]. The output
clips at ±1, so a larger limit would only leave the I term free to wind up; rejecting it
also catches a value saved under the old unit, rad of error (1 and 5 by default).
§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());
let rad = BodyRateControllerConfig { yaw_max_integral: 5.0, ..Default::default() };
assert!(rad.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 Forget for BodyRateControllerConfig
impl Freeze for BodyRateControllerConfig
impl Move 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
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>
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.