pub struct LateralControllerConfig {
pub position_p: f32,
pub velocity: Gains,
pub max_integral: f32,
pub max_accel_mps2: f32,
pub brake_mps2: f32,
pub braking_share: 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.
Bounds the I term’s authority at velocity.i · max_integral m/s².
max_accel_mps2: f32Most the velocity target changes per second, in m/s²; 0 is off. When set, the target
starts at the measured velocity and moves toward the position loop’s demand at this
rate, its change fed forward as acceleration (PX4 MPC_ACC_HOR,
FlightTaskAuto::activate; ArduPilot AC_PosControl::NE_init_controller).
A new leg then asks for at most atan(max_accel_mps2 / g) of tilt at once, instead of
the tilt for its whole speed. The position loop then slows toward the target along a
braking curve: the speed that decelerating at braking_share of
this rate still stops on the target, so stopping from v starts about
v² / (2 · braking_share · max_accel_mps2) out. Must be non-negative and finite.
brake_mps2: f32Deceleration the position loop brakes at with shaping off, in m/s²; 0 is off. When set,
the speed toward the target follows the braking curve at this rate, instead of
position_p · error, which starts braking only 2 · v meters out whatever the
vehicle’s speed. Higher: brakes later, overshoots once past what the vehicle can
shed. Ignored with shaping on, which brakes at braking_share of
max_accel_mps2. Must be non-negative and finite.
Share of max_accel_mps2 the braking curve slows at with
shaping on. The curve is read at the vehicle’s distance, and the vehicle trails its
shaped velocity target, so it runs ahead of the curve: there the curve’s speed drops
faster than its deceleration. Braking below the shaping rate leaves the rate-limited
target room to follow. Higher: arrives sooner, overshoots more. Must be in (0, 1].
Defaults to DEFAULT_BRAKING_SHARE.
Implementations§
Source§impl LateralControllerConfig
impl LateralControllerConfig
Sourcepub fn validate(&self) -> Result<(), InvalidConfig>
pub fn validate(&self) -> Result<(), InvalidConfig>
Checks the config: position_p, max_integral, max_accel_mps2, and brake_mps2
must be non-negative and finite, and braking_share in (0, 1].
§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 Forget for LateralControllerConfig
impl Freeze for LateralControllerConfig
impl Move 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
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.