Skip to main content

MadgwickFilter

Struct MadgwickFilter 

Source
pub struct MadgwickFilter<T> { /* private fields */ }
Expand description

Implementations§

Source§

impl<T> MadgwickFilter<T>
where T: Copy + Zero + One + Default,

Source

pub fn new() -> Self

Source§

impl<T> MadgwickFilter<T>
where T: Copy + One + Zero + Neg<Output = T> + PartialOrd + Sub<Output = T> + Div<Output = T> + Vector3dMath + QuaternionMath + SqrtMethods + SensorFusionMath,

Source

pub fn set_beta(&mut self, beta: T)

Trait Implementations§

Source§

impl<T: Clone> Clone for MadgwickFilter<T>

Source§

fn clone(&self) -> MadgwickFilter<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for MadgwickFilter<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T> Default for MadgwickFilter<T>
where T: Copy + Zero + One + Default,

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<T: PartialEq> PartialEq for MadgwickFilter<T>

Source§

fn eq(&self, other: &MadgwickFilter<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T> SensorFusion<T> for MadgwickFilter<T>

Madgwick AHRS algorithm, calculates orientation by fusing output from gyroscope and accelerometer. (No magnetometer is used in this implementation.)

The orientation is calculated as the integration of the gyroscope measurements summed with the measurement from the accelerometer multiplied by a gain. A low gain gives more weight to the gyroscope more and so is more susceptible to drift. A high gain gives more weight to the accelerometer and so is more susceptible to accelerometer noise, lag, and other accelerometer errors. A gain of zero means that orientation is determined by solely by the gyroscope.

See Sebastian Madgwick’s Phd thesis and also x-io Technologies sensor fusion library.

For computation efficiency this code refactors the code used in many implementations (Arduino, Adafruit, M5 Stack, Reefwing-AHRS), see Madgwick refactoring.

Source§

fn fuse_acc_gyro( &mut self, acc: Vector3d<T>, gyro_rps: Vector3d<T>, delta_t: T, ) -> Quaternion<T>

Fuses accelerometer and gyroscope readings to give the orientation quaternion.

Source§

fn fuse_acc_gyro_mag( &mut self, acc: Vector3d<T>, gyro_rps: Vector3d<T>, mag: Vector3d<T>, delta_t: T, ) -> Quaternion<T>

Fuses accelerometer, gyroscope, and magnetometer readings to give the orientation quaternion.

Source§

fn set_gains(&mut self, gain0: T, _gain1: T)

Source§

fn requires_initialization() -> bool

Source§

impl<T: Copy> Copy for MadgwickFilter<T>

Source§

impl<T> StructuralPartialEq for MadgwickFilter<T>

Auto Trait Implementations§

§

impl<T> Freeze for MadgwickFilter<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for MadgwickFilter<T>
where T: RefUnwindSafe,

§

impl<T> Send for MadgwickFilter<T>
where T: Send,

§

impl<T> Sync for MadgwickFilter<T>
where T: Sync,

§

impl<T> Unpin for MadgwickFilter<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for MadgwickFilter<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for MadgwickFilter<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.