1
0
Fork 0

Tweaked FDM interface.

Testing check sum support for NMEA serial output.
This commit is contained in:
curt 1999-01-20 13:42:22 +00:00
parent de4713bf2a
commit 24fc48a0d5
5 changed files with 53 additions and 16 deletions

View file

@ -70,7 +70,7 @@ void FGState::extrapolate( int time_offset ) {
// Initialize the flight model parameters
int fgFlightModelInit(int model, FGState& f, double dt) {
int fgFDMInit(int model, FGState& f, double dt) {
double save_alt = 0.0;
FG_LOG( FG_FLIGHT ,FG_INFO, "Initializing flight model" );
@ -120,7 +120,7 @@ int fgFlightModelInit(int model, FGState& f, double dt) {
// Run multiloop iterations of the flight model
int fgFlightModelUpdate(int model, FGState& f, int multiloop, int time_offset) {
int fgFDMUpdate(int model, FGState& f, int multiloop, int time_offset) {
double time_step, start_elev, end_elev;
// printf("Altitude = %.2f\n", FG_Altitude * 0.3048);
@ -161,7 +161,7 @@ int fgFlightModelUpdate(int model, FGState& f, int multiloop, int time_offset) {
// Set the altitude (force)
void fgFlightModelSetAltitude(int model, double alt_meters) {
void fgFDMForceAltitude(int model, double alt_meters) {
double sea_level_radius_meters;
double lat_geoc;
@ -181,7 +181,17 @@ void fgFlightModelSetAltitude(int model, double alt_meters) {
}
// Set the local ground elevation
void fgFDMSetGroundElevation(int model, double ground_meters) {
base_fdm_state.set_Runway_altitude( ground_meters * METER_TO_FEET );
}
// $Log$
// Revision 1.12 1999/01/20 13:42:22 curt
// Tweaked FDM interface.
// Testing check sum support for NMEA serial output.
//
// Revision 1.11 1999/01/19 17:52:06 curt
// Working on being able to extrapolate a new position and orientation
// based on a position, orientation, and time offset.

View file

@ -84,6 +84,11 @@
#include <Time/timestamp.hxx>
#ifndef __cplusplus
# error This library requires C++
#endif
typedef double FG_VECTOR_3[3];
@ -793,19 +798,26 @@ extern FGState cur_fdm_state;
// General interface to the flight model routines
// Initialize the flight model parameters
int fgFlightModelInit(int model, FGState& f, double dt);
int fgFDMInit(int model, FGState& f, double dt);
// Run multiloop iterations of the flight model
int fgFlightModelUpdate(int model, FGState& f, int multiloop, int jitter);
int fgFDMUpdate(int model, FGState& f, int multiloop, int jitter);
// Set the altitude (force)
void fgFlightModelSetAltitude(int model, double alt_meters);
void fgFDMForceAltitude(int model, double alt_meters);
// Set the local ground elevation
void fgFDMSetGroundElevation(int model, double alt_meters);
#endif // _FLIGHT_HXX
// $Log$
// Revision 1.12 1999/01/20 13:42:23 curt
// Tweaked FDM interface.
// Testing check sum support for NMEA serial output.
//
// Revision 1.11 1999/01/19 17:52:07 curt
// Working on being able to extrapolate a new position and orientation
// based on a position, orientation, and time offset.

View file

@ -386,10 +386,10 @@ void fgUpdateTimeDepCalcs(int multi_loop, int remainder) {
fgAPRun();
// printf("updating flight model x %d\n", multi_loop);
fgFlightModelUpdate( current_options.get_flight_model(),
fgFDMUpdate( current_options.get_flight_model(),
cur_fdm_state, multi_loop, remainder );
} else {
fgFlightModelUpdate( current_options.get_flight_model(),
fgFDMUpdate( current_options.get_flight_model(),
cur_fdm_state, 0, remainder );
}
@ -492,14 +492,15 @@ static void fgMainLoop( void ) {
f->get_Altitude() * FEET_TO_METER,
scenery.cur_elev + alt_adjust_m - 3.0,
scenery.cur_elev + alt_adjust_m );
fgFlightModelSetAltitude( current_options.get_flight_model(),
scenery.cur_elev + alt_adjust_m );
fgFDMForceAltitude( current_options.get_flight_model(),
scenery.cur_elev + alt_adjust_m );
FG_LOG( FG_ALL, FG_DEBUG,
"<*> resetting altitude to "
<< f->get_Altitude() * FEET_TO_METER << " meters" );
}
f->set_Runway_altitude( scenery.cur_elev * METER_TO_FEET );
fgFDMSetGroundElevation( current_options.get_flight_model(),
scenery.cur_elev ); // meters
}
/* printf("Adjustment - ground = %.2f runway = %.2f alt = %.2f\n",
@ -1002,6 +1003,10 @@ int main( int argc, char **argv ) {
// $Log$
// Revision 1.82 1999/01/20 13:42:24 curt
// Tweaked FDM interface.
// Testing check sum support for NMEA serial output.
//
// Revision 1.81 1999/01/19 20:57:03 curt
// MacOS portability changes contributed by "Robert Puyol" <puyol@abvent.fr>
//

View file

@ -107,7 +107,8 @@ int fgInitPosition( void ) {
"starting altitude is = " << current_options.get_altitude() );
f->set_Altitude( current_options.get_altitude() * METER_TO_FEET );
f->set_Runway_altitude( f->get_Altitude() - 3.758099 );
fgFDMSetGroundElevation( current_options.get_flight_model(),
(f->get_Altitude() - 3.758099) * FEET_TO_METER );
FG_LOG( FG_GENERAL, FG_INFO,
"Initial position is: ("
@ -208,7 +209,8 @@ int fgInitSubsystems( void )
tmp_abs_view_pos );
FG_LOG( FG_GENERAL, FG_DEBUG,
"Altitude after update " << scenery.cur_elev );
f->set_Runway_altitude( scenery.cur_elev * METER_TO_FEET );
fgFDMSetGroundElevation( current_options.get_flight_model(),
scenery.cur_elev );
// Reset our altitude if we are below ground
if ( f->get_Altitude() < f->get_Runway_altitude() + 3.758099) {
@ -341,7 +343,7 @@ int fgInitSubsystems( void )
// Initialize the flight model subsystem data structures base on
// above values
fgFlightModelInit( current_options.get_flight_model(), cur_fdm_state,
fgFDMInit( current_options.get_flight_model(), cur_fdm_state,
1.0 / DEFAULT_MODEL_HZ );
// I'm just sticking this here for now, it should probably move
@ -379,6 +381,10 @@ int fgInitSubsystems( void )
// $Log$
// Revision 1.62 1999/01/20 13:42:25 curt
// Tweaked FDM interface.
// Testing check sum support for NMEA serial output.
//
// Revision 1.61 1999/01/08 03:23:57 curt
// Beginning work on compensating for sim time vs. real world time "jitter".
//

View file

@ -294,11 +294,11 @@ static void send_nmea_out( fgIOCHANNEL& p ) {
// $GPRMC,HHMMSS,A,DDMM.MMM,N,DDDMM.MMM,W,XXX.X,XXX.X,DDMMYY,XXX.X,E*XX
sprintf( rmc, "GPRMC,%s,A,%s,%s,%s,%s,%s,0.000,E",
utc, lat, lon, speed, heading, date );
sprintf( rmc_sum, "%02X", 0 /*calc_nmea_cksum(rmc)*/ );
sprintf( rmc_sum, "%02X", calc_nmea_cksum(rmc) );
sprintf( gga, "GPGGA,%s,%s,%s,1,,,%s,F,,,,",
utc, lat, lon, altitude_ft );
sprintf( gga_sum, "%02X", 0 /*calc_nmea_cksum(gga)*/ );
sprintf( gga_sum, "%02X", calc_nmea_cksum(gga) );
FG_LOG( FG_SERIAL, FG_DEBUG, rmc );
@ -456,6 +456,10 @@ void fgSerialProcess() {
// $Log$
// Revision 1.9 1999/01/20 13:42:26 curt
// Tweaked FDM interface.
// Testing check sum support for NMEA serial output.
//
// Revision 1.8 1999/01/19 20:57:04 curt
// MacOS portability changes contributed by "Robert Puyol" <puyol@abvent.fr>
//