Added BNO080Wheelchair.h
Dependents: BNO080_program wheelchaircontrol8 Version1-9 BNO080_program
Diff: BNO080Wheelchair.h
- Revision:
- 11:dbe6d8d0ceb1
- Parent:
- 10:9275e6f7bf1b
- Child:
- 12:f013530d8358
diff -r 9275e6f7bf1b -r dbe6d8d0ceb1 BNO080Wheelchair.h --- a/BNO080Wheelchair.h Tue Jul 30 18:33:45 2019 +0000 +++ b/BNO080Wheelchair.h Fri Aug 02 23:34:30 2019 +0000 @@ -4,6 +4,7 @@ //#include "filter.h" #include "math.h" #include "BNO080.h" +#include "BNO080Constants.h" #define PI 3.141593 @@ -17,9 +18,8 @@ class BNO080Wheelchair { public: - //The constructor for this class - //BNO080Wheelchair(Serial* out, Timer* time); - //BNO080Wheelchair(PinName sda_pin, PinName scl_pin, Serial* out, Timer* time); + BNO080* imu; //The IMU we're testing from, BNO080 + BNO080Wheelchair(Serial *debugPort, PinName sdaPin, PinName sclPin, PinName intPin, PinName rstPin, uint8_t i2cAddress, int i2cPortpeed); @@ -27,13 +27,13 @@ //Set up the IMU, check if it connects void setup(); - //Get the x-component of the linear acceleration + //Get the x-component of the linear acceleration (total) double accel_x(); - //Get the y-component of the linear acceleration + //Get the y-component of the linear acceleration (total) double accel_y(); - //Get the z-component of the linear acceleration + //Get the z-component of the linear acceleration (total) double accel_z(); //Get the x-component of gyro, angular velocity @@ -44,10 +44,7 @@ //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(); @@ -57,29 +54,32 @@ //Get the roll, the tilt double roll(); - //Get angle from North - double compass(); - - BNO080* imu; //The IMU we're testing from, MPU6050 + //Get x component of mag field vector + double mag_x(); + + //Get y component of mag field vector + double mag_y(); + + //Get z component of mag field vector + double mag_z(); + + //Check if IMU is pointing in one of the 4 cardinal directions (NSWE) + char compass(); + + //Get the rotation of the IMU (from magnetic north) in radians + Quaternion rotation(); + + double rot_w(); + double rot_x(); + double rot_y(); + double rot_z(); + + 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 - TVector3 gyroRotation; - TVector3 linearAcceleration; - TVector3 magField; - - float angleData[3]; // contains the pitch, roll, yaw angle - float* angleD; // ptr to angleData array - - void calibrate_yaw(); - - bool start; - + }; #endif \ No newline at end of file