yei
Dependencies: interface mbed enc_1multi calPID motorout KondoServoLibrary
Fork of cat18_operate by
main.cpp
- Committer:
- shimizuta
- Date:
- 2018-08-10
- Revision:
- 8:cabc50cf3e1e
- Parent:
- 5:af5ccfce1b90
- Child:
- 9:a553ace4d9d1
- Child:
- 10:6d1d44fa9739
File content as of revision 8:cabc50cf3e1e:
#include <mbed.h> #include "debug.h"//DEBUG("",変数);でデバッグ。 #include "state.h" #include "go.h" #include "servo.h" #include "interrupt.h" #include "position.h" #include "controller.h" #include "interface.h" ///setup関連を集めた void Setups(); void Tests(); Interface interface(USBTX, USBRX); int main() { DEBUG("setup start\r\n"); Setups(); //スタート指示受付 while(CanStart() == 0){}; DEBUG("main start"); int worknum = 0; while( (worknum = CalPickPlace()) != 23 ) { //ワークに向かう if(Go(work[worknum]) != 0) continue; //掴む Close(); //上に持ち上げる Above(); //取り上げたことを保存 work[worknum].is_exist = 0; //シュート位置計算 int boxspace = CalPutPlace(work[worknum].color); //ボックスに行く(失敗(-1)したらcontinue) if(Go(shootingbox[boxspace]) != 0) continue; //放す Open(); //上に持ち上げる Above(); //置いたことを保存 shootingbox[boxspace].is_exist = 1; shootingbox[boxspace].color = work[worknum].color; } } void Setups() { GoSetup(); SetupPosition(); InterruptSetup(); } void Tests() { static int count = 0; count ++; if (count > 100000) { count =0; } }