![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
zahyou kime hukume
Revision 6:4eb0f2c63da0, committed 2021-12-09
- Comitter:
- kaipon
- Date:
- Thu Dec 09 06:46:37 2021 +0000
- Parent:
- 5:d78746981e4f
- Commit message:
- zahyou sitei hukume
Changed in this revision
getGPS.lib | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/getGPS.lib Thu Dec 02 05:50:51 2021 +0000 +++ b/getGPS.lib Thu Dec 09 06:46:37 2021 +0000 @@ -1,1 +1,1 @@ -https://os.mbed.com/users/asha_ndf/code/getGPS/#e1e7bfab1993 +https://os.mbed.com/users/CanSat_C/code/getGPS/#2046f20df896
--- a/main.cpp Thu Dec 02 05:50:51 2021 +0000 +++ b/main.cpp Thu Dec 09 06:46:37 2021 +0000 @@ -33,12 +33,49 @@ } } +void goalkime(){ + double u,v; + double uu = 10; + double vv = 100; + char g[50]; + int hh = 1; + while(hh < 3){ + int h = 1; + while(h <= 50){ + g[h] = 0; + h++; + } + h = 0; + while(xbee.getc() != 47){ + g[h] = xbee.getc(); + h++; + } + h = 0; + if(hh == 1){ + while(g[h] != 47){ + u = u + uu*(g[h]-47); + uu = uu/10; + h++; + } + } + else{ + while(g[h] != 47){ + v = v + (g[h]-47)*vv; + vv = vv/10; + h++; + } + } + hh++; + } + } + int main(){ double x,y,u,v,m,n,i,w,j,p,q,e,f,c; int r,s,k; - u = 34.546366; - v = 135.502015; + u = 0; + v = 0; s = 0; + goalkime(); xbee.printf("XBee Connected\r\n"); while(gps.getgps() != true){ @@ -63,7 +100,7 @@ while(gps.getgps() != true){ xbee.printf("false\r\n"); } - gps.getgps(); + m=gps.latitude; n=gps.longitude; xbee.printf("m:%f,n:%f\r\n", m, n); @@ -88,7 +125,7 @@ c = (e-f)/(1+e*f); xbee.printf("c:%f\r\n",c); //t[0]は回る時間、t[1]はかかる時間、rに何回進むプログラムを動かすかを決める - double t[2] = {w/3.14159/0.9,2*j/3/1.0}; //再度図るのは、全体の2/3だけ進んだとき + double t[2] = {w/3.14159/0.9,2*j/3/1.2}; //再度図るのは、全体の2/3だけ進んだとき r = t[1]/2.2; wait(1); xbee.printf("c*i:%f\r\n", c*i); @@ -161,7 +198,6 @@ while(gps.getgps() != true){ // xbee.printf("false\r\n"); } - gps.getgps(); x = gps.latitude; y = gps.longitude; //5秒前進する @@ -173,7 +209,7 @@ wait(2); driveMotor(0,0); //m,nに現在の経度、緯度を記録する - gps.getgps(); + m=gps.latitude; n=gps.longitude; a[0]=m-x; @@ -210,4 +246,4 @@ driveMotor(0,0); } - \ No newline at end of file + \ No newline at end of file