yei

Dependencies:   interface mbed enc_1multi calPID motorout KondoServoLibrary

Fork of cat18_operate by Catch the GIANT Caplico!

Committer:
shimizuta
Date:
Mon Aug 06 04:30:05 2018 +0000
Revision:
3:05b1dcb3634e
Parent:
2:4515e8cc6b60
Child:
4:187c62291654
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 3:05b1dcb3634e 5 #include "servo.h"
shimizuta 1:cc056c41ae30 6 #include "calplace.h"
shimizuta 2:4515e8cc6b60 7 #include "interrupt.h"
shimizuta 2:4515e8cc6b60 8 #include "position.h"
shimizuta 3:05b1dcb3634e 9 #include "controller.h"
shimizuta 1:cc056c41ae30 10 ///setup関連を集めた
shimizuta 0:c3a72fe24137 11 void Setups();
shimizuta 0:c3a72fe24137 12 void Tests();
shimizuta 1:cc056c41ae30 13 //const int kWorkNum = 12;//ワークの数
shimizuta 1:cc056c41ae30 14
shimizuta 0:c3a72fe24137 15 int main()
shimizuta 0:c3a72fe24137 16 {
shimizuta 0:c3a72fe24137 17 DEBUG("setup start\r\n");
shimizuta 0:c3a72fe24137 18 Setups();
shimizuta 3:05b1dcb3634e 19 while(CanStart() == 0){};
shimizuta 0:c3a72fe24137 20 DEBUG("main start");
shimizuta 0:c3a72fe24137 21 while(1) {
shimizuta 1:cc056c41ae30 22 int worknum = CalPickPlace();//目標ワーク計算
shimizuta 2:4515e8cc6b60 23 //ワークのところまで行く。腕も準備
shimizuta 2:4515e8cc6b60 24 if(Go(work[worknum]) != 0) continue;
shimizuta 2:4515e8cc6b60 25 Close();
shimizuta 2:4515e8cc6b60 26 Above();
shimizuta 2:4515e8cc6b60 27 work[worknum].is_exist = 0;
shimizuta 2:4515e8cc6b60 28 int boxspace = CalPutPlace(work[worknum].color);//シュート位置計算
shimizuta 2:4515e8cc6b60 29 //ボックスに行く(失敗(-1)したらcontinue)
shimizuta 2:4515e8cc6b60 30 if(Go(shootingbox[boxspace]) != 0) continue;
shimizuta 2:4515e8cc6b60 31 Open();
shimizuta 2:4515e8cc6b60 32 Above();
shimizuta 2:4515e8cc6b60 33 shootingbox[boxspace].is_exist = 1;//置いたことを保存
shimizuta 2:4515e8cc6b60 34 shootingbox[boxspace].color = work[worknum].color;
shimizuta 0:c3a72fe24137 35 }
shimizuta 0:c3a72fe24137 36 }
shimizuta 0:c3a72fe24137 37 void Setups()
shimizuta 0:c3a72fe24137 38 {
shimizuta 1:cc056c41ae30 39 GoSetup();
shimizuta 2:4515e8cc6b60 40 SetupPosition();
shimizuta 2:4515e8cc6b60 41 InterruptSetup();
shimizuta 0:c3a72fe24137 42 }
shimizuta 0:c3a72fe24137 43 void Tests()
shimizuta 0:c3a72fe24137 44 {
shimizuta 0:c3a72fe24137 45 static int count = 0;
shimizuta 0:c3a72fe24137 46 count ++;
shimizuta 0:c3a72fe24137 47 if (count > 100000) {
shimizuta 0:c3a72fe24137 48 count =0;
shimizuta 0:c3a72fe24137 49 }
shimizuta 0:c3a72fe24137 50 }
shimizuta 1:cc056c41ae30 51