#include <otMPU9250.h>
Public Types | |
enum | Ascale { AFS_2G = 0, AFS_4G, AFS_8G, AFS_16G } |
enum | Gscale { GFS_250DPS = 0, GFS_500DPS, GFS_1000DPS, GFS_2000DPS } |
enum | Mscale { MFS_14BITS = 0, MFS_16BITS } |
Public Member Functions | |
otMPU9250 () | |
bool | init (U8 da=MPU9250_ADDRESS) |
bool | check () |
bool | magnetometerCheck () |
void | close () |
void | reset () |
void | selfTest (F32 *destination) |
void | accelGyroCalibration () |
void | setRange (U8 accRange, U8 gyrRange, U8 magRange) |
void | imuInit () |
void | magnetometerInit () |
void | magnetometerCalibration () |
bool | ready () |
void | accelerometer (F32 &ax, F32 &ay, F32 &az) |
void | gyroscope (F32 &gx, F32 &gy, F32 &gz) |
void | accelerometerGyroscope (F32 &ax, F32 &ay, F32 &az, F32 &gx, F32 &gy, F32 &gz) |
bool | magnetometer (F32 &mx, F32 &my, F32 &mz) |
void | madgwickQuaternionUpdate (F32 ax, F32 ay, F32 az, F32 gx, F32 gy, F32 gz, F32 mx, F32 my, F32 mz, F32 deltat) |
void | mahonyQuaternionUpdate (F32 ax, F32 ay, F32 az, F32 gx, F32 gy, F32 gz, F32 mx, F32 my, F32 mz, F32 deltat) |
void | taitBryanAngles (F32 &yaw, F32 &pitch, F32 &roll) |
F32 | temperature (float offset=11.0f) |
Data Fields | |
imuData * | d |
|
|
|
|
|
|
|
|
|
Read current value from accelerometer for all axes
|
|
Read current value from accelerometer and gyroscope for all axes
|
|
Function which accumulates gyro and accelerometer data after device initialization. It calculates the average of the at-rest readings and then loads the resulting offsets into accelerometer and gyro bias registers. |
|
Return true if the accelerometer and the gyroscope is present |
|
Free all allocated data by this class |
|
Read current value from gyroscope for all axes
|
|
Configure gyroscope, accelerometer and Thermometer. |
|
Init class data structure |
|
Implementation of Sebastian Madgwick's "...efficient orientation filter for... inertial/magnetic sensor arrays" (see http://www.x-io.co.uk/category/open-source/ for examples and more details) which fuses acceleration, rotation rate, and magnetic moments to produce a quaternion-based estimate of absolute device orientation -- which can be converted to yaw, pitch, and roll. Useful for stabilizing quadcopters, etc. The performance of the orientation filter is at least as good as conventional Kalman-based filtering algorithms but is much less computationally intensive---it can be performed on a 3.3 V Pro Mini operating at 8 MHz!
|
|
Read current value from magnetometer for all axes
|
|
Magnetometer calibration |
|
Return if the magnetometer is present |
|
Configure the magnetometer for continuous read and highest resolution |
|
Similar to Madgwick scheme but uses proportional and integral filtering on the error between estimated reference vectors and measured ones.
|
|
Return true if a new measure is available |
|
Reset the accelerometer and the gyroscope |
|
Should return percent deviation from factory trim values, +/- 14 or less deviation is a pass
|
|
Specify the range for each measure of the IMU |
|
Define output variables from updated quaternion---these are Tait-Bryan angles, commonly used in aircraft orientation. In this coordinate system, the positive z-axis is down toward Earth. Yaw is the angle between Sensor x-axis and Earth magnetic North (or true North if corrected for local declination, looking down on the sensor positive yaw is counterclockwise. Pitch is angle between sensor x-axis and Earth ground plane, toward the Earth is positive, up toward the sky is negative. Roll is angle between sensor y-axis and Earth ground plane, y-axis up is positive roll. These arise from the definition of the homogeneous rotation matrix constructed from quaternions. Tait-Bryan angles as well as Euler angles are non-commutative; that is, the get the correct orientation the rotations must be applied in the correct order which for this configuration is yaw, pitch, and then roll. For more see http://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles which has additional links.
|
|
IMU temperature as celsius
|
|
|