Robotics Term Project / Mbed 2 deprecated Robottics_Motion

Dependencies:   mbed

Revision:
25:7053736ea6cc
Parent:
24:f61847968e72
Child:
26:dbdbfdb4dd41
--- a/AI_Friday.cpp	Thu May 26 05:02:53 2016 +0000
+++ b/AI_Friday.cpp	Thu May 26 05:08:24 2016 +0000
@@ -69,7 +69,7 @@
 float angleC;// car's angle 
 double xP,yP,distance; //position that car need to reach
 float angleR; //  angleR =  car-nextSpot direction  --->  car direction
-int yB1,yB2,xB3,xB4; // broder conditions
+
 int xGate = 800, yGate = 300;
 double angleGate, distanceGate;
 int aI_State = 0;
@@ -77,10 +77,13 @@
 double pi = 3.1415926;
 double borAngle=0;
 
+float ballSize; // ball size
+
 float longC; // car's length
 float longB;// long of the court
-float ballSize; // ball size
 float wideB; // wide of the court
+int yB1,yB2,xB3,xB4; // broder conditions
+
 
 int main() {
     
@@ -239,7 +242,7 @@
                     funcBorder();
                     break;
                 case 2: // 前進 再判別   v1+  v2-
-                    if((borAngle-angleC)> 5 || (borAngle-angleC)<-5)
+                    if((borAngle-angleC)> 5 || (borAngle-angleC)<-5) //誤差容忍正負五度
                     {
                         v1_ref =  100;
                         v2_ref = -100;    
@@ -247,7 +250,7 @@
                     bor_state = 1;
                     break;
                 case 3: // 後退 再判別   v1-  v2+
-                    if((borAngle-angleC)> 5 || (borAngle-angleC)<-5)
+                    if((borAngle-angleC)> 5 || (borAngle-angleC)<-5)//誤差容忍正負五度
                     {
                         v1_ref =  100;
                         v2_ref = -100;    
@@ -255,7 +258,7 @@
                     bor_state = 1;
                     break;
                 case 4: // 順時轉到特定角 結束  v1-- v2 --
-                    if((borAngle-angleC)> 5 || (borAngle-angleC)<-5)
+                    if((borAngle-angleC)> 5 || (borAngle-angleC)<-5)//誤差容忍正負五度
                     {
                         v1_ref = -100;
                         v2_ref = -100;    
@@ -265,7 +268,7 @@
                     bor_state = 1;
                     break;
                 case 5: // 逆時轉到特定角 結束  v1 ++   v2++
-                     if((borAngle-angleC)> 5 || (borAngle-angleC)<-5)
+                     if((borAngle-angleC)> 5 || (borAngle-angleC)<-5)//誤差容忍正負五度
                     {
                         v1_ref = 100;
                         v2_ref = 100;