MPU-6050 Accel and Gyro with DMP Driver for XRCU. More...
#include <Mpu_6050_dmp.h>
Public Member Functions | |
| Mpu_6050_dmp (const uint32_t init_port) | |
| Creates a new MPU-6050 object. | |
| ~Mpu_6050_dmp () | |
| Destroys this MPU-6050 object. | |
| bool | begin (const uint8_t init_i2c_address=DEFAULT_I2C_ADDRESS) |
| Configures the settings of the I2C bus and this MPU sensor. | |
| bool | begin (const Mpu_6050_cal_vals_t mpu_cal_values, const uint8_t init_i2c_address=DEFAULT_I2C_ADDRESS) |
| Configures the settings of the I2C bus and this MPU sensor. | |
| void | end () |
| Releases the resources used by this object. | |
| uint8_t | who_am_i () |
| Gets the WHO_AM_I value of this MPU sensor. | |
| bool | is_gyro_present () |
| Checks for the presence of of MPU sensor. | |
| Mpu_6050_cal_vals_t | get_prev_caled_vals () |
| Gets the previously calibrated values of the MPU sensor. | |
| Mpu_6050_cal_vals_t | cal (const uint8_t sampling_amount=20) |
| Calibrates this MPU sensor. | |
| void | save_caled_vals () |
| Saves the calibrated values into our local EEPROM in this XRCU. | |
| void | reset () |
| Resets the MPU (including yaw pitch roll orientations). | |
| bool | reset_heading () |
| Takes the current heading of sensor as zero. | |
| double | get_yaw (const bool ask_for_update=true) |
| Gets the heading of gyroscope in degrees [ 0.00 : 359.99 ]. | |
| double | get_pitch (const bool ask_for_update=true) |
| Gets the pitch of gyroscope in degrees [ -90.00 : +90.00 ]. | |
| double | get_roll (const bool ask_for_update=true) |
| Gets the roll of gyroscope in degrees [ -180.00 : +180.00 ]. | |
| uint16_t | get_heading () |
| Gets the heading in degrees. | |
Additional Inherited Members | |
Protected Member Functions inherited from Heading_sensor | |
| Heading_sensor () | |
| Creates a Heading_sensor object. | |
Protected Member Functions inherited from Supported_sensor | |
| Supported_sensor () | |
| Creates an object of a supported sensor. | |
Protected Member Functions inherited from Supported_module | |
| Supported_module () | |
| Creates an object of a supported module. | |
MPU-6050 Accel and Gyro with DMP Driver for XRCU.
MPU-6050 is a 6-axis motion and orientation sensor, with 3 axis accelerometer and 3 axis gyroscope.
MPU-6050 has an on-board Digital Motion Processor (DMP) that can perform synchronized orientation calculations based on the continuous data from the accelerometer and gyroscope reading. This driver uses the DMP to calculate the complicated maths for us.
| Mpu_6050_dmp::Mpu_6050_dmp | ( | const uint32_t | init_port | ) |
Creates a new MPU-6050 object.
| init_port | the I2C port hooked up to the MPU |
| bool Mpu_6050_dmp::begin | ( | const Mpu_6050_cal_vals_t | mpu_cal_values, |
| const uint8_t | init_i2c_address = DEFAULT_I2C_ADDRESS ) |
Configures the settings of the I2C bus and this MPU sensor.
| mpu_cal_values | the calibration values to be applied to this MPU sensor |
| init_i2c_address | the 7-bit I2C address of this MPU sensor |
true if sensor is successfully activated, false if activation failed | bool Mpu_6050_dmp::begin | ( | const uint8_t | init_i2c_address = DEFAULT_I2C_ADDRESS | ) |
Configures the settings of the I2C bus and this MPU sensor.
Previously calibrated values of the MPU sensor (that are stored in this XRCU) is passed to this MPU sensor.
| init_i2c_address | the 7-bit I2C address of this MPU sensor |
true if sensor is successfully activated, false if activation failed | Mpu_6050_cal_vals_t Mpu_6050_dmp::cal | ( | const uint8_t | sampling_amount = 20 | ) |
Calibrates this MPU sensor.
Only call this function when the MPU sensor is placed on a stable surface with any physical interference.
| sampling_amount | the number of samples to be taken for calibration, increase this value to sample a few more times if you want higher accuracy |
| void Mpu_6050_dmp::end | ( | ) |
Releases the resources used by this object.
Resets this MPU sensor and stop the angle calculations to reduce power consumption.
|
virtual |
| double Mpu_6050_dmp::get_pitch | ( | const bool | ask_for_update = true | ) |
Gets the pitch of gyroscope in degrees [ -90.00 : +90.00 ].
| ask_for_update=true | This function updates yaw, pitch and roll values all at a time. true to get the updated value; false to use previously updated value |
| Mpu_6050_cal_vals_t Mpu_6050_dmp::get_prev_caled_vals | ( | ) |
Gets the previously calibrated values of the MPU sensor.
These values are those that are stored in this XRCU.
| double Mpu_6050_dmp::get_roll | ( | const bool | ask_for_update = true | ) |
Gets the roll of gyroscope in degrees [ -180.00 : +180.00 ].
| ask_for_update=true | This function updates yaw, pitch and roll values all at a time. true to get the updated value; false to use previously updated value |
| double Mpu_6050_dmp::get_yaw | ( | const bool | ask_for_update = true | ) |
Gets the heading of gyroscope in degrees [ 0.00 : 359.99 ].
| ask_for_update | This function updates yaw, pitch and roll values together. true to get the updated value; false to use previously updated value |
| bool Mpu_6050_dmp::is_gyro_present | ( | ) |
Checks for the presence of of MPU sensor.
The presence is checked on the declared I2C bus with the given I2C address.
true if the MPU-6050 (or its series chips) is found on the I2C bus, false otherwise
|
virtual |
Takes the current heading of sensor as zero.
true if sensor heading is resetted, false otherwise. Implements Heading_sensor.
| uint8_t Mpu_6050_dmp::who_am_i | ( | ) |
Gets the WHO_AM_I value of this MPU sensor.
The obtained value is very useful in distinguishing MPU-6500 and MPU-9250.
0x68 indicates MPU-6050; 0x70 indicates MPU-6500; 0x71 indicates MPU-9250)