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: ATP3012 mbed a HMC US015_2 getGPS
Diff: main.cpp
- Revision:
- 10:e25e06011fd2
- Parent:
- 9:c96ceecb43e1
- Child:
- 11:d00bfdcb7481
--- a/main.cpp Thu Dec 09 08:52:12 2021 +0000
+++ b/main.cpp Thu Dec 09 10:31:34 2021 +0000
@@ -8,27 +8,27 @@
DigitalIn flight_pin(A0);
DigitalOut nichrome(D13);
//
-#define cp_max 3 //CPの数を入力する
+#define cp_max 2 //CPの数を入力する
int main() {
// 変数宣言
double GPS_x, GPS_y; // 現在地の座標
double direction; // 次CPへの向き
- double CPs_x[3]={34.54608391847546, 34.545845666047306, 34.545666059919796}; //CPリスト(x座標)
- double CPs_y[3]={135.50338843400897, 135.50368659080985, 135.50347298593758}; // CPリスト(y座標)
+ double CPs_x[2]={34.545588426585454, 34.5454484832847}; //CPリスト(x座標)
+ double CPs_y[2]={135.50282053551706, 135.50262437335775}; // CPリスト(y座標)
double next_CP_x, next_CP_y;
// 落下検知
// パラシュート分離
- /*wait(3);//電源ついてから3v3が安定するまで、秒数は適当、必要かもわからん
+ wait(3);//電源ついてから3v3が安定するまで、秒数は適当、必要かもわからん
while(flight_pin){}
xbee.printf("flight_pin nuketa");
wait(35);//ピン抜けてから地面につくまで70m/2.8(m/s)=25(s)余裕を見て+10s
- nichrome=1;
+ //nichrome=1;
xbee.printf("nichrome in");
wait(10);
- nichrome=0;*/
+ nichrome=0;
// 落下終了
@@ -43,7 +43,7 @@
xbee.printf("next_i=%d\r\n", i);
while (1) {
- //speak();
+ speak();
while(FrontGet()) {
xbee.printf("frontget\n\r");
Move('1', 0); //停止
@@ -52,6 +52,15 @@
Move('1', 0); //回転停止
xbee.printf("front_avoid_rotate\n\r");
}
+
+ //障害物よけて走ってから目的地に回頭、走らないと障害物に向くかも
+ Move('2', 0.1);
+ wait(1);
+ Move('2', 0.5);
+ wait(2);
+ Move('1', 0);
+ //ちょっと走るのおわり
+
direction = AngleGet();
xbee.printf("direction=%f\n\rrotation_start", direction);
//角度調節