yei
Dependencies: interface mbed enc_1multi calPID motorout KondoServoLibrary
Fork of cat18_operate by
Diff: main.cpp
- Revision:
- 20:13934809e117
- Parent:
- 19:48c3af917932
- Child:
- 23:f45eb02433a5
--- a/main.cpp Fri Aug 17 08:47:23 2018 +0000 +++ b/main.cpp Mon Aug 27 03:47:21 2018 +0000 @@ -4,44 +4,36 @@ #include "go.h" #include "servo.h" #include "interrupt.h" -#include "workposition.h" +#include "workinfo.h" #include "controller.h" +#include "calplace.h" //debug用に追加 -#include "interface.h" +//#include "interface.h" #include "coordinate.h" - +//#define FORDEBUG const int kWait_ms = 500; - -//#define FORDEBUG +int worknum = 0; ///setup関連を集めた void Setups(); void Tests(); -Interface interface(USBTX, USBRX); +//Interface interface(USBTX, USBRX); int main() { - DEBUG("setup start\r\n"); Setups(); - //スタート指示受付 - DEBUG("stand by"); + DEBUG("stand by\r\n"); while(CanStart() == 0) {}; - DEBUG("main start"); + DEBUG("main start\r\n"); InterruptSetup(); - int worknum = 0; - #ifdef FORDEBUG for(int i = kCommonStart; i < kCommonStart + kCommonAreaNum - 2; i++) work[i].is_exist = 0; #endif while( (worknum = CalPickPlace()) != 23 ) { Close(); //ワークに向かう - DEBUG("worknum %d, color %d, area %d, position %f, %f, %f\r\n", worknum, work[worknum].color, work[worknum].areaname, work[worknum].position[0],work[worknum].position[1],work[worknum].position[2]); - DEBUG("go to work\r\n"); if(Go(work[worknum]) != 0) continue; - DEBUG("close\r\n"); //掴む Close(); - DEBUG("above\r\n"); wait_ms(kWait_ms); //上に持ち上げる Above(work[worknum].areaname); @@ -49,20 +41,15 @@ //取り上げたことを保存 work[worknum].is_exist = 0; //シュート位置計算 - DEBUG("cal put place\r\n"); int boxspace = CalPutPlace(work[worknum].color); //ボックスに行く(失敗(-1)したらcontinue) - DEBUG("go to box %d\r\n",boxspace); if(Go(shootingbox[boxspace]) != 0) continue; - DEBUG("open\r\n"); //放す Open(); wait_ms(kWait_ms); - DEBUG("above\r\n"); //上に持ち上げる Above(BOX); wait_ms(kWait_ms); - DEBUG("finish\r\n"); //置いたことを保存 shootingbox[boxspace].is_exist = 1; shootingbox[boxspace].color = work[worknum].color; @@ -81,4 +68,4 @@ if (count > 100000) { count =0; } -} \ No newline at end of file +}