Trying to log data from UM6 sensor with GPS receiver LS20031. I have two problems: - I can't log to file at a fast rate (<0.5s) without data values freezing to a fixed value. Print to pc screen it works fine. Ideally I would do this with an interrupt (e.g. ticker) so that the time of each reading is a fixed interval - I removed this as I thought this was causing the problem. - I want to record GPS lat and long. I have setup the GPS ground speed so I know the sensor are communicating. So I possibly havent set the config file to correctly interpet these two signals.
Fork of UM6_IMU_AHRS_2012 by
Diff: main.cpp
- Revision:
- 5:b3cd0bcf2968
- Parent:
- 4:aefc0f09fe1c
- Child:
- 6:43029c69b9ac
diff -r aefc0f09fe1c -r b3cd0bcf2968 main.cpp --- a/main.cpp Thu May 02 08:52:53 2013 +0000 +++ b/main.cpp Thu May 02 11:38:25 2013 +0000 @@ -47,13 +47,13 @@ FILE *fp = fopen("/local/out3.csv", "w"); // Open "out.txt" on the local file system for writing - fprintf(fp, "time (s),Yaw (deg),Roll (deg),Pitch (deg),GyroX,GyroY,GyroZ,AccelX,AccelY,AccelZ\r"); // sends header to file + fprintf(fp, "time (s),Yaw (deg),Roll (deg),Pitch (deg),GyroX,GyroY,GyroZ,AccelX,AccelY,AccelZ,GPScourse(x100 deg),GPSspeed(x100 m/s)\r"); // sends header to file t.start(); // start data log time sync = 1; while (enable) { logLED = 1; // turns LED3 on when logging starts - wait(0.5); + wait(0.05); float time1=t.read(); float Yaw=data.Yaw; float Roll=data.Roll; @@ -67,17 +67,15 @@ // float MagX=data.Mag_Proc_X; // float MagY=data.Mag_Proc_Y; // float MagZ=data.Mag_Proc_Z; - float GPSlong=data.GPS_long; - float GPSlat=data.GPS_lat; + // float GPSlong=data.GPS_long; + // float GPSlat=data.GPS_lat; float GPScourse=data.GPS_course; float GPSspeed=data.GPS_speed; - // pc.printf("time1 %3.3f s,Yaw %3.3f deg,Roll %3.3f deg,Pitch %3.3f deg",time1,Yaw,Roll,Pitch); - pc.printf("time1 %3.3f s,Yaw %3.3f deg, Speed %f 0.01m/s,course %f 0.01m/s, long %f deg, lat %f deg\n",time1,Yaw,GPSspeed,GPScourse,GPSlong,GPSlat); - // fprintf(fp, "%3.3f,%3.3f,%3.3f,%3.3f \n",time1,Yaw,Roll,Pitch); - // fprintf(fp, "%3.3f,%3.3f,%3.3f,%3.3f,%3.3f,%3.3f,%3.3f\n",time1,Yaw,Roll,Pitch,GyroX,GyroY,GyroZ); - // fprintf(fp, "%3.3f,%3.3f,%3.3f,%3.3f,%3.3f,%3.3f,%3.3f,%3.3f,%3.3f,%3.3f\n",time1,Yaw,Roll,Pitch,GyroX,GyroY,GyroZ,AccelX,AccelY,AccelZ); - + // fprintf(fp, "%3.3f, %3.1f,%3.1f,%3.1f, %4.1f,%4.1f,%4.1f, %1.3f,%1.3f,%1.3f, %4.0f,%f\n",time1,Yaw,Roll,Pitch,GyroX,GyroY,GyroZ,AccelX,AccelY,AccelZ,MagX,MagY,MagZ,GPScourse,GPSspeed); + // pc.printf("time %3.3f, yaw %3.1f,%3.1f,%3.1f, gyro %4.1f,%4.1f,%4.1f,accel %1.3f,%1.3f,%1.3f,speed %4.0f, course %5.0f\n",time1,Yaw,Roll,Pitch,GyroX,GyroY,GyroZ,AccelX,AccelY,AccelZ,MagX,MagY,MagZ,GPScourse,GPSspeed); + pc.printf("time %3.3f, yaw %3.3f\n",time1,Yaw); + fprintf(fp, "%3.3f,%3.1f,%3.1f\n",time1,Yaw,GyroX); pc_activity = !pc_activity; // Lights LED1 when uart RxBuff has > 40 bytes } // end while(1) loop