MAV'RIC
|
Driver for sensor MPU_6050 imu. More...
#include <mpu_6050.hpp>
Public Member Functions | |
Mpu_6050 (I2c &i2c) | |
Constructor. | |
bool | init (void) |
Initialise the sensor. | |
bool | update_acc (void) |
Main update function. | |
bool | update_gyr (void) |
const float & | last_update_us (void) const |
Get last update time in microseconds. | |
const std::array< float, 3 > & | gyro (void) const |
Get X, Y and Z components of angular velocity. | |
const float & | gyro_X (void) const |
Get X component of angular velocity. | |
const float & | gyro_Y (void) const |
Get Y component of angular velocity. | |
const float & | gyro_Z (void) const |
Get Z component of angular velocity. | |
const std::array< float, 3 > & | acc (void) const |
Get X, Y and Z components of acceleration. | |
const float & | acc_X (void) const |
Get X component of acceleration. | |
const float & | acc_Y (void) const |
Get Y component of acceleration. | |
const float & | acc_Z (void) const |
Get Z component of acceleration. | |
const float & | temperature (void) const |
Get sensor temperature. |
Driver for sensor MPU_6050 imu.
This sensor is at the same time a accelerometer and a gyroscope The inherited method Accelerometer::update is implemented as MPU_6050::update_acc The inherited method Gyroscope::update is implemented as MPU_6050::update_gyr
Mpu_6050::Mpu_6050 | ( | I2c & | i2c | ) |
Constructor.
i2c | Reference to I2C device |
const std::array< float, 3 > & Mpu_6050::acc | ( | void | ) | const [virtual] |
Get X, Y and Z components of acceleration.
This is raw data, so X, Y and Z components are biased, not scaled, and given in the sensor frame (not in the UAV frame). Use an Imu object to handle bias removal, scaling and axis rotations
Implements Accelerometer.
const float & Mpu_6050::acc_X | ( | void | ) | const [virtual] |
Get X component of acceleration.
This is raw data, so X, Y and Z components are biased, not scaled, and given in the sensor frame (not in the UAV frame). Use an Imu object to handle bias removal, scaling and axis rotations
Implements Accelerometer.
const float & Mpu_6050::acc_Y | ( | void | ) | const [virtual] |
Get Y component of acceleration.
This is raw data, so X, Y and Z components are biased, not scaled, and given in the sensor frame (not in the UAV frame). Use an Imu object to handle bias removal, scaling and axis rotations
Implements Accelerometer.
const float & Mpu_6050::acc_Z | ( | void | ) | const [virtual] |
Get Z component of acceleration.
This is raw data, so X, Y and Z components are biased, not scaled, and given in the sensor frame (not in the UAV frame). Use an Imu object to handle bias removal, scaling and axis rotations
Implements Accelerometer.
const std::array< float, 3 > & Mpu_6050::gyro | ( | void | ) | const [virtual] |
const float & Mpu_6050::gyro_X | ( | void | ) | const [virtual] |
const float & Mpu_6050::gyro_Y | ( | void | ) | const [virtual] |
const float & Mpu_6050::gyro_Z | ( | void | ) | const [virtual] |
bool Mpu_6050::init | ( | void | ) | [virtual] |
Initialise the sensor.
Sends configuration via I2C, the I2C peripheral must be activated before this method is called
Implements Accelerometer.
const float & Mpu_6050::last_update_us | ( | void | ) | const [virtual] |
const float & Mpu_6050::temperature | ( | void | ) | const [virtual] |
bool Mpu_6050::update_acc | ( | void | ) | [virtual] |
Main update function.
Get new data from the sensor
Implements Mpu_6050_acc.