Struct PidControllers
pub struct PidControllers<const NUM_SAMPLES: usize> {
pub mode: FlightMode,
pub x_controller: Option<PidController<fn(_: f32, _: f32) -> f32, NUM_SAMPLES>>,
pub y_controller: Option<PidController<fn(_: f32, _: f32) -> f32, NUM_SAMPLES>>,
pub z_controller: Option<PidController<fn(_: f32, _: f32) -> f32, NUM_SAMPLES>>,
}
Expand description
A Mulit-PID controller that can control the acceleration/velocity in one or all three axes.
Fields§
§mode: FlightMode
§x_controller: Option<PidController<fn(_: f32, _: f32) -> f32, NUM_SAMPLES>>
This is ignored unless the mode FixedDirection.
y_controller: Option<PidController<fn(_: f32, _: f32) -> f32, NUM_SAMPLES>>
§z_controller: Option<PidController<fn(_: f32, _: f32) -> f32, NUM_SAMPLES>>
Implementations§
§impl<const NUM_SAMPLES: usize> PidControllers<NUM_SAMPLES>
A collection of PidControllers, one for each 3D axis.
Airships use either one or three PidControllers, depending on the mode
(see action_nodes.rs for details of Airship modes).
impl<const NUM_SAMPLES: usize> PidControllers<NUM_SAMPLES>
A collection of PidControllers, one for each 3D axis. Airships use either one or three PidControllers, depending on the mode (see action_nodes.rs for details of Airship modes).
pub fn new(mode: FlightMode) -> PidControllers<NUM_SAMPLES>
pub fn new_multi_pid_controllers( mode: FlightMode, travel_to: Vec3<f32>, ) -> PidControllers<16>
pub fn add_x_measurement(&mut self, time: f64, pv: f32)
pub fn add_y_measurement(&mut self, time: f64, pv: f32)
pub fn add_z_measurement(&mut self, time: f64, pv: f32)
pub fn add_measurement(&mut self, time: f64, pos: Vec3<f32>)
pub fn calc_err_x(&self) -> Option<f32>
pub fn calc_err_y(&self) -> Option<f32>
pub fn calc_err_z(&self) -> Option<f32>
pub fn limit_windup_x<F>(&mut self, f: F)
pub fn limit_windup_y<F>(&mut self, f: F)
pub fn limit_windup_z<F>(&mut self, f: F)
Trait Implementations§
§impl<const NUM_SAMPLES: usize> Clone for PidControllers<NUM_SAMPLES>
impl<const NUM_SAMPLES: usize> Clone for PidControllers<NUM_SAMPLES>
§fn clone(&self) -> PidControllers<NUM_SAMPLES>
fn clone(&self) -> PidControllers<NUM_SAMPLES>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl<const NUM_SAMPLES: usize> Freeze for PidControllers<NUM_SAMPLES>
impl<const NUM_SAMPLES: usize> RefUnwindSafe for PidControllers<NUM_SAMPLES>
impl<const NUM_SAMPLES: usize> Send for PidControllers<NUM_SAMPLES>
impl<const NUM_SAMPLES: usize> Sync for PidControllers<NUM_SAMPLES>
impl<const NUM_SAMPLES: usize> Unpin for PidControllers<NUM_SAMPLES>
impl<const NUM_SAMPLES: usize> UnwindSafe for PidControllers<NUM_SAMPLES>
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> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more