Added BNO080Wheelchair.h

Dependents:   BNO080_program wheelchaircontrol8 Version1-9 BNO080_program

BNO080Wheelchair.h

Committer:
t1jain
Date:
2019-07-29
Revision:
9:a12af7cb3c6d
Child:
10:9275e6f7bf1b

File content as of revision 9:a12af7cb3c6d:

#ifndef BNO080Wheelchair_H
#define BNO080Wheelchair_H

#include "filter.h"
#include  "math.h"
#include  <BNO080.h>

#define PI 3.141593

#define SDA PB_9
#define SCL PB_8
#define SAMPLEFREQ 50
#define CAL_TIME 3

class BNO080Wheelchair {
    public:
        //The constructor for this class
        BNO080(Serial* out, Timer* time);
        BNO080(PinName sda_pin, PinName scl_pin, Serial* out, Timer* time);
        
        //Set up the IMU, check if it connects
        void setup();
        
        //Get the x-component of the angular acceleration
        double accel_x();
        
        //Get the y-component of the angular acceleration
        double accel_y();
        
        //Get the z-component of the angular acceleration
        double accel_z();
        
        //Get the x-component of gyro, angular velocity
        double gyro_x();
        
        //Get the y-component of gyro, angular velocity
        double gyro_y();
        
        //Get the z-component of gyro, angular velocity
        double gyro_z();
        
        //Magnometer to find angle relative to North to compare to gyroscope
        //double angle_north();
        
        //Get the YAW, or angle (theta), direction facing
        double yaw();
        
        //Get the pitch, (Up and down component)
        double pitch();
        
        //Get the roll, the tilt
        double roll();
  
        BNO080* imu; //The IMU we're testing from, MPU6050  
        
    private:
        Serial* usb; //the connection port
        Timer* t;//to calculate the time
        float accelData[3];     // stores the angular acceleration component
        float gyroData[3];      // stores the gyro data x,y,z
        float* accelD;          // pointer that points to either accelData 
        float* gyroD;           // ptr to the gyroData array
        
        float angleData[3];     // contains the pitch, roll, yaw angle
        float* angleD;          // ptr to angleData array
        
        void calibrate_yaw();
        
        bool start;
    
};

#endif