Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed HMC6352 US015 TB6612FNG2 getGPS ATP3011
main.cpp
- Committer:
- ushiroji
- Date:
- 2021-10-24
- Revision:
- 3:74d0faefdd78
- Parent:
- 1:f6d4f374b130
- Child:
- 5:56eddb7b4a9e
File content as of revision 3:74d0faefdd78:
#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();
回転();
while(i >= 5) // 5°ずれると方向転換する
{
}
motor(1)
while (True) {
if (FrontGet()) {
MotorDriver(1, 0); //停止()
Avoid();
}
else {
移動();
}
位置情報を取得();
if ((next_CP_x - GPS_x)*(next_CP_x - GPS_x) + (next_CP_y = GPS_y)*(next_CP_y = GPS_y) < 5) { //試験で調整
break;
}
}
// 行動フロー終了
}