![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
2016_05_19 Auto mode: 10sec forward, 2sec stop, 2sec turn right Please change test Auto pwm
Dependencies: ADXL345 AigamozuControlPackets_2016 HMC5843 ITG3200 MBed_Adafruit-GPS-Library XBee agzIDLIST_2016 mbed
Fork of Aigamozu_Robot_ver4 by
Diff: main.cpp
- Revision:
- 35:c18c96b92121
- Parent:
- 34:9c3192c00e41
- Child:
- 36:f2013fc33b28
diff -r 9c3192c00e41 -r c18c96b92121 main.cpp --- a/main.cpp Mon May 25 11:06:34 2015 +0000 +++ b/main.cpp Mon May 25 11:36:48 2015 +0000 @@ -107,9 +107,9 @@ void Kalman(double Latitude,double Longitude); int change = 0; - LocalFileSystem local("local"); // マウントポイントを定義(ディレクトリパスになる) - +FILE *fp; +char filename[16] = "/local/out0.txt"; ///////////////////////////////////////// // //Plus Speed @@ -183,6 +183,7 @@ void Get_GPS(Adafruit_GPS *myGPS){ static int flag = 0; + static int save_counter = 0; if (myGPS->fix) { @@ -192,12 +193,12 @@ if(flag < COUNTER_MAX){ flag++; } - if(flag == 5){ + if(flag == 15){ x_prev = agz.get_agzPoint_lati(); y_prev = agz.get_agzPoint_longi(); } - if(flag >= 6){ + if(flag >= 16){ if(abs(x_prev - agz.get_agzPoint_lati()) < 0.001 && abs(y_prev - agz.get_agzPoint_longi()) < 0.001){ Kalman(agz.get_agzPoint_lati(), agz.get_agzPoint_longi()); change = 1; @@ -205,13 +206,19 @@ else{ change = 0; } - /* fp = fopen(filename, "w"); - fprintf(fp, "%d %.14lf %.14lf %.14lf %.14lf %.14le %.14le \n", - change, agz.get_agzPoint_lati(),agz.get_agzPoint_longi(), - agz.get_agzPointKalman_lati(),agz.get_agzPointKalman_longi(), - agz.get_agzCov_lati(),agz.get_agzCov_longi()); - */ - + if(save_counter < 10){ + fp = fopen(filename, "a"); + fprintf(fp, "%d %.14lf %.14lf %.14lf %.14lf %.14le %.14le \n", + change, agz.get_agzPoint_lati(),agz.get_agzPoint_longi(), + agz.get_agzPointKalman_lati(),agz.get_agzPointKalman_longi(), + agz.get_agzCov_lati(),agz.get_agzCov_longi()); + fclose(fp); + + if((flag - 16) % 500 == 0){ + filename[10]++; + save_counter++; + } + } } printf("%.14lf %.14lf %.14lf %.14lf %.14le %.14le \n",