2015_robocon_bteam / Mbed 2 deprecated 2015robot_main

Dependencies:   PID QEI mbed

Fork of 2015robot_main by Naoto Deguchi

Revision:
89:048a72382b0a
Parent:
88:cbed08732872
Child:
90:9fe39ebe721f
--- a/main_ps3.cpp	Wed Oct 14 10:05:55 2015 +0000
+++ b/main_ps3.cpp	Wed Oct 14 11:45:02 2015 +0000
@@ -81,11 +81,11 @@
             //Blue            
             /********************************Nomal Mode*********************************/
             if(spcount<speed){
-                spcount+=speed/30.0;
+                spcount+=speed/100.0;
                 targ_velocity=spcount;
             }
             if((step==0)&&((8650.0>x)&&(x>850.0))) {
-                targ_sita=0.06;
+                targ_sita=0.035;
                 step=1;
             }
             if((step==1)&&(x>8600.0)) {
@@ -94,9 +94,11 @@
             }
             if((step==2)&&((velocity<500.0)&&(velocity>-500.0))){
                 step=3;
-                targ_velocity=speed;
+                spcount=0.0;
+//                targ_velocity=speed;
                 flagf=0;
-                targ_sita=0.065;
+                targ_sita=0.045;
+//                targ_sita=0.065;
             }
             if((step==3)&&(x<2000.0)) {
                 targ_sita=PI/4;
@@ -131,7 +133,7 @@
             /////////////////////////////////////////////////////////////////////////
             /******************************Middle Mode******************************/
             if((step==5)&&((5700.0>x)&&(x>800.0))) {
-                targ_sita=0.06;
+                targ_sita=0.035;
                 step=6;
             }
             if((step==6)&&(x>7000.0)){
@@ -140,8 +142,9 @@
             }
             if((step==7)&&((velocity<500.0)&&(velocity>-500.0))){
                 flagf=0;
-                targ_velocity=speed;
-                targ_sita=0.065;
+                spcount=0.0;
+//                targ_velocity=speed;
+                targ_sita=0.045;
                 step=8;
             }
             if((step==8)&&(x<1900.0)) {
@@ -164,8 +167,9 @@
             }
             /////////////////////////////////////////////////////////////////////////
             /*****************************Opponents Mode****************************/
-            if((step==15)&&((5700.0>x)&&(x>10.0))) {
-                targ_sita=0.03;
+            if((step==15)&&((5700.0>x)&&(x>70.0))) {
+//                targ_sita=0.03;
+                targ_sita=0.035;
                 step=16;
             }
             if((step==16)&&(x>2800.0)){
@@ -174,21 +178,24 @@
             }
             if((step==17)&&((velocity<500.0)&&(velocity>-500.0))){
                 flagf=0;
-                targ_velocity=speed;
-                targ_sita=0.03;
+                spcount=0.0;
+//                targ_velocity=speed;
+//                targ_sita=0.03;
+                targ_sita=0.045;
                 step=18;
             }
             if((step==18)&&(x<-100.0)){
                 targ_velocity=0.0;
+                targ_sita=PI/4.0;
                 step=114;
-                autoflag=0;
+//                autoflag=0;
             }
             
-            if((x>1350.0)&&(CStep==15)){
+            if((x>950.0)&&(CStep==15)){
                 sendData(1,5);
                 CStep=16;
             }
-            if((x>2750.0)&&(CStep==16)){
+            if((x>2350.0)&&(CStep==16)){
                 sendData(1,4);
                 CStep=114;
             }
@@ -312,6 +319,7 @@
 #endif
             //Swing
 //            swingFollowing();
+            flaga=0;
 #ifdef MESURE
             if(down){
                 IndicatorAuto=0;