pub struct Madgwick<N: Scalar + SimdValue + Copy> {
pub quat: UnitQuaternion<N>,
/* private fields */
}
Expand description
Madgwick AHRS implementation.
Example
let mut ahrs = Madgwick::new(0.002390625f64, 0.1);
println!("madgwick filter: {:?}", ahrs);
// Can now process IMU data using `Ahrs::update_imu`, etc.
Fields§
§quat: UnitQuaternion<N>
Filter state quaternion.
Implementations§
source§impl<N: Scalar + SimdValue + One + Zero + Copy> Madgwick<N>
impl<N: Scalar + SimdValue + One + Zero + Copy> Madgwick<N>
sourcepub fn new(sample_period: N, beta: N) -> Self
pub fn new(sample_period: N, beta: N) -> Self
Creates a new Madgwick
AHRS instance with identity quaternion.
Arguments
sample_period
- The expected sensor sampling period in seconds.beta
- Filter gain.
sourcepub fn new_with_quat(sample_period: N, beta: N, quat: UnitQuaternion<N>) -> Self
pub fn new_with_quat(sample_period: N, beta: N, quat: UnitQuaternion<N>) -> Self
Creates a new Madgwick
AHRS instance with given quaternion.
Arguments
sample_period
- The expected sensor sampling period in seconds.beta
- Filter gain.quat
- Existing filter state quaternion.
Trait Implementations§
source§impl<N: RealField + Copy> Ahrs<N> for Madgwick<N>
impl<N: RealField + Copy> Ahrs<N> for Madgwick<N>
source§fn update(
&mut self,
gyroscope: &Vector3<N>,
accelerometer: &Vector3<N>,
magnetometer: &Vector3<N>
) -> Result<&UnitQuaternion<N>, &str>
fn update(
&mut self,
gyroscope: &Vector3<N>,
accelerometer: &Vector3<N>,
magnetometer: &Vector3<N>
) -> Result<&UnitQuaternion<N>, &str>
Attempts to update the current state quaternion using 9dof IMU values, made up by
gyroscope
,
accelerometer
, and magnetometer
. Read moresource§fn update_imu(
&mut self,
gyroscope: &Vector3<N>,
accelerometer: &Vector3<N>
) -> Result<&UnitQuaternion<N>, &str>
fn update_imu(
&mut self,
gyroscope: &Vector3<N>,
accelerometer: &Vector3<N>
) -> Result<&UnitQuaternion<N>, &str>
Attempts to update the current state quaternion using 6dof IMU values, made up by
gyroscope
&
accelerometer
. Read moresource§impl<N: SimdRealField + Copy> PartialEq<Madgwick<N>> for Madgwick<N>where
N::Element: SimdRealField + Copy,
impl<N: SimdRealField + Copy> PartialEq<Madgwick<N>> for Madgwick<N>where
N::Element: SimdRealField + Copy,
impl<N: Scalar + Copy + SimdValue> Copy for Madgwick<N>
impl<N: SimdRealField + Eq + Copy> Eq for Madgwick<N>where
N::Element: SimdRealField + Copy,
Auto Trait Implementations§
impl<N> RefUnwindSafe for Madgwick<N>where
N: RefUnwindSafe,
impl<N> Send for Madgwick<N>where
N: Send,
impl<N> Sync for Madgwick<N>where
N: Sync,
impl<N> Unpin for Madgwick<N>where
N: Unpin,
impl<N> UnwindSafe for Madgwick<N>where
N: UnwindSafe,
Blanket Implementations§
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.