pub struct MultiCopterAttitudeController {
pub roll_rate: PID,
pub pitch_rate: PID,
pub yaw_rate: PID,
pub attitude_controller: AttitudeController,
}
Expand description
use embedded_flight_control::MultiCopterAttitudeController;
let mut controller = MultiCopterAttitudeController::default();
// Input the desired attitude and angular velocity with the current attitude
controller.attitude_controller.input(
Quaternion::default(),
Vector3::default(),
Quaternion::default(),
);
// Output the control to the motors with the current gyroscope data.
let output = controller.motor_output(Vector3::default(), 1);
dbg!(output);
Fields§
§roll_rate: PID
§pitch_rate: PID
§yaw_rate: PID
§attitude_controller: AttitudeController
Implementations§
Source§impl MultiCopterAttitudeController
impl MultiCopterAttitudeController
Sourcepub fn motor_output(
&mut self,
gyro: Vector3<f32>,
now_ms: u32,
) -> MotorOutput<f32>
pub fn motor_output( &mut self, gyro: Vector3<f32>, now_ms: u32, ) -> MotorOutput<f32>
Calculate the motor output of the controller (in -1 ~ +1) .
Sourcepub fn motor_output_with_limit(
&mut self,
gyro: Vector3<f32>,
now_ms: u32,
limit: [bool; 3],
) -> MotorOutput<f32>
pub fn motor_output_with_limit( &mut self, gyro: Vector3<f32>, now_ms: u32, limit: [bool; 3], ) -> MotorOutput<f32>
Calculate the motor output of the controller (in -1 ~ +1) with an optional limit for roll, pitch, and yaw.
pub fn update_throttle_rpy_mix(&mut self)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MultiCopterAttitudeController
impl RefUnwindSafe for MultiCopterAttitudeController
impl Send for MultiCopterAttitudeController
impl Sync for MultiCopterAttitudeController
impl Unpin for MultiCopterAttitudeController
impl UnwindSafe for MultiCopterAttitudeController
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<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.