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: ADXL345 AigamozuControlPackets_展示会 HMC5843 ITG3200 MBed_Adafruit-GPS-Library XBee agzIDLIST mbed
Fork of Aigamozu_Robot_ver4 by
Revision 35:c18c96b92121, committed 2015-05-25
- Comitter:
- s1200058
- Date:
- Mon May 25 11:36:48 2015 +0000
- Parent:
- 34:9c3192c00e41
- Child:
- 36:f2013fc33b28
- Commit message:
- they can print log at file
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- 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",
