yei

Dependencies:   interface mbed enc_1multi calPID motorout KondoServoLibrary

Fork of cat18_operate by Catch the GIANT Caplico!

Committer:
shimizuta
Date:
Fri Jul 06 02:53:59 2018 +0000
Revision:
1:cc056c41ae30
Parent:
0:c3a72fe24137
Child:
2:4515e8cc6b60
a;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
shimizuta 0:c3a72fe24137 1 #include <mbed.h>
shimizuta 0:c3a72fe24137 2 #include "debug.h"//DEBUG("",変数);でデバッグ。
shimizuta 1:cc056c41ae30 3 #include "state.h"
shimizuta 1:cc056c41ae30 4 #include "go.h"
shimizuta 1:cc056c41ae30 5 #include "hand.h"
shimizuta 1:cc056c41ae30 6 #include "calplace.h"
shimizuta 1:cc056c41ae30 7 ///setup関連を集めた
shimizuta 0:c3a72fe24137 8 void Setups();
shimizuta 0:c3a72fe24137 9 void Tests();
shimizuta 1:cc056c41ae30 10 WorkPosi work[23];//ワークエリア6箇所+共通エリア17
shimizuta 1:cc056c41ae30 11 BoxPosi box[12];
shimizuta 1:cc056c41ae30 12 //const int kWorkNum = 12;//ワークの数
shimizuta 1:cc056c41ae30 13
shimizuta 0:c3a72fe24137 14 int main()
shimizuta 0:c3a72fe24137 15 {
shimizuta 0:c3a72fe24137 16 DEBUG("setup start\r\n");
shimizuta 0:c3a72fe24137 17 Setups();
shimizuta 0:c3a72fe24137 18 DEBUG("main start");
shimizuta 0:c3a72fe24137 19 while(1) {
shimizuta 1:cc056c41ae30 20 int worknum = CalPickPlace();//目標ワーク計算
shimizuta 1:cc056c41ae30 21 if(Go(work[worknum]) != 0) continue;//ワークのところまで行く
shimizuta 1:cc056c41ae30 22 Grab(work[worknum]);
shimizuta 1:cc056c41ae30 23 int boxspace = CalThrowPlace(work[worknum].color);//シュート位置計算
shimizuta 1:cc056c41ae30 24 if(Go(box[boxspace]) != 0) continue;//ボックスに戻る(失敗(-1)したらcontinue)
shimizuta 1:cc056c41ae30 25 Throw();
shimizuta 1:cc056c41ae30 26 box[boxspace].is_placed = 1;//置いたことを保存
shimizuta 0:c3a72fe24137 27 }
shimizuta 0:c3a72fe24137 28 }
shimizuta 0:c3a72fe24137 29 void Setups()
shimizuta 0:c3a72fe24137 30 {
shimizuta 1:cc056c41ae30 31 GoSetup();
shimizuta 0:c3a72fe24137 32 }
shimizuta 0:c3a72fe24137 33 void Tests()
shimizuta 0:c3a72fe24137 34 {
shimizuta 0:c3a72fe24137 35 static int count = 0;
shimizuta 0:c3a72fe24137 36 count ++;
shimizuta 0:c3a72fe24137 37 if (count > 100000) {
shimizuta 0:c3a72fe24137 38 count =0;
shimizuta 0:c3a72fe24137 39
shimizuta 0:c3a72fe24137 40 }
shimizuta 0:c3a72fe24137 41 }
shimizuta 1:cc056c41ae30 42