2015_robocon_bteam / Mbed 2 deprecated 2015robot_main

Dependencies:   PID QEI mbed

Fork of 2015robot_main by Naoto Deguchi

Revision:
61:e018207ae860
Parent:
60:4a75f3f3a934
Child:
62:02a44f5bc51e
diff -r 4a75f3f3a934 -r e018207ae860 main_ps3.cpp
--- a/main_ps3.cpp	Fri Oct 02 07:24:52 2015 +0000
+++ b/main_ps3.cpp	Sat Oct 03 00:52:21 2015 +0000
@@ -27,8 +27,7 @@
 Serial pc(USBTX, USBRX);
 //LocalFileSystem local("local");
 
-int main()
-{
+int main() {
 #ifdef IM920
     initializeIM920();
 #else
@@ -63,17 +62,27 @@
 #ifdef BLUE
             //Blue            
 //            if((step==0)&&((8650.0>x)&&(x>1400.0))) targ_sita=0.0,step=1;
-            if((step==0)&&((8650.0>x)&&(x>1400.0))) targ_sita=0.015,step=1;
+            if((step==0)&&((8650.0>x)&&(x>1400.0))) targ_sita=0.015,step=1; /*nomal*/
             if((step==1)&&(x>8650.0)) targ_velocity=-speed,step=2;
             if((step==2)&&(x<2000.0)) targ_sita=PI/4,step=3;
-            if((step==3)&&(x<10.0)) targ_velocity=0.0,step=4;
+            if((step==3)&&(x<10.0)) targ_velocity=0.0,step=8;
             
-            if((x>3344.0)&&(CStep==1)) CStep=2,sendData(1,1);
+            if((step==4)&&((5700.0>x)&&(x>700.0))) targ_sita=0.015,step=5; /*middle*/
+            if((step==5)&&(x>5300.0)) { /*middle shoot*/
+                targ_velocity=-speed;
+                step=6;
+                sendData(1,5);
+            }
+            if((step==6)&&(x<2000.0)) targ_sita=PI/4,step=7;
+            if((step==7)&&(x<10.0)) targ_velocity=0.0,step=8;
+            
+            
+            if((x>3344.0)&&(CStep==1)) CStep=2,sendData(1,1); /*nomal*/
             if((x>6234.0)&&(CStep==2)) CStep=3,sendData(1,2);
             if((x>7885.0)&&(CStep==3)) CStep=4,sendData(1,3);
-//            if((x<6750.0)&&(CStep==4)) CStep=5,sendData(1,5);
-//            if((x<6300.0)&&(CStep==5)) CStep=6,sendData(1,4);
-            if((x<6000.0)&&(CStep==4)) CStep=5,sendData(1,5);
+            if((x<6750.0)&&(CStep==4)) CStep=5,sendData(1,5);
+            if((x<6300.0)&&(CStep==5)) CStep=7,sendData(1,4);
+
 #else
             //Red
             if((step==0)&&((8650.0>x)&&(x>1400.0))) targ_sita=0.0,step=1;