1
0
Fork 0

Switch to "nav" (cooked) data to drive FlightGear.

This commit is contained in:
curt 2007-02-27 19:45:48 +00:00
parent ce4360e157
commit a0e00e1eaf
2 changed files with 11 additions and 8 deletions

View file

@ -120,8 +120,8 @@ void UGEARTrack::parse_msg( const int id, char *buf,
// printf("imu.time = %.4f\n", imupacket->time);
} else if ( id == NAV_PACKET ) {
*navpacket = *(struct nav *)buf;
navpacket->lon = sg_swap_double( (uint8_t *)buf, 0 );
navpacket->lat = sg_swap_double( (uint8_t *)buf, 8 );
navpacket->lat = sg_swap_double( (uint8_t *)buf, 0 );
navpacket->lon = sg_swap_double( (uint8_t *)buf, 8 );
navpacket->alt = sg_swap_double( (uint8_t *)buf, 16 );
navpacket->vn = sg_swap_double( (uint8_t *)buf, 24 );
navpacket->ve = sg_swap_double( (uint8_t *)buf, 32 );

View file

@ -121,9 +121,9 @@ static void ugear2fg( gps *gpspacket, imu *imupacket, nav *navpacket,
fdm->version = FG_NET_FDM_VERSION;
// Aero parameters
fdm->longitude = gpspacket->lon * SG_DEGREES_TO_RADIANS;
fdm->latitude = gpspacket->lat * SG_DEGREES_TO_RADIANS;
fdm->altitude = gpspacket->alt + alt_offset;
fdm->longitude = navpacket->lon * SG_DEGREES_TO_RADIANS;
fdm->latitude = navpacket->lat * SG_DEGREES_TO_RADIANS;
fdm->altitude = navpacket->alt + alt_offset;
fdm->agl = -9999.0;
fdm->psi = imupacket->psi; // heading
fdm->phi = imupacket->phi; // roll
@ -140,9 +140,12 @@ static void ugear2fg( gps *gpspacket, imu *imupacket, nav *navpacket,
// double v_ms = dist / (frame_us / 1000000);
// double v_kts = v_ms * SG_METER_TO_NM * 3600;
// kts_filter = (0.99 * kts_filter) + (0.01 * v_kts);
double vn = gpspacket->vn;
double ve = gpspacket->ve;
double vd = gpspacket->vd;
double vn = navpacket->vn;
double ve = navpacket->ve;
double vd = navpacket->vd;
// enable to use ground track heading
fdm->psi = atan2(vn, ve); // heading
fdm->vcas = sqrt( vn*vn + ve*ve + vd*vd );
// last_lat = pos.lat_deg;