9dofRazor for near space flight project

Dependencies:   mbed

Fork of 9dofRazorImuAhrs by Aaron Berk

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers dof9RazorImuAhrs.h Source File

dof9RazorImuAhrs.h

00001 //****************************************************************************/
00002 // Description:
00003 //
00004 //  Read attitude and heading reference system [AHRS] data from the SparkFun
00005 //  9DOF Razor Inertial Measurement Unit [IMU].
00006 //
00007 // AHRS code:
00008 //
00009 //  http://code.google.com/p/sf9domahrs/
00010 //
00011 // 9DOF Razor IMU:
00012 //
00013 //  http://www.sparkfun.com/commerce/product_info.php?products_id=9623
00014 //****************************************************************************/
00015 
00016 #ifndef DOF9_RAZOR_IMU_H
00017 #define DOF9_RAZOR_IMU_H
00018 
00019 //****************************************************************************/
00020 // Includes
00021 //****************************************************************************/
00022 #include "mbed.h"
00023 
00024 //****************************************************************************/
00025 // Defines
00026 //****************************************************************************/
00027 #define PRINT_EULER   0     //Corrected heading data.
00028 #define PRINT_ANALOGS 1     //Razor spits out raw gyro/accelerometer/magneto
00029                             //data.
00030                             //Set as a define when compiling AHRS code.
00031 #define BAUD_RATE     57600 //Default in AHRS code.
00032 
00033 class dof9RazorImuAhrs {
00034 
00035 public:
00036 
00037     /**
00038      * Constructor.
00039      *
00040      * Parameters:
00041      *
00042      *  tx - Pin to use for Serial transmission.
00043      *  rx - Pin to use for Serial receive.
00044      */
00045     dof9RazorImuAhrs(PinName tx, PinName rx);
00046     
00047     /**
00048      * Update all of the heading data.
00049      */
00050     void update(void);
00051     
00052     float getRoll(void);
00053     float getPitch(void);
00054     float getYaw(void);
00055     
00056     float getGyroX(void);
00057     float getGyroY(void);
00058     float getGyroZ(void);
00059     
00060     float getAccX(void);
00061     float getAccY(void);
00062     float getAccZ(void);
00063     
00064     float getMagX(void);
00065     float getMagY(void);
00066     float getMagZ(void);
00067 
00068 private:
00069 
00070     Serial* razor;
00071 
00072     float roll;
00073     float pitch;
00074     float yaw;
00075     
00076     float gyro_x;
00077     float gyro_y;
00078     float gyro_z;
00079     
00080     float acc_x;
00081     float acc_y;
00082     float acc_z;
00083     
00084     float mag_x;
00085     float mag_y;
00086     float mag_z;
00087 
00088 };
00089 
00090 #endif /* DOF9_RAZOR_IMU_H */