Added Back ToF code

Dependencies:   QEI2 PID IMU6050Ver11 Watchdog VL53L1X_Filter ros_lib_kinetic

Dependents:   Version1-6 Version1-7

Files at this revision

API Documentation at this revision

Comitter:
t1jain
Date:
Thu Jul 11 20:58:26 2019 +0000
Parent:
40:11b8567c507b
Commit message:
Cleaned up code

Changed in this revision

wheelchair.cpp Show annotated file Show diff for this revision Revisions of this file
wheelchair.h Show annotated file Show diff for this revision Revisions of this file
--- a/wheelchair.cpp	Thu Jul 11 18:38:03 2019 +0000
+++ b/wheelchair.cpp	Thu Jul 11 20:58:26 2019 +0000
@@ -104,11 +104,11 @@
     ledgeArrayLF[k] = (*(ToF+1))->readFromOneSensor();
     ledgeArrayRF[k] = (*(ToF+4))->readFromOneSensor();
 
-    /*for(int i = 0; i < 100; i++)
+    /* for(int i = 0; i < 100; i++)
     {
         out->printf("%d, ",ledgeArrayRF[i]);
     }
-    out->printf("\r\n");*/
+    out->printf("\r\n"); */
 
     outlierToF[0] = LFTStats.mean() + 2*LFTStats.stdev();
     outlierToF[1] = RFTStats.mean() + 2*RFTStats.stdev();
@@ -148,12 +148,6 @@
         forwardSafety = 0;
     
     ////////////////////////////////////////////////////////////////////////////
-    
-//        k2++;
-//    
-//        if (k2 == 150) {
-//            k2 = 0;
-//        }
 
     ledgeArrayLB[k] = (*(ToF+1))->readFromOneSensor();
     ledgeArrayRB[k] = (*(ToF+4))->readFromOneSensor();
@@ -194,8 +188,7 @@
 
     else
         backwardSafety = 0;
-    
-    
+        
     ////////////////////////////////////////////////////////////////////////////
 
     /*Side Tof begin*/
--- a/wheelchair.h	Thu Jul 11 18:38:03 2019 +0000
+++ b/wheelchair.h	Thu Jul 11 20:58:26 2019 +0000
@@ -41,11 +41,11 @@
 /*************************************************************************
 *IMU definitions for turning wheelchair
 **************************************************************************/
-#define WheelchairRadius 80 //distance from IMU to edge of wheelchair(cm)
-#define  maxAngularDeceleration 1.04 //found through testing, max 
-                                     //acceleration at which chair can 
-                                     //stop while turning. In rads per sec
-#define minWallLength 10 // minimum distance from wall to ToF (cm)
+#define WheelchairRadius 80             //distance from IMU to edge of wheelchair(cm)
+#define  maxAngularDeceleration 1.04    //found through testing, max 
+                                        //acceleration at which chair can 
+                                        //stop while turning. In rads per sec
+#define minWallLength 10                // minimum distance from wall to ToF (cm)
 /*************************************************************************
 *                                                                        *
 *                         Wheelchair class                               *
@@ -217,10 +217,10 @@
     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
+    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
 
 private:
     /************************************************************************
@@ -238,9 +238,9 @@
     PwmOut* on;
     PwmOut* off;
 
-    DigitalIn* e_button;                //Pointer to e_button
+    DigitalIn* e_button;                // Pointer to e_button
 
-    IMUWheelchair* 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