yei
Dependencies: interface mbed enc_1multi calPID motorout KondoServoLibrary
Fork of cat18_operate by
main.cpp
- Committer:
- shimizuta
- Date:
- 2018-08-27
- Revision:
- 20:13934809e117
- Parent:
- 19:48c3af917932
- Child:
- 23:f45eb02433a5
File content as of revision 20:13934809e117:
#include <mbed.h> #include "debug.h"//DEBUG("",変数);でデバッグ。 #include "state.h" #include "go.h" #include "servo.h" #include "interrupt.h" #include "workinfo.h" #include "controller.h" #include "calplace.h" //debug用に追加 //#include "interface.h" #include "coordinate.h" //#define FORDEBUG const int kWait_ms = 500; int worknum = 0; ///setup関連を集めた void Setups(); void Tests(); //Interface interface(USBTX, USBRX); int main() { Setups(); //スタート指示受付 DEBUG("stand by\r\n"); while(CanStart() == 0) {}; DEBUG("main start\r\n"); InterruptSetup(); #ifdef FORDEBUG for(int i = kCommonStart; i < kCommonStart + kCommonAreaNum - 2; i++) work[i].is_exist = 0; #endif while( (worknum = CalPickPlace()) != 23 ) { Close(); //ワークに向かう if(Go(work[worknum]) != 0) continue; //掴む Close(); wait_ms(kWait_ms); //上に持ち上げる Above(work[worknum].areaname); wait_ms(kWait_ms); //取り上げたことを保存 work[worknum].is_exist = 0; //シュート位置計算 int boxspace = CalPutPlace(work[worknum].color); //ボックスに行く(失敗(-1)したらcontinue) if(Go(shootingbox[boxspace]) != 0) continue; //放す Open(); wait_ms(kWait_ms); //上に持ち上げる Above(BOX); wait_ms(kWait_ms); //置いたことを保存 shootingbox[boxspace].is_exist = 1; shootingbox[boxspace].color = work[worknum].color; } } void Setups() { GoSetup(); SetupPosition(); StartCheck(); } void Tests() { static int count = 0; count ++; if (count > 100000) { count =0; } }