Mukund Pandiri / Mbed 2 deprecated segway-balancing

Dependencies:   mbed mbed-rtos Motor

Files at this revision

API Documentation at this revision

Comitter:
lrucker7
Date:
Thu Apr 23 15:58:39 2020 +0000
Parent:
19:9ea181b003af
Child:
21:949558e7a48c
Commit message:
comment atan2;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Thu Apr 23 15:56:22 2020 +0000
+++ b/main.cpp	Thu Apr 23 15:58:39 2020 +0000
@@ -142,7 +142,7 @@
     for(int i = 0; i < 500; i++){
         imu.readGyro();
         angleBiasGyro += imu.calcGyro(imu.gy);
-        angleBiasAcc += (-1)*atan2(imu.ax,imu.az)*180/3.142-90
+        //angleBiasAcc += (-1)*atan2(imu.ax,imu.az)*180/3.142-90
     }
     angleBiasGyro /= 500;
     angleBiasAcc /= 500;
@@ -152,7 +152,7 @@
 //    return;
     imu.readGyro();
     int gyro = -(imu.calcGyro(imu.gy)-angleBiasGyro) * .01;
-    int acc = (-1)*atan2(imu.ax,imu.az)*180/3.142-90-angleBiasAcc;
+    //int acc = (-1)*atan2(imu.ax,imu.az)*180/3.142-90-angleBiasAcc;
     //pc.printf("gyro:%f",gyro);
     angleMutex.lock();
     pAngle += 1*gyro //+ 0.02*acc;