Buggy bois / Mbed 2 deprecated headache

Dependencies:   mbed

Revision:
13:521d6c6e7042
Parent:
12:11d203351eb0
diff -r 11d203351eb0 -r 521d6c6e7042 Robot.h
--- a/Robot.h	Mon Apr 29 00:57:32 2019 +0000
+++ b/Robot.h	Mon Apr 29 09:40:30 2019 +0000
@@ -173,13 +173,15 @@
             sensorNumber = 0;
             if (endOfLineDetection < 5)
             {
-                AF = 0.425f;
+                AF = 0.5f;
                 adjustRbtAngularVelocity(lineVoltages[lvIndex%numberOfSamples]);
                 lvIndex++;
             }
             else
             {
-               stopMovement(); 
+               stopMovement();
+               rightWheel->resetPID();
+               leftWheel->resetPID();
             }
         endOfLineDetection = 0;
         }
@@ -187,10 +189,13 @@
     
     void turn180()
     {
+        stopMovement();
+        rightWheel->resetPID();
+        leftWheel->resetPID();
         updater.detach();
         rightWheel->adjustAngularVelocity(rightWheel->returnMaxAngularVel()*0.3f);
         leftWheel->adjustAngularVelocity(rightWheel->returnMaxAngularVel()*-0.3f);
-        timeToStop.attach(callback(this, &Robot::reAttach),1.1f);
+        timeToStop.attach(callback(this, &Robot::reAttach),1.0f);
         state = 'S';
     }