pub struct CopterStabilizerConfig {
pub body_rate: BodyRateControllerConfig,
pub attitude: AttitudeControllerConfig,
pub yaw: YawControllerConfig,
pub full_scale_rates_radps: Vec3,
pub thrust_curve_exponent: f32,
pub gyro_cutoff_hz: f32,
pub gyro_notch: NotchConfig,
}Expand description
Configuration for the CopterStabilizer: gains and limits for the inner control loops and the thrust mapping.
Plain data: CopterStabilizer::new validates it, and the stabilizer passes it to its
controllers every tick.
Fields§
§body_rate: BodyRateControllerConfigBody-rate (inner) loop.
attitude: AttitudeControllerConfigRoll/pitch attitude loop (Setpoint::Attitude only).
yaw: YawControllerConfigHeading-hold loop (Setpoint::Attitude only).
full_scale_rates_radps: Vec3Body rates (roll, pitch, yaw) in rad/s that a full-scale RateSetpoint maps to. Each
component must be non-negative and finite: an infinite or NaN scale makes even a neutral
stick a non-finite rate, which zeroes that axis’s moment.
thrust_curve_exponent: f32Exponent of the thrust curve applied to the linear thrust setpoint. Must be positive and finite: a negative exponent maps zero throttle to full thrust.
gyro_cutoff_hz: f32Cutoff of the low-pass on the body rates the rate loop flies, in Hz; 0 turns it off,
and so does one at or past Nyquist. Non-negative and finite. Lower: less gyro noise
and vibration in the moments, more lag in the loop (about 5.6 ms at 40 Hz). The
default is PX4’s IMU_GYRO_CUTOFF; on the sim’s 0.1 rad/s vibration at 90 Hz, 40 Hz
passed the most robustness rows, 20 Hz (ArduPilot’s INS_GYRO_FILTER) and 50 Hz and up
lost clean rows (#373).
gyro_notch: NotchConfigA notch on the roll and pitch rates before the low-pass, for one vibration tone (a
motor’s); off by default. The autotune’s design models it with the low-pass. On the
sim’s 0.1 rad/s at 90 Hz under racer’s 75 Hz low-pass, a notch at the tone (90 Hz,
45 Hz wide, 40 dB) passed the robustness noise row, and flown on every row it changed
none. The yaw rate stays unnotched, though ArduPilot and PX4 notch all three axes: with
yaw notched too, quad_x’s yaw search overshot the step spec on one noise seed of five
from both starts (peaks 1.052 and 1.066 against 1.05), which roll and pitch alone
pass (#597).
Implementations§
Source§impl CopterStabilizerConfig
impl CopterStabilizerConfig
Sourcepub fn validate(&self) -> Result<(), InvalidConfig>
pub fn validate(&self) -> Result<(), InvalidConfig>
Checks every controller config (BodyRateControllerConfig::validate,
AttitudeControllerConfig::validate, YawControllerConfig::validate; errors carry
the loop as their section), that each full_scale_rates_radps component is
non-negative and finite, that thrust_curve_exponent is positive and finite, and that
gyro_cutoff_hz is non-negative and finite.
§Examples
use stable_flight::stabilizers::copter::CopterStabilizerConfig;
let mut config = CopterStabilizerConfig::default();
assert!(config.validate().is_ok());
config.yaw.max_rate_radps = -1.0;
assert!(config.validate().is_err());Sourcepub fn gyro_filters_on(&self, axis: usize) -> GyroFilters
pub fn gyro_filters_on(&self, axis: usize) -> GyroFilters
The gyro filters body axis (0 roll, 1 pitch, 2 yaw) flies through: on roll and
pitch, gyro_notch then the low-pass at
gyro_cutoff_hz; on yaw, the low-pass alone.
Trait Implementations§
Source§impl Clone for CopterStabilizerConfig
impl Clone for CopterStabilizerConfig
impl Copy for CopterStabilizerConfig
Source§impl Debug for CopterStabilizerConfig
impl Debug for CopterStabilizerConfig
Source§impl Default for CopterStabilizerConfig
impl Default for CopterStabilizerConfig
Source§impl ParamTable for CopterStabilizerConfig
impl ParamTable for CopterStabilizerConfig
Source§impl PartialEq for CopterStabilizerConfig
impl PartialEq for CopterStabilizerConfig
Source§impl SideConfig<CopterSide> for CopterStabilizerConfig
impl SideConfig<CopterSide> for CopterStabilizerConfig
Source§fn side(&self) -> &CopterStabilizerConfig
fn side(&self) -> &CopterStabilizerConfig
Source§fn side_mut(&mut self) -> &mut CopterStabilizerConfig
fn side_mut(&mut self) -> &mut CopterStabilizerConfig
impl StructuralPartialEq for CopterStabilizerConfig
Auto Trait Implementations§
impl Forget for CopterStabilizerConfig
impl Freeze for CopterStabilizerConfig
impl Move for CopterStabilizerConfig
impl RefUnwindSafe for CopterStabilizerConfig
impl Send for CopterStabilizerConfig
impl Sync for CopterStabilizerConfig
impl Unpin for CopterStabilizerConfig
impl UnsafeUnpin for CopterStabilizerConfig
impl UnwindSafe for CopterStabilizerConfig
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.