2015_robocon_bteam / Mbed 2 deprecated 2015robot_main

Dependencies:   PID QEI mbed

Fork of 2015robot_main by Naoto Deguchi

Revision:
102:e483c7453f52
Parent:
101:b67d33e56b66
--- a/main_ps3.cpp	Sat Oct 17 06:04:49 2015 +0000
+++ b/main_ps3.cpp	Sat Oct 17 09:53:52 2015 +0000
@@ -160,7 +160,7 @@
                 sendData(1,5);
                 CStep=8;
             }
-            if((x>5720.0)&&(CStep==8)){
+            if((x>5820.0)&&(CStep==8)){
                 sendData(1,4);
                 CStep=9;
             }
@@ -170,22 +170,28 @@
             }
             /////////////////////////////////////////////////////////////////////////
             /*****************************Opponents Mode****************************/
-            if((step==15)&&((5700.0>x)&&(x>50.0))) {
+            if(dspeed>0.0){
+                dspeed-=speed/50.0;
+                targ_velocity=dspeed;
+            }
+            if((step==15)&&((5700.0>x)&&(x>60.0))) {
                 targ_sita=0.025;
                 step=16;
             }
 //            if((step==16)&&(x>3200.0)){
-            if((step==16)&&(x>2850.0)){
-//            if((step==16)&&(x>1350.0)){
+//            if((step==16)&&(x>2850.0)){
+            if((step==16)&&(x>1520.0)){
                 targ_velocity=0.0;
+//                dspeed=speed;
                 step=17;
             }
-            if((step==17)&&((velocity<5000.0)&&(velocity>-5000.0))){
-//            if((step==17)&&((velocity<10.0)&&(velocity>-10.0))){
+//            if((step==17)&&((velocity<5000.0)&&(velocity>-5000.0))){
+            if((step==17)&&((velocity<1000.0)&&(velocity>-1000.0))){
                 flagf=0;
                 spcount=0.0;
                 targ_sita=0.035;
                 step=18;
+                dspeed=0.0;
             }
             if((step==18)&&(x<-100.0)){
                 targ_velocity=0.0;
@@ -193,15 +199,19 @@
                 step=114;
             }
             
-            if((x>1350.0)&&(CStep==15)){
+            if((x>1570.0)&&(CStep==15)){
                 sendData(1,5);
                 CStep=16;
             }
-            if((x>2550.0)&&(CStep==16)){
+            if((x<1300.0)&&(CStep==16)){
+                sendData(7,255);
+                CStep=114;
+            }
+            /*if((x>3000.0)&&(CStep==16)){
                 sendData(1,4);
                 CStep=17;
             }
-            /*if((x<1000.0)&&(CStep==17)){
+            if((x<1300.0)&&(CStep==17)){
                 sendData(7,255);
                 CStep=114;
             }*/