ループのテスト

Dependencies:   ATP3012 mbed TB6612FNG HMC6352 US015 getGPS

main.cpp

Committer:
ushiroji
Date:
2021-10-24
Revision:
5:56eddb7b4a9e
Parent:
3:74d0faefdd78
Child:
6:1cda8471adc3

File content as of revision 5:56eddb7b4a9e:

#include "mbed.h"
#include "TB6612.h"
#include "ATP3011.h" 
#include "getGPS.h"
#include "HMC6352.h"
#include "Avoid.h"
#include "FrontGet.h"
#include "AngleGet.h"


int main() {
    // 変数宣言
    int CP_num;           // CPリストのインデックス
int last_num;         // CPリストの最後の要素のインデックス
double GPS_x, GPS_y;  // 現在地の座標
double *pGPS_x = &GPS_x, *pGPS_y = &GPS_y;
double direction;     // 次CPへの向き
double CPs_x[100];  // = [];  //CPリスト(x座標)
double CPs_y[100];  // = [];  // CPリスト(y座標)
double next_CP_x, next_CP_y;

// 行動フロー開始
last_num = sizeof(CPs_x) / sizeof(double) - 1;
while (next_CP_x != CPs_x[last_num] && next_CP_y != CPs_y[last_num]) {
    int i;
    for (i = CP_num; last_num; i++) {
    // 移動
    catchGPS();
    AngleGet();
    回転();

    motor(1)
    while (True) {
        if (FrontGet()) {
            MotorDriver(1, 0);      //停止()
            MotorDriver(4, 0.5);    //回転
            continue;
        }
        else {
            移動();
        }
        位置情報を取得();
        if ((next_CP_x - GPS_x)*(next_CP_x - GPS_x) + (next_CP_y = GPS_y)*(next_CP_y = GPS_y) < 5) {    //試験で調整
        break;
        }
    }
        // 行動フロー終了
}