yei

Dependencies:   interface mbed enc_1multi calPID motorout KondoServoLibrary

Fork of cat18_operate by Catch the GIANT Caplico!

Revision:
38:9bed85d32c97
Parent:
37:d4b711619962
Child:
39:ac2d5ae81fc1
diff -r d4b711619962 -r 9bed85d32c97 main.cpp
--- a/main.cpp	Wed Sep 05 09:37:41 2018 +0000
+++ b/main.cpp	Thu Sep 06 03:37:20 2018 +0000
@@ -13,33 +13,27 @@
 #include "coordinate.h"
 //#define DEBUG_MODE
 const int kWait_ms = 500;
-const double kServoOffsetDegreeInBox = 10;
-
+const double kServoOffsetDegreeInBox = 5;
 
 int worknum = 0;
 int main()
 {
-
-    GoSetup();
-    GoToFirstPosition();
-    SetupPosition();
-    if(PositionSetupIsInBan() == 1) return 1;//失敗したら強制終了
-
-    //スタート指示受付
-    DEBUG("stand by\r\n");
-    while(CanStart() == 0) {};
+    GoSetup();//encoder等のsetup
+    SetupPosition();//ワークの位置設定
+    if(PositionSetupIsInBan() == 1) return 1;//ワーク位置が禁止領域に入っていたら強制終了
+    GoToFirstPosition();//機体をスタート位置に持っていく
+    DEBUG("stand by. Please put pattern button.\r\n");
+    while(PermitStart() == 0) {};//スタート指示受付
     DEBUG("main start\r\n");
     InterruptSetup();
-    ControllerSetup();
-    while((worknum = CalPickPlace()) != 23 ) {
-        Close();
-        //ワークに向かう
+    while((worknum = CalPickPlace()) != 23 ) {//取るワーク計算.23は番兵
+        //ワークに向かう.-1でスキップ
         if(Go(work[worknum]) == -1) {
             work[worknum].is_exist = 0;
             continue;
         }
+        wait_ms(kWait_ms);
         //掴む
-        wait_ms(kWait_ms);
         Close();
         wait_ms(kWait_ms);
         //上に持ち上げる
@@ -52,10 +46,10 @@
         OriginDegree[0] = kOriginDegree[0] - kServoOffsetDegreeInBox;
         //ボックスに行く(失敗(-1)したらcontinue)
         //3のときだけ特別に速度下げる
-        if(worknum == 3) kServoVelocity_mm = 100;
+        if(worknum == 0) servo_dist_mm = 200 * kCalTargetTicker_s;
         if(Go(shootingbox[boxspace]) != 0) continue;
-        ManualPutPlace(shootingbox[boxspace]);
-        kServoVelocity_mm = 300;
+        servo_dist_mm = kServoVelocity_mm* kCalTargetTicker_s ;//
+        ManualPutPlace(shootingbox[boxspace], 15);
         //放す
         Open();
         wait_ms(kWait_ms);