yei

Dependencies:   interface mbed enc_1multi calPID motorout KondoServoLibrary

Fork of cat18_operate by Catch the GIANT Caplico!

main.cpp

Committer:
shimizuta
Date:
2018-07-06
Revision:
1:cc056c41ae30
Parent:
0:c3a72fe24137
Child:
2:4515e8cc6b60

File content as of revision 1:cc056c41ae30:

#include <mbed.h>
#include "debug.h"//DEBUG("",変数);でデバッグ。
#include "state.h"
#include "go.h"
#include "hand.h"
#include "calplace.h"
///setup関連を集めた
void Setups();
void Tests();
WorkPosi work[23];//ワークエリア6箇所+共通エリア17
BoxPosi box[12];
//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;//ワークのところまで行く
        Grab(work[worknum]);
        int boxspace = CalThrowPlace(work[worknum].color);//シュート位置計算
        if(Go(box[boxspace]) != 0) continue;//ボックスに戻る(失敗(-1)したらcontinue)
        Throw();
        box[boxspace].is_placed = 1;//置いたことを保存
    }
}
void Setups()
{
    GoSetup();
}
void Tests()
{
    static int count = 0;
    count ++;
    if (count > 100000) {
        count =0;

    }
}