Fully integrated ToF/IMU codes

Dependencies:   QEI2 PID Watchdog VL53L1X_Filter ros_lib_kinetic

Revision:
21:d1faccb96146
Parent:
20:3c1b58654e67
diff -r 3c1b58654e67 -r d1faccb96146 wheelchairControlSideTof/wheelchair.h
--- a/wheelchairControlSideTof/wheelchair.h	Tue Jul 02 21:17:03 2019 +0000
+++ b/wheelchairControlSideTof/wheelchair.h	Tue Jul 09 17:52:32 2019 +0000
@@ -3,7 +3,7 @@
 /*************************************************************************
 *            Importing libraries into wheelchair.h                       *
 **************************************************************************/
-#include "chair_BNO055.h"
+#include "IMUWheelchair.h"
 #include "PID.h"
 #include "QEI.h"
 #include "VL53L1X.h"
@@ -36,13 +36,13 @@
 #define ToFSensorNum 12
 
 /*************************************************************************
-*IMU definitions for turning wheelchair
+*IMU definitions for turning wheelchair*
 **************************************************************************/
-#define WHEELCHAIR_RADIUS 56 //distance from IMU to edge of wheelchair(cm)
-#define  MAX_ANGULAR_DECELERATION 60 //found through testing, max 
+#define WheelchairRadius 95 //distance from center of rotation to edge of wheelchair
+#define maxAngularDeceleration 1.04 //found through testing, max 
                                      //acceleration at which chair can 
-                                     //stop while turning. In degree per sec
-#define MIN_WALL_LENGTH 100 // minimum distance from wall to ToF (mm)
+                                     //stop while turning. In rads per sec
+#define minWallLength 100 // minimum distance from wall to ToF (mm)
 /*************************************************************************
 *                                                                        *
 *                         Wheelchair class                               *
@@ -57,7 +57,7 @@
     *   serial for printout, and time. This is also used to initialize some  *
     *   variables for the timer,encoders and time-of-flight sensors          *
     **************************************************************************/
-    Wheelchair(PinName xPin, PinName yPin, Serial* pc, Timer* time, QEI* wheel, QEI* wheelS,
+    Wheelchair(PinName xPin, PinName yPin, Serial* pc, Timer* time, Timer* imuT, QEI* wheel, QEI* wheelS,
                VL53L1X** ToF);
 
     /*************************************************************************
@@ -214,6 +214,7 @@
     double vel;
     double test1, test2;
     bool forwardSafety;
+    bool backwardSafety;//Check if can move backward
     bool leftSafety; //to check if can turn left
     bool rightSafety; //to check if can turn right
     double curr_yaw, curr_velS;                                                            // Variable that contains current relative angle
@@ -236,7 +237,7 @@
 
     DigitalIn* e_button;                //Pointer to e_button
 
-    chair_BNO055* imu;                  // Pointer to IMU
+    IMUWheelchair* imu;                  // Pointer to IMU
     Serial* out;                        // Pointer to Serial Monitor
     Timer* ti;                          // Pointer to the timer
     QEI* wheel;                         // Pointer to encoder