yei
Dependencies: interface mbed enc_1multi calPID motorout KondoServoLibrary
Fork of cat18_operate by
main.cpp
- Committer:
- kageyuta
- Date:
- 2018-08-11
- Revision:
- 9:a553ace4d9d1
- Parent:
- 8:cabc50cf3e1e
File content as of revision 9:a553ace4d9d1:
#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" #include "coordinate.h" ///setup関連を集めた void Setups(); void Tests(); Interface interface(USBTX, USBRX); int main() { DEBUG("setup start\r\n"); Setups(); //スタート指示受付 while(CanStart() == 0){}; DEBUG("main start"); for(int i=0;i<23;i++){ DEBUG("work %d : %d\r\n",i,work[i].is_exist); } 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; } }