aa

Dependencies:   mbed

Revision:
41:99a1158f3eca
Parent:
40:ed2409e0ce6b
Child:
42:980af34f6fe3
--- a/System/Process/Process.cpp	Tue Nov 05 20:40:19 2019 +0000
+++ b/System/Process/Process.cpp	Fri Nov 08 13:57:55 2019 +0000
@@ -14,7 +14,6 @@
 using namespace SWITCH;
 using namespace PID_SPACE;
 
-
 using namespace LINEHUB;
 
 static CONTROLLER::ControllerData *controller;
@@ -100,10 +99,16 @@
 int countss=100000;//wait代替え
 
 ///*********PWM調整用*********///
+
 int fast =60;
 int normal = 40;
 int slow = 20;
 
+/*
+int fast = 80;
+int normal = 60;
+int slow = 40;
+*/
 #pragma endregion USER-DEFINED_VARIABLES_AND_PROTOTYPE
 
 #ifdef USE_SUBPROCESS
@@ -223,6 +228,9 @@
 
     while(1) {
         //pc.printf("4:%d\n\r",g[4]);
+        
+        //LED_DEBUG0 = !LED_DEBUG0; 
+        
         if(EMC==0) {
             fast=40;
             normal=30;
@@ -1919,13 +1927,13 @@
         fast=40;
         normal=30;
         slow=20;
-        motor[TIRE_FR].pwm = normal;
+        motor[TIRE_FR].pwm = normal+10;
         motor[TIRE_FR].dir = BACK;
-        motor[TIRE_FL].pwm = normal;
+        motor[TIRE_FL].pwm = normal+10;
         motor[TIRE_FL].dir = FOR;
-        motor[TIRE_BR].pwm = normal;
+        motor[TIRE_BR].pwm = normal+10;
         motor[TIRE_BR].dir = BACK;
-        motor[TIRE_BL].pwm = normal;
+        motor[TIRE_BL].pwm = normal+10;
         motor[TIRE_BL].dir = FOR;
         if(g[2]==0&&countss>=100000) {
             countss=100000;
@@ -1967,67 +1975,68 @@
                     cross=0;
                 }
                 break;
+                //+20した
             case 0:
-                motor[TIRE_FR].pwm = fast;
+                motor[TIRE_FR].pwm = fast+15;
                 motor[TIRE_FR].dir = BACK;
-                motor[TIRE_FL].pwm = fast;
+                motor[TIRE_FL].pwm = fast+15;
                 motor[TIRE_FL].dir = FOR;
-                motor[TIRE_BR].pwm = fast;
+                motor[TIRE_BR].pwm = fast+15;
                 motor[TIRE_BR].dir = BACK;
-                motor[TIRE_BL].pwm = fast;
+                motor[TIRE_BL].pwm = fast+15;
                 motor[TIRE_BL].dir = FOR;
                 mtc=true;
                 break;
             case 255:
-                motor[TIRE_FR].pwm = fast;
+                motor[TIRE_FR].pwm = fast+15;
                 motor[TIRE_FR].dir = BACK;
-                motor[TIRE_FL].pwm = slow;
+                motor[TIRE_FL].pwm = slow+15;
                 motor[TIRE_FL].dir = FOR;
-                motor[TIRE_BR].pwm = slow;
+                motor[TIRE_BR].pwm = slow+15;
                 motor[TIRE_BR].dir = BACK;
-                motor[TIRE_BL].pwm = fast;
+                motor[TIRE_BL].pwm = fast+15;
                 motor[TIRE_BL].dir = FOR;
                 mtc=true;
                 break;
             case 253:
-                motor[TIRE_FR].pwm = slow;
+                motor[TIRE_FR].pwm = slow+15;
                 motor[TIRE_FR].dir = BACK;
                 motor[TIRE_FL].pwm = 0;
                 motor[TIRE_FL].dir = FREE;
                 motor[TIRE_BR].pwm = 0;
                 motor[TIRE_BR].dir = FREE;
-                motor[TIRE_BL].pwm = slow;
+                motor[TIRE_BL].pwm = slow+15;
                 motor[TIRE_BL].dir = FOR;
                 mtc=true;
                 break;
             case 254:
-                motor[TIRE_FR].pwm = normal;
+                motor[TIRE_FR].pwm = normal+15;
                 motor[TIRE_FR].dir = BACK;
                 motor[TIRE_FL].pwm = 0;
                 motor[TIRE_FL].dir = FREE;
                 motor[TIRE_BR].pwm = 0;
                 motor[TIRE_BR].dir = FREE;
-                motor[TIRE_BL].pwm = normal;
+                motor[TIRE_BL].pwm = normal+15;
                 motor[TIRE_BL].dir = FOR;
                 mtc=true;
                 break;
             case 1:
-                motor[TIRE_FR].pwm = slow;
+                motor[TIRE_FR].pwm = slow+15;
                 motor[TIRE_FR].dir = BACK;
-                motor[TIRE_FL].pwm = fast;
+                motor[TIRE_FL].pwm = fast+15;
                 motor[TIRE_FL].dir = FOR;
-                motor[TIRE_BR].pwm = fast;
+                motor[TIRE_BR].pwm = fast+15;
                 motor[TIRE_BR].dir = BACK;
-                motor[TIRE_BL].pwm = slow;
+                motor[TIRE_BL].pwm = slow+15;
                 motor[TIRE_BL].dir = FOR;
                 mtc=true;
                 break;
             case 3:
                 motor[TIRE_FR].pwm = 0;
                 motor[TIRE_FR].dir = FREE;
-                motor[TIRE_FL].pwm = slow;
+                motor[TIRE_FL].pwm = slow+15;
                 motor[TIRE_FL].dir = FOR;
-                motor[TIRE_BR].pwm = slow;
+                motor[TIRE_BR].pwm = slow+15;
                 motor[TIRE_BR].dir = BACK;
                 motor[TIRE_BL].pwm = 0;
                 motor[TIRE_BL].dir = FREE;
@@ -2036,9 +2045,9 @@
             case 2:
                 motor[TIRE_FR].pwm = 0;
                 motor[TIRE_FR].dir = FREE;
-                motor[TIRE_FL].pwm = normal;
+                motor[TIRE_FL].pwm = normal+15;
                 motor[TIRE_FL].dir = FOR;
-                motor[TIRE_BR].pwm = normal;
+                motor[TIRE_BR].pwm = normal+15;
                 motor[TIRE_BR].dir = BACK;
                 motor[TIRE_BL].pwm = 0;
                 motor[TIRE_BL].dir = FREE;
@@ -2096,13 +2105,13 @@
         solenoid.solenoid4= SOLENOID_ON;
         switch(g[2]) {
             case 98:
-                motor[TIRE_FR].pwm = normal;
+                motor[TIRE_FR].pwm = normal+5;
                 motor[TIRE_FR].dir = FOR;
-                motor[TIRE_FL].pwm = normal;
+                motor[TIRE_FL].pwm = normal+5;
                 motor[TIRE_FL].dir = FOR;
-                motor[TIRE_BR].pwm = normal;
+                motor[TIRE_BR].pwm = normal+5;
                 motor[TIRE_BR].dir = BACK;
-                motor[TIRE_BL].pwm = normal;
+                motor[TIRE_BL].pwm = normal+5;
                 motor[TIRE_BL].dir = BACK;
                 if(countss>30000) {
                     cross++;
@@ -2129,33 +2138,33 @@
                 }
                 break;
             case 0:
-                motor[TIRE_FR].pwm = fast;
+                motor[TIRE_FR].pwm = fast+5;
                 motor[TIRE_FR].dir = FOR;
-                motor[TIRE_FL].pwm = fast;
+                motor[TIRE_FL].pwm = fast+5;
                 motor[TIRE_FL].dir = FOR;
-                motor[TIRE_BR].pwm = fast;
+                motor[TIRE_BR].pwm = fast+5;
                 motor[TIRE_BR].dir = BACK;
-                motor[TIRE_BL].pwm = fast;
+                motor[TIRE_BL].pwm = fast+5;
                 motor[TIRE_BL].dir = BACK;
                 mtc2=true;
                 break;
             case 255:
-                motor[TIRE_FR].pwm = normal;
+                motor[TIRE_FR].pwm = normal+5;
                 motor[TIRE_FR].dir = FOR;
-                motor[TIRE_FL].pwm = fast;
+                motor[TIRE_FL].pwm = fast+5;
                 motor[TIRE_FL].dir = FOR;
-                motor[TIRE_BR].pwm = fast;
+                motor[TIRE_BR].pwm = fast+5;
                 motor[TIRE_BR].dir = BACK;
-                motor[TIRE_BL].pwm = normal;
+                motor[TIRE_BL].pwm = normal+5;
                 motor[TIRE_BL].dir = BACK;
                 mtc2=true;
                 break;
             case 253:
                 motor[TIRE_FR].pwm = 0;
                 motor[TIRE_FR].dir = FREE;
-                motor[TIRE_FL].pwm = slow;
+                motor[TIRE_FL].pwm = slow+5;
                 motor[TIRE_FL].dir = FOR;
-                motor[TIRE_BR].pwm = slow;
+                motor[TIRE_BR].pwm = slow+5;
                 motor[TIRE_BR].dir = BACK;
                 motor[TIRE_BL].pwm = 0;
                 motor[TIRE_BL].dir = FREE;
@@ -2164,44 +2173,44 @@
             case 254:
                 motor[TIRE_FR].pwm = 0;
                 motor[TIRE_FR].dir = FREE;
-                motor[TIRE_FL].pwm = normal;
+                motor[TIRE_FL].pwm = normal+5;
                 motor[TIRE_FL].dir = FOR;
-                motor[TIRE_BR].pwm = normal;
+                motor[TIRE_BR].pwm = normal+5;
                 motor[TIRE_BR].dir = BACK;
                 motor[TIRE_BL].pwm = 0;
                 motor[TIRE_BL].dir = FREE;
                 mtc2=true;
                 break;
             case 1:
-                motor[TIRE_FR].pwm = fast;
+                motor[TIRE_FR].pwm = fast+5;
                 motor[TIRE_FR].dir = FOR;
-                motor[TIRE_FL].pwm = slow;
+                motor[TIRE_FL].pwm = slow+5;
                 motor[TIRE_FL].dir = FOR;
-                motor[TIRE_BR].pwm = slow;
+                motor[TIRE_BR].pwm = slow+5;
                 motor[TIRE_BR].dir = BACK;
-                motor[TIRE_BL].pwm = fast;
+                motor[TIRE_BL].pwm = fast+5;
                 motor[TIRE_BL].dir = BACK;
                 mtc2=true;
                 break;
             case 3:
-                motor[TIRE_FR].pwm = slow;
+                motor[TIRE_FR].pwm = slow+5;
                 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 = slow;
+                motor[TIRE_BL].pwm = slow+5;
                 motor[TIRE_BL].dir = BACK;
                 mtc2=true;
                 break;
             case 2:
-                motor[TIRE_FR].pwm = normal;
+                motor[TIRE_FR].pwm = normal+5;
                 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 = normal;
+                motor[TIRE_BL].pwm = normal+5;
                 motor[TIRE_BL].dir = BACK;
                 mtc2=true;
                 break;
@@ -2372,11 +2381,11 @@
         } else if(mode==23) {
             switch(g[4]) {
                 case 98:
-                    motor[TIRE_FR].pwm = fast;
+                    motor[TIRE_FR].pwm = fast-5;
                     motor[TIRE_FR].dir = FOR;
-                    motor[TIRE_FL].pwm = fast;
+                    motor[TIRE_FL].pwm = fast-5;
                     motor[TIRE_FL].dir = BACK;
-                    motor[TIRE_BR].pwm = fast;
+                    motor[TIRE_BR].pwm = fast-5;
                     motor[TIRE_BR].dir = FOR;
                     motor[TIRE_BL].pwm = fast-5;
                     motor[TIRE_BL].dir = BACK;
@@ -2392,11 +2401,11 @@
                     motor[TIRE_BL].dir = FREE;
                     break;
                 case 0:
-                    motor[TIRE_FR].pwm = fast;
+                    motor[TIRE_FR].pwm = fast-5;
                     motor[TIRE_FR].dir = FOR;
-                    motor[TIRE_FL].pwm = fast;
+                    motor[TIRE_FL].pwm = fast-5;
                     motor[TIRE_FL].dir = BACK;
-                    motor[TIRE_BR].pwm = fast;
+                    motor[TIRE_BR].pwm = fast-5;
                     motor[TIRE_BR].dir = FOR;
                     motor[TIRE_BL].pwm = fast-5;
                     motor[TIRE_BL].dir = BACK;
@@ -2412,21 +2421,21 @@
                     motor[TIRE_BL].dir = FREE;
                     break;
                 case 253:
-                    motor[TIRE_FR].pwm = slow;
+                    motor[TIRE_FR].pwm = slow-5;
                     motor[TIRE_FR].dir = FOR;
-                    motor[TIRE_FL].pwm = fast;
+                    motor[TIRE_FL].pwm = fast-5;
                     motor[TIRE_FL].dir = BACK;
-                    motor[TIRE_BR].pwm = fast;
+                    motor[TIRE_BR].pwm = fast-5;
                     motor[TIRE_BR].dir = FOR;
                     motor[TIRE_BL].pwm = slow-5;
                     motor[TIRE_BL].dir = BACK;
                     break;
                 case 254:
-                    motor[TIRE_FR].pwm = normal;
+                    motor[TIRE_FR].pwm = normal-5;
                     motor[TIRE_FR].dir = FOR;
-                    motor[TIRE_FL].pwm = fast;
+                    motor[TIRE_FL].pwm = fast-5;
                     motor[TIRE_FL].dir = BACK;
-                    motor[TIRE_BR].pwm = fast;
+                    motor[TIRE_BR].pwm = fast-5;
                     motor[TIRE_BR].dir = FOR;
                     motor[TIRE_BL].pwm = normal-5;
                     motor[TIRE_BL].dir = BACK;
@@ -2442,21 +2451,21 @@
                     motor[TIRE_BL].dir = FREE;
                     break;
                 case 3:
-                    motor[TIRE_FR].pwm = fast;
+                    motor[TIRE_FR].pwm = fast-5;
                     motor[TIRE_FR].dir = FOR;
-                    motor[TIRE_FL].pwm = slow;
+                    motor[TIRE_FL].pwm = slow-5;
                     motor[TIRE_FL].dir = BACK;
-                    motor[TIRE_BR].pwm = slow;
+                    motor[TIRE_BR].pwm = slow-5;
                     motor[TIRE_BR].dir = FOR;
                     motor[TIRE_BL].pwm = fast-5;
                     motor[TIRE_BL].dir = BACK;
                     break;
                 case 2:
-                    motor[TIRE_FR].pwm = fast;
+                    motor[TIRE_FR].pwm = fast-5;
                     motor[TIRE_FR].dir = FOR;
-                    motor[TIRE_FL].pwm = normal;
+                    motor[TIRE_FL].pwm = normal-5;
                     motor[TIRE_FL].dir = BACK;
-                    motor[TIRE_BR].pwm = normal;
+                    motor[TIRE_BR].pwm = normal-5;
                     motor[TIRE_BR].dir = FOR;
                     motor[TIRE_BL].pwm = fast-5;
                     motor[TIRE_BL].dir = BACK;
@@ -2620,7 +2629,7 @@
                     motor[TIRE_FL].dir = BACK;
                     motor[TIRE_BR].pwm = 60;
                     motor[TIRE_BR].dir = FOR;
-                    motor[TIRE_BL].pwm = 55;
+                    motor[TIRE_BL].pwm = 60;
                     motor[TIRE_BL].dir = BACK;
                     break;
                 case 99:
@@ -2640,7 +2649,7 @@
                     motor[TIRE_FL].dir = BACK;
                     motor[TIRE_BR].pwm = 60;
                     motor[TIRE_BR].dir = FOR;
-                    motor[TIRE_BL].pwm = 55;
+                    motor[TIRE_BL].pwm = 60;
                     motor[TIRE_BL].dir = BACK;
                     break;
                 case 255:
@@ -2660,7 +2669,7 @@
                     motor[TIRE_FL].dir = BACK;
                     motor[TIRE_BR].pwm = 60;
                     motor[TIRE_BR].dir = FOR;
-                    motor[TIRE_BL].pwm = 15;
+                    motor[TIRE_BL].pwm = 20;
                     motor[TIRE_BL].dir = BACK;
                     break;
                 case 254:
@@ -2670,7 +2679,7 @@
                     motor[TIRE_FL].dir = BACK;
                     motor[TIRE_BR].pwm = 60;
                     motor[TIRE_BR].dir = FOR;
-                    motor[TIRE_BL].pwm = 35;
+                    motor[TIRE_BL].pwm = 40;
                     motor[TIRE_BL].dir = BACK;
                     break;
                 case 1:
@@ -2690,7 +2699,7 @@
                     motor[TIRE_FL].dir = BACK;
                     motor[TIRE_BR].pwm = 20;
                     motor[TIRE_BR].dir = FOR;
-                    motor[TIRE_BL].pwm = 55;
+                    motor[TIRE_BL].pwm = 60;
                     motor[TIRE_BL].dir = BACK;
                     break;
                 case 2:
@@ -2700,7 +2709,7 @@
                     motor[TIRE_FL].dir = BACK;
                     motor[TIRE_BR].pwm = 40;
                     motor[TIRE_BR].dir = FOR;
-                    motor[TIRE_BL].pwm = 55;
+                    motor[TIRE_BL].pwm = 60;
                     motor[TIRE_BL].dir = BACK;
                     break;
             }
@@ -3048,7 +3057,7 @@
         motor[TIRE_FL].dir = BACK;
         motor[TIRE_BR].pwm = 30;
         motor[TIRE_BR].dir = FOR;
-        motor[TIRE_BL].pwm = 00;
+        motor[TIRE_BL].pwm = 0;
         motor[TIRE_BL].dir = FREE;
         if(g[3]==0) {
             cross=0;
@@ -3066,7 +3075,7 @@
                 motor[TIRE_BR].dir = FOR;
                 motor[TIRE_BL].pwm = normal;
                 motor[TIRE_BL].dir = FOR;
-                if(countss>10000) {
+                if(countss>5000) {
                     cross++;
                     countss=0;
                 }