![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
A project similar to http://mbed.org/users/lhiggs/code/UM6_IMU_AHRS_2012/, where I'm trying to log data from a UM6 (CH Robotics orientation sensor) and a GPS transceiver to an sd card. I've adapted LHiggs code to include ModGPS. For sum reason a soon as I pick up a gps signal the UM6 data freezes i.e. the time and gps signals continue to print out but the UM6 signals fixes on a single value.
Dependencies: MODGPS MODSERIAL SDFileSystem mbed
Diff: UM6_config/UM6_config.h
- Revision:
- 12:894e648638e4
- Parent:
- 10:d96e068f3595
diff -r 2b2537dcf504 -r 894e648638e4 UM6_config/UM6_config.h --- a/UM6_config/UM6_config.h Mon Jun 24 20:37:05 2013 +0000 +++ b/UM6_config/UM6_config.h Mon Jul 08 16:28:57 2013 +0000 @@ -35,7 +35,7 @@ // This setup makes it easy to make more data immediately available when needed - simply increase the array size, add code in // the firmware that writes data to the new array location, and then make updates to the firmware definition on the PC side. #define CONFIG_ARRAY_SIZE 44 -#define DATA_ARRAY_SIZE 37 +#define DATA_ARRAY_SIZE 13 #define COMMAND_COUNT 9 // original data array size 32 @@ -63,18 +63,19 @@ #define UM6_GYRO_RAW_Z (DATA_REG_START_ADDRESS + 2) #define UM6_ACCEL_RAW_XY (DATA_REG_START_ADDRESS + 3) // Raw accel data is stored in 16-bit signed integers #define UM6_ACCEL_RAW_Z (DATA_REG_START_ADDRESS + 4) -#define UM6_MAG_RAW_XY (DATA_REG_START_ADDRESS + 5) // Raw mag data is stored in 16-bit signed integers -#define UM6_MAG_RAW_Z (DATA_REG_START_ADDRESS + 6) +//#define UM6_MAG_RAW_XY (DATA_REG_START_ADDRESS + 5) // Raw mag data is stored in 16-bit signed integers +//#define UM6_MAG_RAW_Z (DATA_REG_START_ADDRESS + 6) #define UM6_GYRO_PROC_XY (DATA_REG_START_ADDRESS + 7) // Processed gyro data has scale factors applied and alignment correction performed. Data is 16-bit signed integer. #define UM6_GYRO_PROC_Z (DATA_REG_START_ADDRESS + 8) #define UM6_ACCEL_PROC_XY (DATA_REG_START_ADDRESS + 9) // Processed accel data has scale factors applied and alignment correction performed. Data is 16-bit signed integer. #define UM6_ACCEL_PROC_Z (DATA_REG_START_ADDRESS + 10) -#define UM6_MAG_PROC_XY (DATA_REG_START_ADDRESS + 11) // Processed mag data has scale factors applied and alignment correction performed. Data is 16-bit signed integer. -#define UM6_MAG_PROC_Z (DATA_REG_START_ADDRESS + 12) +//#define UM6_MAG_PROC_XY (DATA_REG_START_ADDRESS + 11) // Processed mag data has scale factors applied and alignment correction performed. Data is 16-bit signed integer. +//#define UM6_MAG_PROC_Z (DATA_REG_START_ADDRESS + 12) #define UM6_EULER_PHI_THETA (DATA_REG_START_ADDRESS + 13) // Euler angles are 32-bit IEEE floating point #define UM6_EULER_PSI (DATA_REG_START_ADDRESS + 14) #define UM6_QUAT_AB (DATA_REG_START_ADDRESS + 15) // Quaternions are 16-bit signed integers. #define UM6_QUAT_CD (DATA_REG_START_ADDRESS + 16) +/* #define UM6_ERROR_COV_00 (DATA_REG_START_ADDRESS + 17) // Error covariance is a 4x4 matrix of 32-bit IEEE floating point values #define UM6_ERROR_COV_01 (DATA_REG_START_ADDRESS + 18) #define UM6_ERROR_COV_02 (DATA_REG_START_ADDRESS + 19) @@ -91,10 +92,12 @@ #define UM6_ERROR_COV_31 (DATA_REG_START_ADDRESS + 30) #define UM6_ERROR_COV_32 (DATA_REG_START_ADDRESS + 31) #define UM6_ERROR_COV_33 (DATA_REG_START_ADDRESS + 32) -#define UM6_GPS_LONGITUDE (DATA_REG_START_ADDRESS + 34) -#define UM6_GPS_LATITUDE (DATA_REG_START_ADDRESS + 35) -#define UM6_GPS_ALTITUDE (DATA_REG_START_ADDRESS + 36) -#define UM6_GPS_COURSE_SPEED (DATA_REG_START_ADDRESS + 40) +*/ +// connected gps module directing to mbed using MODGPS +//#define UM6_GPS_LONGITUDE (DATA_REG_START_ADDRESS + 34) +//#define UM6_GPS_LATITUDE (DATA_REG_START_ADDRESS + 35) +//#define UM6_GPS_ALTITUDE (DATA_REG_START_ADDRESS + 36) +//#define UM6_GPS_COURSE_SPEED (DATA_REG_START_ADDRESS + 40) @@ -137,17 +140,17 @@ float Accel_Proc_X; float Accel_Proc_Y; float Accel_Proc_Z; -float Mag_Proc_X; -float Mag_Proc_Y; -float Mag_Proc_Z; +//float Mag_Proc_X; +//float Mag_Proc_Y; +//float Mag_Proc_Z; float Roll; float Pitch; float Yaw; -float GPS_long; -float GPS_lat; -float GPS_alt; -float GPS_course; -float GPS_speed; +//float GPS_long; +//float GPS_lat; +//float GPS_alt; +//float GPS_course; +//float GPS_speed; }; UM6 data; @@ -163,12 +166,13 @@ int16_t MY_DATA_ACCEL_PROC_X; int16_t MY_DATA_ACCEL_PROC_Y; int16_t MY_DATA_ACCEL_PROC_Z; -int16_t MY_DATA_MAG_PROC_X; -int16_t MY_DATA_MAG_PROC_Y; -int16_t MY_DATA_MAG_PROC_Z; +//int16_t MY_DATA_MAG_PROC_X; +//int16_t MY_DATA_MAG_PROC_Y; +//int16_t MY_DATA_MAG_PROC_Z; int16_t MY_DATA_EULER_PHI; int16_t MY_DATA_EULER_THETA; int16_t MY_DATA_EULER_PSI; +/* int32_t MY_DATA_GPS_LONG; int32_t MY_DATA_GPS_LONG0; int32_t MY_DATA_GPS_LONG1; @@ -183,7 +187,7 @@ int32_t MY_DATA_GPS_ALT2; int16_t MY_DATA_GPS_COURSE; int16_t MY_DATA_GPS_SPEED; - +*/ static uint8_t data_counter = 0; @@ -400,6 +404,7 @@ // calibration) magnetic-field vector, the data should be multiplied by the scale factor 0.000305176 as // shown below. // magnetic field = register_data* 0.000305176 + /* if (new_packet.address == UM6_MAG_PROC_XY) { // MAG_PROC_X @@ -429,6 +434,7 @@ data.Mag_Proc_Z = MY_DATA_MAG_PROC_Z*0.000305176; } // end if(UM6_MAG_PROC) + */ //------------------------------------------------------------ @@ -468,7 +474,7 @@ } - + /* //------------------------------------------------------------------- // GPS Ground/Speed if (new_packet.address == UM6_GPS_COURSE_SPEED) { @@ -498,7 +504,7 @@ //------------------------------------------------------------ //------------------------------------------------------------------- // GPS lat - /* if (new_packet.address == UM6_GPS_LATITUDE) { + if (new_packet.address == UM6_GPS_LATITUDE) { // Latitude //MY_DATA_GPS_LAT0 = (int32_t)new_packet.packet_data[0]<<24; //MY_DATA_GPS_LAT1 = (int32_t)new_packet.packet_data[1]<<16; @@ -544,26 +550,3 @@ #endif -/* debugging GPS lat & long - // code snippets and print out - -//code -double GPS_long; -double MY_DATA_GPS_LONG; -MY_DATA_GPS_LONG = (int32_t)new_packet.packet_data; -data.GPS_long = MY_DATA_GPS_LAT; -//print out -Long 0.000000 -Long -2.000001 -Long -2.000001 -Long -26815635079454453000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 - -//code -int32_t GPS_long; -int32_t MY_DATA_GPS_LONG; -MY_DATA_GPS_LONG = (int32_t)new_packet.packet_data; -data.GPS_long = MY_DATA_GPS_LAT; -//print out -Long nan -Long 0.000000 -*/ \ No newline at end of file