yei

Dependencies:   interface mbed enc_1multi calPID motorout KondoServoLibrary

Fork of cat18_operate by Catch the GIANT Caplico!

Committer:
shimizuta
Date:
Thu Aug 09 07:22:46 2018 +0000
Revision:
5:af5ccfce1b90
Parent:
4:187c62291654
Child:
8:cabc50cf3e1e
compile ok

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 2:4515e8cc6b60 6 #include "interrupt.h"
shimizuta 2:4515e8cc6b60 7 #include "position.h"
shimizuta 3:05b1dcb3634e 8 #include "controller.h"
shimizuta 1:cc056c41ae30 9 ///setup関連を集めた
shimizuta 0:c3a72fe24137 10 void Setups();
shimizuta 0:c3a72fe24137 11 void Tests();
shimizuta 1:cc056c41ae30 12
shimizuta 0:c3a72fe24137 13 int main()
shimizuta 0:c3a72fe24137 14 {
shimizuta 0:c3a72fe24137 15 DEBUG("setup start\r\n");
shimizuta 0:c3a72fe24137 16 Setups();
shimizuta 4:187c62291654 17 //スタート指示受付
shimizuta 3:05b1dcb3634e 18 while(CanStart() == 0){};
shimizuta 0:c3a72fe24137 19 DEBUG("main start");
shimizuta 4:187c62291654 20 int worknum = 0;
shimizuta 4:187c62291654 21 while( (worknum = CalPickPlace()) != 23 ) {
shimizuta 4:187c62291654 22 //ワークに向かう
shimizuta 2:4515e8cc6b60 23 if(Go(work[worknum]) != 0) continue;
shimizuta 4:187c62291654 24 //掴む
shimizuta 2:4515e8cc6b60 25 Close();
shimizuta 4:187c62291654 26 //上に持ち上げる
shimizuta 2:4515e8cc6b60 27 Above();
shimizuta 4:187c62291654 28 //取り上げたことを保存
shimizuta 2:4515e8cc6b60 29 work[worknum].is_exist = 0;
shimizuta 4:187c62291654 30 //シュート位置計算
shimizuta 4:187c62291654 31 int boxspace = CalPutPlace(work[worknum].color);
shimizuta 2:4515e8cc6b60 32 //ボックスに行く(失敗(-1)したらcontinue)
shimizuta 2:4515e8cc6b60 33 if(Go(shootingbox[boxspace]) != 0) continue;
shimizuta 4:187c62291654 34 //放す
shimizuta 2:4515e8cc6b60 35 Open();
shimizuta 4:187c62291654 36 //上に持ち上げる
shimizuta 2:4515e8cc6b60 37 Above();
shimizuta 4:187c62291654 38 //置いたことを保存
shimizuta 4:187c62291654 39 shootingbox[boxspace].is_exist = 1;
shimizuta 2:4515e8cc6b60 40 shootingbox[boxspace].color = work[worknum].color;
shimizuta 0:c3a72fe24137 41 }
shimizuta 0:c3a72fe24137 42 }
shimizuta 0:c3a72fe24137 43 void Setups()
shimizuta 0:c3a72fe24137 44 {
shimizuta 1:cc056c41ae30 45 GoSetup();
shimizuta 2:4515e8cc6b60 46 SetupPosition();
shimizuta 2:4515e8cc6b60 47 InterruptSetup();
shimizuta 0:c3a72fe24137 48 }
shimizuta 0:c3a72fe24137 49 void Tests()
shimizuta 0:c3a72fe24137 50 {
shimizuta 0:c3a72fe24137 51 static int count = 0;
shimizuta 0:c3a72fe24137 52 count ++;
shimizuta 0:c3a72fe24137 53 if (count > 100000) {
shimizuta 0:c3a72fe24137 54 count =0;
shimizuta 0:c3a72fe24137 55 }
shimizuta 0:c3a72fe24137 56 }
shimizuta 1:cc056c41ae30 57