Fix a couple data packet decoding mistakes.
This commit is contained in:
parent
b8d3a41810
commit
15c28a9354
2 changed files with 4 additions and 4 deletions
|
@ -94,7 +94,7 @@ void UGEARTrack::parse_msg( const int id, char *buf,
|
||||||
gpspacket->vn = sg_swap_double( (uint8_t *)buf, 24 );
|
gpspacket->vn = sg_swap_double( (uint8_t *)buf, 24 );
|
||||||
gpspacket->ve = sg_swap_double( (uint8_t *)buf, 32 );
|
gpspacket->ve = sg_swap_double( (uint8_t *)buf, 32 );
|
||||||
gpspacket->vd = sg_swap_double( (uint8_t *)buf, 40 );
|
gpspacket->vd = sg_swap_double( (uint8_t *)buf, 40 );
|
||||||
gpspacket->time = sg_swap_double( (uint8_t *)buf, 56 );
|
gpspacket->time = sg_swap_double( (uint8_t *)buf, 52 );
|
||||||
} else if ( id == IMU_PACKET ) {
|
} else if ( id == IMU_PACKET ) {
|
||||||
*imupacket = *(struct imu *)buf;
|
*imupacket = *(struct imu *)buf;
|
||||||
imupacket->p = sg_swap_double( (uint8_t *)buf, 0 );
|
imupacket->p = sg_swap_double( (uint8_t *)buf, 0 );
|
||||||
|
@ -128,7 +128,7 @@ void UGEARTrack::parse_msg( const int id, char *buf,
|
||||||
// printf("servo time = %.3f\n", servopacket->time);
|
// printf("servo time = %.3f\n", servopacket->time);
|
||||||
} else if ( id == HEALTH_PACKET ) {
|
} else if ( id == HEALTH_PACKET ) {
|
||||||
*healthpacket = *(struct health *)buf;
|
*healthpacket = *(struct health *)buf;
|
||||||
healthpacket->time = sg_swap_double( (uint8_t *)buf, 12 );
|
healthpacket->time = sg_swap_double( (uint8_t *)buf, 16 );
|
||||||
} else {
|
} else {
|
||||||
cout << "unknown id = " << id << endl;
|
cout << "unknown id = " << id << endl;
|
||||||
}
|
}
|
||||||
|
@ -175,7 +175,7 @@ bool UGEARTrack::load( const string &file ) {
|
||||||
gps_data.push_back( gpspacket );
|
gps_data.push_back( gpspacket );
|
||||||
gps_time = gpspacket.time;
|
gps_time = gpspacket.time;
|
||||||
} else {
|
} else {
|
||||||
cout << "oops gps back in time" << endl;
|
cout << "oops gps back in time: " << gpspacket.time << " " << gps_time << endl;
|
||||||
}
|
}
|
||||||
} else if ( id == IMU_PACKET ) {
|
} else if ( id == IMU_PACKET ) {
|
||||||
if ( imupacket.time > imu_time ) {
|
if ( imupacket.time > imu_time ) {
|
||||||
|
|
|
@ -707,7 +707,7 @@ int main( int argc, char **argv ) {
|
||||||
gps_time = gpspacket.time;
|
gps_time = gpspacket.time;
|
||||||
current_time = gps_time;
|
current_time = gps_time;
|
||||||
} else {
|
} else {
|
||||||
cout << "oops gps back in time" << endl;
|
cout << "oops gps back in time: " << gpspacket.time << " " << gps_time << endl;
|
||||||
}
|
}
|
||||||
} else if ( id == IMU_PACKET ) {
|
} else if ( id == IMU_PACKET ) {
|
||||||
if ( imupacket.time > imu_time ) {
|
if ( imupacket.time > imu_time ) {
|
||||||
|
|
Loading…
Reference in a new issue