scsl 1.0.1
Shimmering Clarity Standard Library
Loading...
Searching...
No Matches
Public Member Functions | List of all members
scmp::estimation::Madgwick< T > Class Template Reference

Madgwick implements an efficient Orientation estimation for Intertial Measurement Units (IMUs). More...

#include <Madgwick.h>

Public Member Functions

 Madgwick ()
 The Madgwick estimation is initialised with an identity MakeQuaternion.
 
 Madgwick (scmp::geom::Vector< T, 3 > sf)
 The Madgwick estimation is initialised with a sensor frame.
 
 Madgwick (scmp::geom::Quaternion< T > sf)
 Initialise the estimation with a sensor frame MakeQuaternion.
 
scmp::geom::Quaternion< T > Orientation () const
 Return the current orientation as measured by the estimation.
 
scmp::geom::Quaternion< T > AngularRate (const scmp::geom::Vector< T, 3 > &gyro) const
 Return the estimation's rate of angular change from a sensor frame.
 
void UpdateFrame (const scmp::geom::Quaternion< T > &sf, T delta)
 Update the sensor frame to a new frame.
 
void UpdateFrame (const scmp::geom::Quaternion< T > &sf)
 Update the sensor frame to a new frame.
 
void UpdateAngularOrientation (const scmp::geom::Vector< T, 3 > &gyro, T delta)
 Update the sensor frame with a gyroscope reading.
 
void UpdateAngularOrientation (const scmp::geom::Vector< T, 3 > &gyro)
 Update the sensor frame with a gyroscope reading.
 
scmp::geom::Vector< T, 3 > Euler ()
 Retrieve a vector of the Euler angles in ZYX Orientation.
 
void DeltaT (T newDeltaT)
 Set the default Δt.
 
DeltaT ()
 Retrieve the estimation's current ΔT.
 

Detailed Description

template<typename T>
class scmp::estimation::Madgwick< T >

Madgwick implements an efficient Orientation estimation for Intertial Measurement Units (IMUs).

Madgwick is a novel Orientation estimation applicable to IMUs consisting of tri-Axis gyroscopes and accelerometers, and MARG sensor arrays that also include tri-Axis magnetometers. The MARG implementation incorporates magnetic distortionand gyroscope bias drift compensation.

It is described in the paper An efficient Orientation estimation for inertial and inertial/magnetic sensor arrays.

Template Parameters
TA floating point type.

Constructor & Destructor Documentation

◆ Madgwick() [1/3]

template<typename T >
scmp::estimation::Madgwick< T >::Madgwick ( )
inline

The Madgwick estimation is initialised with an identity MakeQuaternion.

◆ Madgwick() [2/3]

template<typename T >
scmp::estimation::Madgwick< T >::Madgwick ( scmp::geom::Vector< T, 3 >  sf)
inline

The Madgwick estimation is initialised with a sensor frame.

Parameters
sfA sensor frame; if zero, the sensor frame will be initialised as an identity MakeQuaternion.

◆ Madgwick() [3/3]

template<typename T >
scmp::estimation::Madgwick< T >::Madgwick ( scmp::geom::Quaternion< T >  sf)
inline

Initialise the estimation with a sensor frame MakeQuaternion.

Parameters
sfA MakeQuaternion representing the current Orientation.

Member Function Documentation

◆ AngularRate()

template<typename T >
scmp::geom::Quaternion< T > scmp::estimation::Madgwick< T >::AngularRate ( const scmp::geom::Vector< T, 3 > &  gyro) const
inline

Return the estimation's rate of angular change from a sensor frame.

Return the rate of change of the Orientation of the earth frame with respect to the sensor frame.

Parameters
gyroA three-dimensional vector containing gyro readings as w_x, w_y, w_z.
Returns
A MakeQuaternion representing the rate of angular change.

◆ DeltaT() [1/2]

template<typename T >
T scmp::estimation::Madgwick< T >::DeltaT ( )
inline

Retrieve the estimation's current ΔT.

Returns
The current value the estimation will default to using if no time delta is provided.

◆ DeltaT() [2/2]

template<typename T >
void scmp::estimation::Madgwick< T >::DeltaT ( newDeltaT)
inline

Set the default Δt.

Note
This must be explicitly called before calling any method which uses the estimation's internal Δt.
Parameters
newDeltaTThe time delta to use when no time delta is provided.

◆ Euler()

template<typename T >
scmp::geom::Vector< T, 3 > scmp::estimation::Madgwick< T >::Euler ( )
inline

Retrieve a vector of the Euler angles in ZYX Orientation.

Returns
A vector of Euler angles as <ψ, θ, ϕ>.

◆ Orientation()

template<typename T >
scmp::geom::Quaternion< T > scmp::estimation::Madgwick< T >::Orientation ( ) const
inline

Return the current orientation as measured by the estimation.

Returns
The current sensor frame.

◆ UpdateAngularOrientation() [1/2]

template<typename T >
void scmp::estimation::Madgwick< T >::UpdateAngularOrientation ( const scmp::geom::Vector< T, 3 > &  gyro)
inline

Update the sensor frame with a gyroscope reading.

If no Δt is provided, the estimation's default is used.

Warning
The default Δt must be explicitly set using DeltaT before calling this.
Parameters
gyroA three-dimensional vector containing gyro readings as w_x, w_y, w_z.

◆ UpdateAngularOrientation() [2/2]

template<typename T >
void scmp::estimation::Madgwick< T >::UpdateAngularOrientation ( const scmp::geom::Vector< T, 3 > &  gyro,
delta 
)
inline

Update the sensor frame with a gyroscope reading.

This method will assert that the Δt value is not zero within a 100μs tolerance. This assert is compiled out with the compile flag NDEBUG, but may be useful to catch possible errors.

Parameters
gyroA three-dimensional vector containing gyro readings as w_x, w_y, w_z.
deltaThe time step between readings. It must not be zero.

◆ UpdateFrame() [1/2]

template<typename T >
void scmp::estimation::Madgwick< T >::UpdateFrame ( const scmp::geom::Quaternion< T > &  sf)
inline

Update the sensor frame to a new frame.

Warning
The estimation's default Δt must be set before calling this.
Parameters
sfThe new sensor frame replacing the previous one.

◆ UpdateFrame() [2/2]

template<typename T >
void scmp::estimation::Madgwick< T >::UpdateFrame ( const scmp::geom::Quaternion< T > &  sf,
delta 
)
inline

Update the sensor frame to a new frame.

Parameters
sfThe new sensor frame replacing the previous one.
deltaThe time delta since the last update.

The documentation for this class was generated from the following file: