yei

Dependencies:   interface mbed enc_1multi calPID motorout KondoServoLibrary

Fork of cat18_operate by Catch the GIANT Caplico!

Committer:
shimizuta
Date:
Thu Aug 09 05:37:04 2018 +0000
Revision:
4:187c62291654
Parent:
3:05b1dcb3634e
Child:
5:af5ccfce1b90
servo ver

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