lknds

Dependencies:   mbed TrapezoidControl Pulse QEI

Revision:
23:c853372cf626
Parent:
22:7d93f79a3686
Child:
24:370616a56815
diff -r 7d93f79a3686 -r c853372cf626 System/Process/Process.cpp
--- a/System/Process/Process.cpp	Tue Sep 17 04:40:17 2019 +0000
+++ b/System/Process/Process.cpp	Wed Sep 18 01:58:57 2019 +0000
@@ -391,19 +391,25 @@
     
     if(controller->Button.UP) {
     	motor[LIFT_LB].dir = FOR;
-    	motor[LIFT_LB].pwm = 180;
+    	motor[LIFT_LB].pwm = 190;
     	motor[LIFT_RB].dir = BACK;
     	motor[LIFT_RB].pwm = 180;
     } else if(controller->Button.DOWN) {
     	motor[LIFT_LB].dir = BACK;
     	motor[LIFT_LB].pwm = 180;
     	motor[LIFT_RB].dir = FOR;
+    	motor[LIFT_RB].pwm = 190;
+    } else if(controller->Button.LEFT) {
+    	motor[LIFT_LB].dir = FOR;
+    	motor[LIFT_LB].pwm = 180;
+    } else if(controller->Button.RIGHT) {
+    	motor[LIFT_RB].dir = BACK;
     	motor[LIFT_RB].pwm = 180;
     } else {
-    	motor[LIFT_LB].dir = BRAKE;
-    	motor[LIFT_LB].pwm = 200;
-    	motor[LIFT_RB].dir = BRAKE;
-    	motor[LIFT_RB].pwm = 200;
+    	motor[LIFT_LB].dir = FREE;
+    	motor[LIFT_LB].pwm = 255;
+    	motor[LIFT_RB].dir = BACK;
+    	motor[LIFT_RB].pwm = 10;
     }
     
     
@@ -499,6 +505,7 @@
 static void Process3() 
 {
 	AllActuatorReset();
+	lineFase = 0;
 }
 #endif
 
@@ -514,12 +521,12 @@
 	linePara_L = lineCast(LineHub::GetPara(3));
 	linePara_R = lineCast(LineHub::GetPara(4));
 	
-	if(linePara_U == 'A' && count == 0) {
+	if(linePara_B == 'A' && count == 0) {
 		lineFase = 1;
 	}
 
 	if(lineFase == 0) {
-		pw = 0.55;
+		pw = 0.5;
 		switch(linePara_U) {
 			case -2:
 				x = 5;
@@ -568,51 +575,10 @@
 			count++;
 		}
 	} else if(lineFase == 1) {
-		pw = 0.4;
-		switch(linePara_B) {
-			case -2:
-				x = 5;
-				y = 3;
-				break;
-			case -3:
-				x = 5;
-				y = 3;
-				break;
-			case -1:
-				x = 6;
-				y = 3;
-				break;
-			case 0:
-				x = 7;
-				y = 3;
-				break;
-			case 1:
-				x = 8;
-				y = 3;
-				break;
-			case 3:
-				x = 9;
-				y = 3;
-				break;
-			case 2:
-				x = 9;
-				y = 3;
-				break;
-			case 'A':
-				x = 7;
-				y = 7;
-				break;
-			case 'N':
-				x = 7;
-				y = 7;
-				break;
-				x = 7;
-				y = 7;
-			default:
-				x = 9;
-				y = 9;
-		}
-		if(linePara_R == 0 && linePara_L == 0) {
+		pw = 0.3;
+			x = 7;
+			y = 9;
+		if(linePara_R == 0) {
 			lineFase = 2;
 			x = 7;
 			y = 7;
@@ -669,7 +635,7 @@
 		linePara[i] = lineCast(LineHub::GetPara(i));
 	}
 	
-	static int count = 0;
+	static int count = 100000;
 	count++;
 	
 	if(count < 10000) {
@@ -691,9 +657,9 @@
 				break;
 			case -3:
 				motor[TIRE_FL].dir = FOR;
-				motor[TIRE_BL].dir = FOR;
+				motor[TIRE_BL].dir = BACK;
 				motor[TIRE_BR].dir = BACK;
-				motor[TIRE_FR].dir = BACK;
+				motor[TIRE_FR].dir = FOR;
 				motor[TIRE_FL].pwm = 30;
 				motor[TIRE_FR].pwm = 10;
 				motor[TIRE_BR].pwm = 30;
@@ -701,9 +667,9 @@
 				break;
 			case -1:
 				motor[TIRE_FL].dir = FOR;
-				motor[TIRE_BL].dir = FOR;
+				motor[TIRE_BL].dir = BACK;
 				motor[TIRE_BR].dir = BACK;
-				motor[TIRE_FR].dir = BACK;
+				motor[TIRE_FR].dir = FOR;
 				motor[TIRE_FL].pwm = 30;
 				motor[TIRE_FR].pwm = 20;
 				motor[TIRE_BR].pwm = 30;
@@ -711,9 +677,9 @@
 				break;
 			case 0:
 				motor[TIRE_FL].dir = FOR;
-				motor[TIRE_BL].dir = FOR;
+				motor[TIRE_BL].dir = BACK;
 				motor[TIRE_BR].dir = BACK;
-				motor[TIRE_FR].dir = BACK;
+				motor[TIRE_FR].dir = FOR;
 				motor[TIRE_FL].pwm = 30;
 				motor[TIRE_FR].pwm = 30;
 				motor[TIRE_BR].pwm = 30;
@@ -721,9 +687,9 @@
 				break;
 			case 1:
 				motor[TIRE_FL].dir = FOR;
-				motor[TIRE_BL].dir = FOR;
+				motor[TIRE_BL].dir = BACK;
 				motor[TIRE_BR].dir = BACK;
-				motor[TIRE_FR].dir = BACK;
+				motor[TIRE_FR].dir = FOR;
 				motor[TIRE_FL].pwm = 20;
 				motor[TIRE_FR].pwm = 30;
 				motor[TIRE_BR].pwm = 20;
@@ -751,9 +717,9 @@
 				break;
 			case 'A':
 				motor[TIRE_FL].dir = FOR;
-				motor[TIRE_BL].dir = FOR;
+				motor[TIRE_BL].dir = BACK;
 				motor[TIRE_BR].dir = BACK;
-				motor[TIRE_FR].dir = BACK;
+				motor[TIRE_FR].dir = FOR;
 				motor[TIRE_FL].pwm = 30;
 				motor[TIRE_FR].pwm = 30;
 				motor[TIRE_BR].pwm = 30;