Monado OpenXR Runtime
Public Member Functions
xrt_fusion::SimpleIMUFusion Class Reference

Public Member Functions

EIGEN_MAKE_ALIGNED_OPERATOR_NEW SimpleIMUFusion (double gravity_rate=0.9)
 
bool valid () const noexcept
 
Eigen::Quaterniond getQuat () const
 Get the current state orientation. More...
 
Eigen::Vector3d getRotationVec () const
 Get the current state orientation as a rotation vector. More...
 
Eigen::Matrix3d getRotationMatrix () const
 Get the current state orientation as a rotation matrix. More...
 
Eigen::Quaterniond getPredictedQuat (timepoint_ns timestamp) const
 Get the predicted orientation at some point in the future. More...
 
Eigen::Vector3d const & getAngVel () const
 Get the angular velocity in body space. More...
 
bool handleGyro (Eigen::Vector3d const &gyro, timepoint_ns timestamp)
 Process a gyroscope report. More...
 
bool handleAccel (Eigen::Vector3d const &accel, timepoint_ns timestamp)
 Process an accelerometer report. More...
 
Eigen::Vector3d getCorrectedWorldAccel (Eigen::Vector3d const &accel) const
 Use this to obtain the residual, world-space acceleration in m/s/s not associated with gravity, after incorporating a measurement. More...
 
void postCorrect ()
 Normalize internal state. More...
 

Constructor & Destructor Documentation

◆ SimpleIMUFusion()

EIGEN_MAKE_ALIGNED_OPERATOR_NEW xrt_fusion::SimpleIMUFusion::SimpleIMUFusion ( double  gravity_rate = 0.9)
inlineexplicit
Parameters
gravity_rateValue in [0, 1] indicating how much the accelerometer should affect the orientation each second.

Member Function Documentation

◆ getAngVel()

Eigen::Vector3d const& xrt_fusion::SimpleIMUFusion::getAngVel ( ) const
inline

Get the angular velocity in body space.

References handleGyro().

◆ getCorrectedWorldAccel()

Eigen::Vector3d xrt_fusion::SimpleIMUFusion::getCorrectedWorldAccel ( Eigen::Vector3d const &  accel) const
inline

Use this to obtain the residual, world-space acceleration in m/s/s not associated with gravity, after incorporating a measurement.

Parameters
accelBody-relative acceleration measurement in m/s/s.

References MATH_GRAVITY_M_S2.

◆ getPredictedQuat()

Eigen::Quaterniond xrt_fusion::SimpleIMUFusion::getPredictedQuat ( timepoint_ns  timestamp) const
inline

Get the predicted orientation at some point in the future.

Here, we do not clamp the delta-t, so only ask for reasonable points in the future. (The gyro handler math does clamp delta-t for the purposes of integration in case of long times without signals, etc, which is OK since the accelerometer serves as a correction.)

Referenced by getRotationMatrix().

◆ getQuat()

Eigen::Quaterniond xrt_fusion::SimpleIMUFusion::getQuat ( ) const
inline

Get the current state orientation.

◆ getRotationMatrix()

Eigen::Matrix3d xrt_fusion::SimpleIMUFusion::getRotationMatrix ( ) const
inline

Get the current state orientation as a rotation matrix.

References getPredictedQuat().

◆ getRotationVec()

Eigen::Vector3d xrt_fusion::SimpleIMUFusion::getRotationVec ( ) const
inline

Get the current state orientation as a rotation vector.

◆ handleAccel()

bool xrt_fusion::SimpleIMUFusion::handleAccel ( Eigen::Vector3d const &  accel,
timepoint_ns  timestamp 
)
inline

Process an accelerometer report.

Parameters
accelBody-relative acceleration measurement in m/s/s.
timestampNanosecond timestamp of this measurement.
Returns
true if the report was used to update the state.

◆ handleGyro()

bool xrt_fusion::SimpleIMUFusion::handleGyro ( Eigen::Vector3d const &  gyro,
timepoint_ns  timestamp 
)
inline

Process a gyroscope report.

Note
At startup, no gyro reports will be considered until at least one accelerometer report has been processed, to provide us with an initial estimate of the direction of gravity.
Parameters
gyroAngular rate in radians per second, in body space.
timestampNanosecond timestamp of this measurement.
Returns
true if the report was used to update the state.

Referenced by getAngVel(), and imu_fusion::imu_fusion_incorporate_gyros().

◆ postCorrect()

void xrt_fusion::SimpleIMUFusion::postCorrect ( )
inline

Normalize internal state.

Call periodically, like after you finish handling both the accel and gyro from one packet.

References xrt_fusion::LowPassIIRFilter< Scalar >::getState(), and MATH_GRAVITY_M_S2.

◆ valid()

bool xrt_fusion::SimpleIMUFusion::valid ( ) const
inlinenoexcept
Returns
true if the filter has started up

Referenced by imu_fusion::imu_fusion_get_prediction(), and imu_fusion::imu_fusion_get_prediction_rotation_vec().


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