yei

Dependencies:   interface mbed enc_1multi calPID motorout KondoServoLibrary

Fork of cat18_operate by Catch the GIANT Caplico!

main.cpp

Committer:
shimizuta
Date:
2018-08-09
Revision:
5:af5ccfce1b90
Parent:
4:187c62291654
Child:
8:cabc50cf3e1e

File content as of revision 5:af5ccfce1b90:

#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"
///setup関連を集めた
void Setups();
void Tests();

int main()
{
    DEBUG("setup start\r\n");
    Setups();
    //スタート指示受付
    while(CanStart() == 0){};
    DEBUG("main start");
    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;
    }
}