Sensor library for quadcopter

Dependencies:   MotionDriverv512

Committer:
oprospero
Date:
Fri Jun 13 18:27:35 2014 +0000
Revision:
2:dae13ba06097
Parent:
0:5c097bb1300f
Child:
3:e658293d4b83
Refit for quadCommand; Add lower boundary for fifo reset

Who changed what in which revision?

UserRevisionLine numberNew contents of line
oprospero 0:5c097bb1300f 1
oprospero 0:5c097bb1300f 2 #ifndef SENSOR_H
oprospero 0:5c097bb1300f 3 #define SENSOR_H
oprospero 0:5c097bb1300f 4
oprospero 0:5c097bb1300f 5
oprospero 0:5c097bb1300f 6 #define SAMPLE_RATE 200
oprospero 0:5c097bb1300f 7
oprospero 0:5c097bb1300f 8 #define M_PI 3.14159265
oprospero 0:5c097bb1300f 9 #define RAD2DEG 180 / M_PI
oprospero 0:5c097bb1300f 10 #define GYRO_GAIN 0.061035156f
oprospero 2:dae13ba06097 11 //#define GYRO_GAIN 0.030517578f
oprospero 2:dae13ba06097 12 //#define GYRO_GAIN 0.015258789f
oprospero 2:dae13ba06097 13 //#define GYRO_GAIN 0.007629394f
oprospero 0:5c097bb1300f 14
oprospero 0:5c097bb1300f 15 #include "inv_mpu_dmp_motion_driver.h"
oprospero 0:5c097bb1300f 16
oprospero 0:5c097bb1300f 17 #define DEBUG_S
oprospero 0:5c097bb1300f 18 class Sensor
oprospero 0:5c097bb1300f 19 {
oprospero 0:5c097bb1300f 20 public:
oprospero 0:5c097bb1300f 21 Sensor(); // Setup the com serial port. (tx, rx)
oprospero 0:5c097bb1300f 22 int initialize();
oprospero 0:5c097bb1300f 23 int updateAngles();
oprospero 0:5c097bb1300f 24 float getYaw();
oprospero 0:5c097bb1300f 25 float getPitch();
oprospero 0:5c097bb1300f 26 float getRoll();
oprospero 0:5c097bb1300f 27 float getGyroYaw();
oprospero 0:5c097bb1300f 28 float getGyroPitch();
oprospero 0:5c097bb1300f 29 float getGyroRoll();
oprospero 0:5c097bb1300f 30
oprospero 0:5c097bb1300f 31
oprospero 0:5c097bb1300f 32 private:
oprospero 0:5c097bb1300f 33 DMP_Motion_Driver dmp;
oprospero 0:5c097bb1300f 34 Quaternion q; // [w, x, y, z] quaternion container
oprospero 0:5c097bb1300f 35 VectorFloat gravity; // [x, y, z] gravity vector
oprospero 0:5c097bb1300f 36 signed char gyro_orientation[9] ;
oprospero 0:5c097bb1300f 37 float ypr[3]; // [yaw, pitch, roll] yaw/pitch/roll container and gravity vector
oprospero 0:5c097bb1300f 38 short gyro[3];
oprospero 0:5c097bb1300f 39 short accel[3];
oprospero 0:5c097bb1300f 40 int packetSize;
oprospero 0:5c097bb1300f 41 uint8_t fifoBuffer[64]; // FIFO storage buffer
oprospero 0:5c097bb1300f 42 uint8_t mpuIntStatus;
oprospero 0:5c097bb1300f 43 int fifoCount;
oprospero 0:5c097bb1300f 44
oprospero 0:5c097bb1300f 45 int mpu_initialize();
oprospero 0:5c097bb1300f 46 int dmp_initialize();
oprospero 0:5c097bb1300f 47 void run_self_test();
oprospero 0:5c097bb1300f 48
oprospero 0:5c097bb1300f 49 };
oprospero 0:5c097bb1300f 50
oprospero 0:5c097bb1300f 51 #endif