Sensor library for quadcopter
Dependencies: MotionDriverv512
Sensor.h
- Committer:
- oprospero
- Date:
- 2014-10-15
- Revision:
- 3:e658293d4b83
- Parent:
- 2:dae13ba06097
- Child:
- 4:f817736140b6
File content as of revision 3:e658293d4b83:
#ifndef SENSOR_H #define SENSOR_H #define SAMPLE_RATE 200 #define M_PI 3.14159265 #define RAD2DEG 180 / M_PI #define GYRO_GAIN 0.061035156f //#define GYRO_GAIN 0.030517578f //#define GYRO_GAIN 0.015258789f //#define GYRO_GAIN 0.007629394f #include "inv_mpu_dmp_motion_driver.h" #define DEBUG_S class Sensor { public: Sensor(); // Setup the com serial port. (tx, rx) int initialize(); void reset(); int updateAngles(); float getYaw(); float getPitch(); float getRoll(); float getGyroYaw(); float getGyroPitch(); float getGyroRoll(); private: DMP_Motion_Driver dmp; Quaternion q; // [w, x, y, z] quaternion container VectorFloat gravity; // [x, y, z] gravity vector signed char gyro_orientation[9] ; float ypr[3]; // [yaw, pitch, roll] yaw/pitch/roll container and gravity vector short gyro[3]; short accel[3]; int packetSize; uint8_t fifoBuffer[64]; // FIFO storage buffer uint8_t mpuIntStatus; int fifoCount; int mpu_initialize(); int dmp_initialize(); void run_self_test(); }; #endif