Tk A / Mbed 2 deprecated f3rc2

Dependencies:   mbed

Fork of f3rc2 by 涼太郎 中村

Revision:
0:df2659fd8031
Child:
1:a1e592eca305
diff -r 000000000000 -r df2659fd8031 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun Aug 28 17:03:34 2016 +0000
@@ -0,0 +1,130 @@
+//受渡前での妨害に対応したい
+
+#include"header.h"
+
+int main(void){
+    
+    
+    move(0,0);
+    close_arm();
+    /*以下redteamのフィールドマップを読み込む(mm)
+    
+    blue team の場合はすべてのy座標に(-1)をかける
+    
+    */
+        
+    //オブジェクトの位置
+    //原点はスタートゾーンの中心
+    int targetx[9] = { 600,600,600,1200,900,1200,900,1200,900 };
+    int targety[9] = { blue()*300,blue()*600,blue()*900,blue()*1200,blue()*900,blue()*600,blue()*600,0,blue()*300 };
+    
+    //ハブの位置
+    int hub1x = 600;
+    int hub1y = 0;
+
+    int hub2x = 900;
+    int hub2y = 0;
+
+
+    int goalx = 0, goaly = blue()*1200;//受け渡しゾーンの中心
+    //定義終了
+    
+    int retry=0;        
+    
+    
+    //ここでretryに数値を代入
+            
+    switch(retry){
+        case 0:
+            open_hand();
+            moveto(hub1x, hub1y);
+        
+            moveto(targetx[0], targety[0]);
+            close_hand();
+            lift(1);
+    
+        case 1:
+            open_hand();
+            moveto(targetx[1], targety[1]);
+            close_hand();
+            lift(1);
+    
+        case 2:
+            open_hand();
+            moveto(targetx[2], targety[2]);
+            close_hand();
+    
+            moveto(goalx,goaly);
+            open_arm();
+            release();
+            back();
+            //3つリリースした
+        case 3:
+            open_arm();
+            open_hand();
+            moveto(targetx[3], targety[3]);
+            close_arm();
+            close_hand();
+            lift(2);
+    
+        case 4:
+            open_hand();
+            moveto(targetx[4], targety[4]);
+            close_hand();
+    
+            moveto(goalx,goaly);
+            open_arm();
+            release();
+            back();
+            //3つリリースした
+    
+        case 5:
+            moveto(targetx[3], targety[3]);//ハブとして利用
+    
+            open_arm();
+            open_hand();
+            moveto(targetx[5], targety[5]);
+            
+            close_arm();
+            close_hand();
+            lift(2);
+    
+        case 6:
+            open_hand();
+            moveto(targetx[6], targety[6]);
+            close_hand();
+    
+    
+            moveto(goalx,goaly);
+            open_arm();
+            release();
+    
+            back();
+    
+        case 7:
+            moveto(targetx[3], targety[3]);//ハブとして利用
+    
+            open_arm();
+            open_hand();
+            moveto(targetx[7], targety[7]);
+            close_hand();
+            lift(2);
+    
+            moveto(hub2x, hub2y);
+    
+        case 8:
+            open_hand();
+            moveto(targetx[8], targety[8]);
+            close_hand();
+    
+    
+            moveto(goalx,goaly);
+            open_arm();
+    
+            back();
+    
+            moveto(1800,blue()*1200);//invade
+    
+            return 0;//終了
+    }
+}
\ No newline at end of file