ループのテスト
Dependencies: ATP3012 mbed TB6612FNG HMC6352 US015 getGPS
Diff: main.cpp
- Revision:
- 19:fb9b9795ad9e
- Parent:
- 18:057b39ca7bd1
--- a/main.cpp Thu Oct 28 09:57:35 2021 +0000 +++ b/main.cpp Thu Oct 28 10:30:13 2021 +0000 @@ -86,8 +86,8 @@ pc.printf("\n\rlongititude="); pc.scanf("%lf",&gps.longitude); pc.printf("%lf %lf\r\n", gps.latitude, gps.longitude); - if ((next_CP_x - GPS_x)*(next_CP_x - GPS_x) + (next_CP_y = GPS_y)*(next_CP_y = GPS_y) < 0.01) { // CP到着判定 //試験で調整 - pc.printf("now leach cp[%d]=x_%f,y_%f",i,next_CP_x ,next_CP_y); + if ((next_CP_x - gps.latitude)*(next_CP_x - gps.latitude) + (next_CP_y - gps.longitude)*(next_CP_y -gps.longitude) < 0.01) { // CP到着判定 //試験で調整 + pc.printf("now leach cp[%d]=x_%f,y_%f\r\n",i,next_CP_x ,next_CP_y); break; } @@ -95,6 +95,7 @@ } // 行動フロー終了 pc.printf("End\r\n"); + Move('1', 0); //停止 return 0; } }