Sensor library for quadcopter
Dependencies: MotionDriverv512
Sensor.h
- Committer:
- oprospero
- Date:
- 2014-06-03
- Revision:
- 0:5c097bb1300f
- Child:
- 2:dae13ba06097
File content as of revision 0:5c097bb1300f:
#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 #include "inv_mpu_dmp_motion_driver.h" #define DEBUG_S class Sensor { public: Sensor(); // Setup the com serial port. (tx, rx) int initialize(); 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