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-05
Revision:
2:4515e8cc6b60
Parent:
1:cc056c41ae30
Child:
3:05b1dcb3634e

File content as of revision 2:4515e8cc6b60:

#include <mbed.h>
#include "debug.h"//DEBUG("",変数);でデバッグ。
#include "state.h"
#include "go.h"
#include "hand.h"
#include "calplace.h"
#include "interrupt.h"
#include "position.h"
///setup関連を集めた
void Setups();
void Tests();
//const int kWorkNum = 12;//ワークの数

int main()
{
    DEBUG("setup start\r\n");
    Setups();
    DEBUG("main start");
    while(1) {
        int worknum = CalPickPlace();//目標ワーク計算
        //ワークのところまで行く。腕も準備
        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;
    }
}