pub struct LateralControllerConfig {
pub position_p: f32,
pub velocity: Gains,
pub max_integral: f32,
}Expand description
Configures the LateralController: a position loop feeding a velocity loop.
Fields§
§position_p: f32Proportional gain from position error (m) to desired velocity (m/s), in 1/s. Sets how fast the vehicle closes on a target before the speed limit applies. Must be non-negative and finite.
velocity: GainsPID gains from velocity error (m/s) to horizontal acceleration (m/s²).
max_integral: f32Maximum absolute value of the integrated velocity error, in m, per axis. Prevents integral windup by limiting error accumulation.
Implementations§
Source§impl LateralControllerConfig
impl LateralControllerConfig
Sourcepub fn validate(&self) -> Result<(), InvalidConfig>
pub fn validate(&self) -> Result<(), InvalidConfig>
Checks the config: position_p and max_integral must be non-negative and finite.
§Examples
use stable_flight::controllers::LateralControllerConfig;
assert!(LateralControllerConfig::default().validate().is_ok());
let bad = LateralControllerConfig { max_integral: f32::NAN, ..Default::default() };
assert!(bad.validate().is_err());Trait Implementations§
Source§impl Clone for LateralControllerConfig
impl Clone for LateralControllerConfig
impl Copy for LateralControllerConfig
Source§impl Debug for LateralControllerConfig
impl Debug for LateralControllerConfig
Source§impl Default for LateralControllerConfig
impl Default for LateralControllerConfig
Source§impl PartialEq for LateralControllerConfig
impl PartialEq for LateralControllerConfig
impl StructuralPartialEq for LateralControllerConfig
Auto Trait Implementations§
impl Freeze for LateralControllerConfig
impl RefUnwindSafe for LateralControllerConfig
impl Send for LateralControllerConfig
impl Sync for LateralControllerConfig
impl Unpin for LateralControllerConfig
impl UnsafeUnpin for LateralControllerConfig
impl UnwindSafe for LateralControllerConfig
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.