MAV'RIC
|
Inertial measurement unit (IMU) More...
#include <imu.hpp>
Public Member Functions | |
Imu (Accelerometer &accelerometer, Gyroscope &gyroscope, Magnetometer &magnetometer, imu_conf_t config=imu_default_config()) | |
Constructor. | |
bool | update (void) |
Main update. | |
const float & | last_update_us (void) const |
Get last update time in microseconds. | |
const float & | dt_s (void) const |
Get time between two last updates in seconds. | |
const std::array< float, 3 > & | acc (void) const |
Get X, Y and Z components of acceleration in g. | |
const std::array< float, 3 > & | gyro (void) const |
Get X, Y and Z components of angular velocity in rad/s. | |
const std::array< float, 3 > & | mag (void) const |
Get X, Y and Z components of magnetic field (normalized) | |
const std::array< float, 3 > & | magnetic_north (void) const |
Get X, Y and Z components of magnetic north (in NED frame) | |
bool | is_ready (void) const |
Get the readiness of the IMU. | |
imu_conf_t * | get_config (void) |
Temporary method to get pointer to configuration. | |
bool | start_accelerometer_bias_calibration (void) |
Start accelerometer bias calibration. | |
bool | start_gyroscope_bias_calibration (void) |
Start gyroscope bias calibration. | |
bool | start_magnetometer_bias_calibration (void) |
Start magnetometer bias calibration. | |
bool | start_magnetic_north_calibration (void) |
Start calibration of magnetic field inclination. | |
bool | stop_accelerometer_bias_calibration (void) |
Stop accelerometer bias calibration. | |
bool | stop_gyroscope_bias_calibration (void) |
Stop gyroscope bias calibration. | |
bool | stop_magnetometer_bias_calibration (void) |
Stop magnetometer bias calibration. | |
bool | stop_magnetic_north_calibration (void) |
Stop calibration of magnetic inclination. |
Inertial measurement unit (IMU)
This module gathers new data from inertial sensors and takes care of rotating, removing bias, and scaling raw sensor values (in this order)
If this module is used, then it is not needed to call each sensor's update function.
const std::array< float, 3 > & Imu::acc | ( | void | ) | const |
Get X, Y and Z components of acceleration in g.
const float & Imu::dt_s | ( | void | ) | const |
Get time between two last updates in seconds.
imu_conf_t * Imu::get_config | ( | void | ) |
Temporary method to get pointer to configuration.
Used to add onboard parameters for the biases and scales TODO: make it possible to set/get parameters via methods calls instead of via pointers and remove this method
const std::array< float, 3 > & Imu::gyro | ( | void | ) | const |
Get X, Y and Z components of angular velocity in rad/s.
bool Imu::is_ready | ( | void | ) | const |
Get the readiness of the IMU.
const float & Imu::last_update_us | ( | void | ) | const |
Get last update time in microseconds.
const std::array< float, 3 > & Imu::mag | ( | void | ) | const |
Get X, Y and Z components of magnetic field (normalized)
const std::array< float, 3 > & Imu::magnetic_north | ( | void | ) | const |
Get X, Y and Z components of magnetic north (in NED frame)
bool Imu::start_accelerometer_bias_calibration | ( | void | ) |
Start accelerometer bias calibration.
Should not be used in flight Keep the platform perfectly level during the calibration phase
WARNING: Compatible with gyroscope bias calibration Incompatible with magnetometer bias calibration
bool Imu::start_gyroscope_bias_calibration | ( | void | ) |
Start gyroscope bias calibration.
Should not be used in flight Keep the platform perfectly level during the calibration phase
WARNING: Compatible with accelerometer bias calibration Incompatible with magnetometer bias calibration
bool Imu::start_magnetic_north_calibration | ( | void | ) |
Start calibration of magnetic field inclination.
Should not be used in flight Keep the platform perfectly stable during the calibration phase. It does not have to be perfectly leveled, but should not undergo parasitic accelerations.
WARNING: Incompatible with magnetometer bias calibration
bool Imu::start_magnetometer_bias_calibration | ( | void | ) |
Start magnetometer bias calibration.
Should not be used in flight Rotate the platform in all possible orientation during calibration The goal is to capture the maximum and minimum values for each axis, (ie. have X, Y and Z axis of the UAV). Consecutively, each axis should be perfectly aligned, then perfectly opposed to the magnetic field. Note that the magnetic field is not horizontal !
WARNING: Incompatible with accelerometer and gyroscope bias calibration
bool Imu::stop_accelerometer_bias_calibration | ( | void | ) |
Stop accelerometer bias calibration.
Should not be used in flight
bool Imu::stop_gyroscope_bias_calibration | ( | void | ) |
Stop gyroscope bias calibration.
Should not be used in flight
bool Imu::stop_magnetic_north_calibration | ( | void | ) |
Stop calibration of magnetic inclination.
Should not be used in flight
bool Imu::stop_magnetometer_bias_calibration | ( | void | ) |
Stop magnetometer bias calibration.
Should not be used in flight This function updates the magnetometer bias with the
bool Imu::update | ( | void | ) |
Main update.