2015_robocon_bteam / Mbed 2 deprecated 2015robot_main

Dependencies:   PID QEI mbed

Fork of 2015robot_main by Naoto Deguchi

Revision:
85:dd18a2d79956
Parent:
84:919a335ac81e
Child:
86:5f0b065cb4d3
--- a/main_ps3.cpp	Mon Oct 12 07:42:49 2015 +0000
+++ b/main_ps3.cpp	Tue Oct 13 07:27:26 2015 +0000
@@ -12,6 +12,7 @@
 //flagfで前進・後退切り替え
 //大和田射角
 //午後に一定回転制御の実験
+//モード切替時に時間を待つ
 
 /***コース選択***/
 #define BLUE
@@ -80,7 +81,7 @@
             //Blue            
             /********************************Nomal Mode*********************************/
             if((step==0)&&((8650.0>x)&&(x>850.0))) {
-                targ_sita=0.08;
+                targ_sita=0.06;
                 step=1;
             }
             if((step==1)&&(x>8600.0)) {
@@ -91,28 +92,28 @@
                 step=3;
                 targ_velocity=speed;
                 flagf=0;
-                targ_sita=0.07;
+                targ_sita=0.065;
             }
             if((step==3)&&(x<1950.0)) {
                 targ_sita=PI/4;
                 step=4;
                 sendData(7,255);
             }
-            if((step==4)&&(x<-100.0)) {
+            if((step==4)&&(x<0.0)) {
                 targ_velocity=0.0;
                 step=114;
             }
             /***Cylinder***/
-            if((x>2950.0)&&(CStep==1)) { /*nomal*/
+            if((x>3000.0)&&(CStep==1)) { /*nomal*/
                 if(!skip) sendData(1,1);
                 CStep=2; 
             }
-            if((x>5880.0)&&(CStep==2)) {
-                if(!skip) sendData(1,2);
+            if((x>5930.0)&&(CStep==2)) {
+                if(!skip) sendData(1,3);
                 CStep=3;
             }
             if((x>7600.0)&&(CStep==3)) {
-                if(!skip) sendData(1,3);
+                if(!skip) sendData(1,2);
                 CStep=4;
             }
             if((x<6600.0)&&(CStep==4)) {
@@ -126,7 +127,7 @@
             /////////////////////////////////////////////////////////////////////////
             /******************************Middle Mode******************************/
             if((step==5)&&((5700.0>x)&&(x>800.0))) {
-                targ_sita=0.08;
+                targ_sita=0.06;
                 step=6;
             }
             if((step==6)&&(x>7000.0)){
@@ -136,7 +137,7 @@
             if((step==7)&&(abs(velocity)<1000.0)) {
                 flagf=0;
                 targ_velocity=speed;
-                targ_sita=0.07;
+                targ_sita=0.065;
                 step=8;
             }
             if((step==8)&&(x<1900.0)) {
@@ -144,16 +145,16 @@
                 step=9;
                 sendData(7,255);
             }
-            if((step==9)&&(x<-100.0)) {
+            if((step==9)&&(x<-10.0)) {
                 targ_velocity=0.0;
                 step=114;
             }
             
-            if((x>4850.0)&&(CStep==6)){
+            if((x>4750.0)&&(CStep==6)){
                 sendData(1,5);
                 CStep=7;
             }
-            if((x>5350.0)&&(CStep==7)){
+            if((x>5750.0)&&(CStep==7)){
                 sendData(1,4);
                 CStep=114;
             }
@@ -170,7 +171,7 @@
             if((step==17)&&(abs(velocity)<1000.0)){
                 flagf=0;
                 targ_velocity=speed;
-                targ_sita=-0.07;
+                targ_sita=0.03;
                 step=18;
             }
             if((step==18)&&(x<-100.0)){
@@ -179,8 +180,12 @@
                 autoflag=0;
             }
             
-            if((x>2700.0)&&(CStep==15)){
+            if((x>1550.0)&&(CStep==15)){
                 sendData(1,5);
+                CStep=16;
+            }
+            if((x>2700.0)&&(CStep==16)){
+                sendData(1,4);
                 CStep=114;
             }
             /////////////////////////////////////////////////////////////////////////
@@ -188,7 +193,7 @@
             //Red
             /********************************Nomal Mode*********************************/
             if((step==0)&&((8650.0>x)&&(x>800.0))) {
-                targ_sita=-0.08;
+                targ_sita=-0.05;
                 step=1; 
             }
             if((step==1)&&(x>8600.0)) {
@@ -216,11 +221,11 @@
                 CStep=2;
             }
             if((x>5850.0)&&(CStep==2)) {
-                if(!skip) sendData(1,3);
+                if(!skip) sendData(1,2);
                 CStep=3;
             }
             if((x>7600.0)&&(CStep==3)) {
-                if(!skip) sendData(1,2);
+                if(!skip) sendData(1,3);
                 CStep=6;
             }
             if((x<6650.0)&&(CStep==4)) {