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-11
Revision:
10:6d1d44fa9739
Parent:
8:cabc50cf3e1e
Child:
13:126c3f7f9b89

File content as of revision 10:6d1d44fa9739:

#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"
//debug用に追加
#include "interface.h"
#include "coordinate.h"
///setup関連を集めた
void Setups();
void Tests();
Interface interface(USBTX, USBRX);
int main()
{
    DEBUG("setup start\r\n");
    Setups();
    //スタート指示受付
    while(CanStart() == 0) {};
    DEBUG("main start");
    InterruptSetup();
    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();

}
void Tests()
{
    static int count = 0;
    count ++;
    if (count > 100000) {
        count =0;
    }
}