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:
- 8:0ce247da6370
- Parent:
- 7:af9f373ac87b
- Child:
- 9:7dcfa24d5e7a
diff -r af9f373ac87b -r 0ce247da6370 UM6_config/UM6_config.h --- a/UM6_config/UM6_config.h Sat May 25 14:29:36 2013 +0000 +++ b/UM6_config/UM6_config.h Mon May 27 17:22:36 2013 +0000 @@ -92,8 +92,8 @@ #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_COURSE_SPEED (DATA_REG_START_ADDRESS + 40) +#define UM6_GPS_LATITUDE (DATA_REG_START_ADDRESS + 35) +#define UM6_GPS_COURSE_SPEED (DATA_REG_START_ADDRESS + 40) @@ -142,8 +142,8 @@ float Roll; float Pitch; float Yaw; -float GPS_long; -float GPS_lat; +double GPS_long; +double GPS_lat; float GPS_course; float GPS_speed; }; @@ -166,8 +166,8 @@ 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_LAT; +double MY_DATA_GPS_LONG; +double MY_DATA_GPS_LAT; int16_t MY_DATA_GPS_COURSE; int16_t MY_DATA_GPS_SPEED; @@ -462,12 +462,12 @@ // Ground course MY_DATA_GPS_COURSE = (int16_t)new_packet.packet_data[0]<<8; //bitshift it MY_DATA_GPS_COURSE |= new_packet.packet_data[1]; - data.GPS_course = MY_DATA_GPS_COURSE; // need to divide by 100 to get ground course in degrees + data.GPS_course = MY_DATA_GPS_COURSE*0.01; // scaled by 0.01 to get ground course in degrees // Speed MY_DATA_GPS_SPEED = (int16_t)new_packet.packet_data[2]<<8; //bitshift it MY_DATA_GPS_SPEED |= new_packet.packet_data[3]; - data.GPS_speed = MY_DATA_GPS_SPEED*0.01; // need to divide by 100 to get speed in m/s + data.GPS_speed = MY_DATA_GPS_SPEED*0.01; // scaled by 0.01 to get speed in m/s //------------------------------------------------------------ @@ -475,15 +475,17 @@ //------------------------------------------------------------------- // GPS long if (new_packet.address == UM6_GPS_LONGITUDE) { - // Longitude - data.GPS_long = MY_DATA_GPS_LONG; + // Longitude + MY_DATA_GPS_LONG = (int32_t)new_packet.packet_data; + data.GPS_long = MY_DATA_GPS_LAT; } //------------------------------------------------------------ //------------------------------------------------------------------- // GPS lat if (new_packet.address == UM6_GPS_LATITUDE) { // Latitude - data.GPS_lat = MY_DATA_GPS_LAT; + MY_DATA_GPS_LAT = (int32_t)new_packet.packet_data; + data.GPS_lat = MY_DATA_GPS_LONG; } //------------------------------------------------------------ } // end if(ADDRESS_TYPE_DATA) @@ -507,4 +509,19 @@ } // end get_gyro_x() -#endif \ No newline at end of file +#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 +*/ \ No newline at end of file