aa

Dependencies:   mbed TrapezoidControl QEI

Files at this revision

API Documentation at this revision

Comitter:
yabahiro
Date:
Thu Oct 24 12:16:08 2019 +0000
Parent:
45:878f8f385635
Commit message:
qa

Changed in this revision

System/Process/Process.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/System/Process/Process.cpp	Thu Oct 03 11:09:31 2019 +0000
+++ b/System/Process/Process.cpp	Thu Oct 24 12:16:08 2019 +0000
@@ -2145,7 +2145,6 @@
 #if USE_PROCESS_NUM>6
 static void Process6()
 {
-//   printf("1:%d 2:%d 3:%d 4:%d 5:%d 6:%d 7:%d 8:%d\n\r",g[0],g[1],g[2],g[3],g[4],g[5],g[6],g[7]);
     LedMode(3);
     count++;
     if(mode==1) {//スタートゾーンから白線検知
@@ -2160,7 +2159,7 @@
         motor[TIRE_BR].dir = BACK;
         motor[TIRE_BL].pwm = normal;
         motor[TIRE_BL].dir = FOR;
-        if(g[2]==0) {
+        if(g[2]==0&&count>=100000) {
             count=100000;
             cross=0;
             mode=3;
@@ -2187,7 +2186,7 @@
             counts=false;
         }
 
-        if(cros==Twsh) {
+        if(cros==3) {
             mode=11;
             count=0;
             cros=0;
@@ -2207,7 +2206,7 @@
                     cross++;
                     count=0;
                 }
-                if(cross==Twsh) {
+                if(cross==3) {
                     mode=11;
                     count=0;
                     cross=0;
@@ -2607,33 +2606,41 @@
         }
     } else {
         if(mode==22) {
-            motor[TIRE_FR].pwm = 0;
-            motor[TIRE_FR].dir = FREE;
-            motor[TIRE_FL].pwm = 25;
-            motor[TIRE_FL].dir = FOR;
-            motor[TIRE_BR].pwm = 25;
-            motor[TIRE_BR].dir = BACK;
-            motor[TIRE_BL].pwm = 0;
-            motor[TIRE_BL].dir = FREE;
-            if(g[0]==0&&count>=10000) {
+            motor[TIRE_FR].pwm = 25;
+            motor[TIRE_FR].dir = FOR;
+            motor[TIRE_FL].pwm = 0;
+            motor[TIRE_FL].dir = FREE;
+            motor[TIRE_BR].pwm = 0;
+            motor[TIRE_BR].dir = FREE;
+            motor[TIRE_BL].pwm = 25;
+            motor[TIRE_BL].dir = BACK;
+            if(g[1]==0&&count>=10000) {
                 mode=30;
                 count=0;
-                cros=0;
+                cross=0;
             }
         }
     }
     if(mode==30) {
         motor[TIRE_FR].pwm = 59;
-        motor[TIRE_FR].dir = BACK;
+        motor[TIRE_FR].dir = FOR;
         motor[TIRE_FL].pwm = 62;
-        motor[TIRE_FL].dir = FOR;
+        motor[TIRE_FL].dir = BACK;
         motor[TIRE_BR].pwm = 59;
-        motor[TIRE_BR].dir = BACK;
+        motor[TIRE_BR].dir = FOR;
         motor[TIRE_BL].pwm = 62;
-        motor[TIRE_BL].dir = FOR;
-        if(g[0]==98) {
-            mode=31;
-            count=0;
+        motor[TIRE_BL].dir = BACK;
+        if(g[1]==98) {
+            if(count>30000) {
+                cross++;
+                count=0;
+            }
+            if(cross==2) {
+                mode=31;
+                count=0;
+                cros=0;
+            }
+
         }
     } else if(mode==31) {
         motor[TIRE_FR].pwm = 0;
@@ -2663,13 +2670,13 @@
         }
     } else if(mode==33) {
         motor[TIRE_FR].pwm = 0;
-        motor[TIRE_FR].dir = BACK;
+        motor[TIRE_FR].dir = FREE;
         motor[TIRE_FL].pwm = 30;
-        motor[TIRE_FL].dir = FOR;
+        motor[TIRE_FL].dir = BACK;
         motor[TIRE_BR].pwm = 30;
-        motor[TIRE_BR].dir = BACK;
+        motor[TIRE_BR].dir = FOR;
         motor[TIRE_BL].pwm = 0;
-        motor[TIRE_BL].dir = FOR;
+        motor[TIRE_BL].dir = FREE;
         if(g[3]==0&&count>=20000) {
             count=0;
             if(Twsh==2) {
@@ -2998,6 +3005,7 @@
         motor[TIRE_BL].dir = BACK;
     } else {
     }
+
 }
 #endif