yei
Dependencies: interface mbed enc_1multi calPID motorout KondoServoLibrary
Fork of cat18_operate by
main.cpp
- Committer:
- shimizuta
- Date:
- 2018-09-02
- Revision:
- 23:f45eb02433a5
- Parent:
- 20:13934809e117
- Child:
- 24:b4a89db4ed72
File content as of revision 23:f45eb02433a5:
#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" #include "check.h" //debug用に追加 //#include "interface.h" #include "coordinate.h" //#define FORDEBUG const int kWait_ms = 500; int worknum = 0; ///setup関連を集めた.成功:0, エラー:-1 int Setups(); void Tests(); //Interface interface(USBTX, USBRX); int main() { if(Setups() == -1) return 1; //スタート指示受付 DEBUG("stand by\r\n"); if(WasLoad() == 0) { wait(1); while(CanStart() == 0) {}; } DEBUG("main start\r\n"); InterruptSetup(); ControllerSetup(); 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; } } int Setups() { int is_error = 0; GoSetup(); SetupPosition(); if(PositionSetupIsInBan() == 1) is_error = -1; StartCheck(); return is_error; } void Tests() { static int count = 0; count ++; if (count > 100000) { count =0; } }