2015_robocon_bteam / Mbed 2 deprecated 2015robot_main

Dependencies:   PID QEI mbed

Fork of 2015robot_main by Naoto Deguchi

Revision:
66:14df82661dfa
Parent:
65:cebdfc0184d7
Child:
68:2b2b88ecdcce
Child:
70:5b8ed76a31c7
--- a/main_ps3.cpp	Mon Oct 05 07:53:02 2015 +0000
+++ b/main_ps3.cpp	Wed Oct 07 09:01:34 2015 +0000
@@ -3,10 +3,8 @@
  */
 
 //速度コントローラと向きコントローラはそのまま
-//変更前のこのプログラムで実験
-//後で関数のinline宣言を外す
-//大和田に最後にPIC1から信号を送り射角を変えるプログラムをに書かせる
 //大和田にPIC1のシリンダの信号をタイマーで書かせる
+//回転機構wait PI/4 追加で待つ
 
 /***コース選択***/
 #define BLUE
@@ -50,10 +48,7 @@
     Enable=1;
 //    FILE *fp_r = fopen("/local/velocity.dat", "w");
     wait(0.3);
-    sendData(4,31);
-    wait(0.1);
-    sendData(5,31);
-    wait(0.1);
+    sendData(7,31);
 //    double time=0.0;
     while(1) {
         if(autoflag){
@@ -66,25 +61,33 @@
             //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; /*nomal*/
-            if((step==0)&&((8650.0>x)&&(x>1000.0))) targ_sita=0.015,step=1; /*nomal*/
+            if((step==0)&&((8650.0>x)&&(x>900.0))) targ_sita=0.015,step=1; /*nomal*/
             if((step==1)&&(x>8650.0)) targ_velocity=-speed,step=2,flagf=0;
-            if((step==2)&&(x<2000.0)) targ_sita=PI/4,step=3;
-            if((step==3)&&(x<10.0)) targ_velocity=0.0,step=8;
+            if((step==2)&&(x<1950.0)) {
+                targ_sita=PI/4;
+                step=3;
+                sendData(7,31);
+            }
+            if((step==3)&&(x<70.0)) targ_velocity=0.0,step=8;
             
-            if((step==4)&&((5700.0>x)&&(x>600.0))) targ_sita=0.015,step=5; /*middle*/
-            if((step==5)&&(x>4850.0)) { /*middle shoot*/
+            if((step==4)&&((5700.0>x)&&(x>900.0))) targ_sita=0.015,step=5; /*middle*/
+            if((step==5)&&(x>5000.0)) { /*middle shoot*/
                 targ_velocity=-speed;
                 step=6;
                 sendData(1,5);
                 flagf=0;
             }
-            if((step==6)&&(x<1650.0)) targ_sita=PI/4,step=7;
-            if((step==7)&&(x<10.0)) targ_velocity=0.0,step=8;
+            if((step==6)&&(x<1750.0)) {
+                targ_sita=PI/4;
+                step=7;
+                sendData(7,31);
+            }
+            if((step==7)&&(x<70.0)) targ_velocity=0.0,step=8;
             
-            if((x>3000.0)&&(CStep==1)) CStep=2,sendData(1,1); /*nomal*/
-            if((x>6000.0)&&(CStep==2)) CStep=3,sendData(1,2);
-            if((x>7500.0)&&(CStep==3)) CStep=4,sendData(1,3);
-            if((x<6550.0)&&(CStep==4)) CStep=5,sendData(1,5);
+            if((x>2900.0)&&(CStep==1)) CStep=2,sendData(1,1); /*nomal*/
+            if((x>5850.0)&&(CStep==2)) CStep=3,sendData(1,2);
+            if((x>7600.0)&&(CStep==3)) CStep=4,sendData(1,3);
+            if((x<6500.0)&&(CStep==4)) CStep=5,sendData(1,5);
             if((x<6100.0)&&(CStep==5)) CStep=6,sendData(1,4);
             
             /*if((x>3344.0)&&(CStep==1)) CStep=2,sendData(1,1);
@@ -114,7 +117,7 @@
             if((x>7885.0)&&(CStep==3)) CStep=4,sendData(1,2);
             if((x<6700.0)&&(CStep==4)) CStep=5,sendData(1,4);
             if((x<6300.0)&&(CStep==5)) CStep=6,sendData(1,5);
-#endif            
+#endif
             move_following();
         }
         else if(!autoflag) {
@@ -126,7 +129,7 @@
             manualPS3();       /*PS3 button*/
 #endif
             //Swing
-//            swingFollowing();
+            swingFollowing();
             /*if(square){
                 IndicatorAuto=0;
                 fclose(fp_r);