Struct FusionAhrs

Source
pub struct FusionAhrs { /* private fields */ }
Expand description

AHRS algorithm structure.

Implementations§

Source§

impl FusionAhrs

Source

pub fn new() -> Self

Create a new FusionAhrs instance.

Source

pub fn set_settings(&mut self, settings: Settings)

Sets the AHRS algorithm settings.

Source

pub fn reset(&mut self)

Resets the AHRS algorithm. This is equivalent to reinitialising the algorithm while maintaining the current settings.

Source

pub fn update( &mut self, gyroscope: Vector, accelerometer: Vector, magnetometer: Vector, delta_time: f32, )

Updates the AHRS algorithm using the gyroscope, accelerometer, and magnetometer measurements.

Arguments:

  • gyroscope: Gyroscope measurement in degrees per second.
  • accelerometer: Accelerometer measurement in g.
  • magnetometer: Magnetometer measurement in arbitrary units.
  • delta_time: Delta time in seconds.
Source

pub fn update_no_magnetometer( &mut self, gyroscope: Vector, accelerometer: Vector, delta_time: f32, )

Updates the AHRS algorithm using the gyroscope and accelerometer measurements only.

Arguments:

  • gyroscope: Gyroscope measurement in degrees per second.
  • accelerometer: Accelerometer measurement in g.
  • delta_time: Delta time in seconds.
Source

pub fn update_external_heading( &mut self, gyroscope: Vector, accelerometer: Vector, heading: f32, delta_time: f32, )

Updates the AHRS algorithm using the gyroscope, accelerometer, and heading measurements.

Arguments:

  • gyroscope: Gyroscope measurement in degrees per second.
  • accelerometer: Accelerometer measurement in g.
  • heading: Heading measurement in degrees.
  • delta_time: Delta time in seconds.
Source

pub fn set_heading(&mut self, heading: f32)

Sets the heading of the orientation measurement provided by the AHRS algorithm.

This function can be used to reset drift in heading when the AHRS algorithm is being used without a magnetometer.

Source

pub fn get_quaternion(&self) -> Quaternion

Returns the quaternion describing the sensor relative to the Earth.

Source

pub fn set_quaternion(&mut self, quaternion: Quaternion)

Sets the quaternion describing the sensor relative to the Earth.

Source

pub fn get_linear_acceleration(&self) -> Vector

Returns the linear acceleration measurement equal to the accelerometer measurement with the 1g of gravity removed.

Source

pub fn get_earth_acceleration(&self) -> Vector

Returns the Earth acceleration measurement equal to the accelerometer measurement in the Earth coordinate frame with the 1g of gravity removed.

Source

pub fn get_internal_states(&self) -> InternalStates

Returns the AHRS algorithm internal states.

Source

pub fn get_flags(&self) -> Flags

Returns the AHRS algorithm flags.

Trait Implementations§

Source§

impl Default for FusionAhrs

Source§

fn default() -> Self

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

Auto Trait Implementations§

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> 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.