From dcae0268de7f689a214e7550e89498baaab0ca85 Mon Sep 17 00:00:00 2001 From: curt Date: Sun, 12 Jul 1998 03:11:03 +0000 Subject: [PATCH] Removed some printf()'s. Fixed the autopilot integration so it should be able to update it's control positions every time the internal flight model loop is run, and not just once per rendered frame. Added a routine to do the necessary stuff to force an arbitrary altitude change. Gave the Navion engine just a tad more power. --- LaRCsim/ls_init.c | 18 ++++++++++++++---- LaRCsim/ls_interface.c | 35 +++++++++++++++++++++++++++++------ LaRCsim/ls_interface.h | 18 +++++++++++++++--- LaRCsim/ls_step.c | 11 ++++++++++- LaRCsim/navion_engine.c | 4 ++-- 5 files changed, 70 insertions(+), 16 deletions(-) diff --git a/LaRCsim/ls_init.c b/LaRCsim/ls_init.c index b563e6468..755076446 100644 --- a/LaRCsim/ls_init.c +++ b/LaRCsim/ls_init.c @@ -34,6 +34,15 @@ $Header$ $Log$ +Revision 1.5 1998/07/12 03:11:03 curt +Removed some printf()'s. +Fixed the autopilot integration so it should be able to update it's control + positions every time the internal flight model loop is run, and not just + once per rendered frame. +Added a routine to do the necessary stuff to force an arbitrary altitude + change. +Gave the Navion engine just a tad more power. + Revision 1.4 1998/01/19 18:40:26 curt Tons of little changes to clean up the code and to remove fatal errors when building with the c++ compiler. @@ -190,11 +199,12 @@ void ls_init( void ) { Simtime = 0; - printf("LS in init() pos = %.2f\n", Latitude); + /* printf("LS in init() pos = %.2f\n", Latitude); */ ls_init_init(); - printf("LS after init_init() pos = %.2f\n", Latitude); + /* printf("LS after init_init() pos = %.2f\n", Latitude); */ + /* move the states to proper values */ /* commented out by CLO @@ -211,11 +221,11 @@ void ls_init( void ) { model_init(); - printf("LS after model_init() pos = %.2f\n", Latitude); + /* printf("LS after model_init() pos = %.2f\n", Latitude); */ ls_step(0.0, -1); - printf("LS after ls_step() pos = %.2f\n", Latitude); + /* printf("LS after ls_step() pos = %.2f\n", Latitude); */ } diff --git a/LaRCsim/ls_interface.c b/LaRCsim/ls_interface.c index cc4fb82d5..06c025de2 100644 --- a/LaRCsim/ls_interface.c +++ b/LaRCsim/ls_interface.c @@ -532,11 +532,11 @@ int fgLaRCsimInit(double dt) { return 1; } - printf("LS pre Init pos = %.2f\n", Latitude); + /* printf("LS pre Init pos = %.2f\n", Latitude); */ ls_init(); - printf("LS post Init pos = %.2f\n", Latitude); + /* printf("LS post Init pos = %.2f\n", Latitude); */ if (speedup > 0) { /* Initialize (get) cockpit (controls) settings */ @@ -555,9 +555,6 @@ int fgLaRCsimUpdate(fgFLIGHT *f, int multiloop) { ls_cockpit(); } - // translate FG to LaRCsim structure - fgFlight_2_LaRCsim(f); - for ( i = 0; i < multiloop; i++ ) { //Insertion by Jeff Goeke-Smith for Autopilot. @@ -565,11 +562,19 @@ int fgLaRCsimUpdate(fgFLIGHT *f, int multiloop) { // fgPrintf( FG_ALL, FG_BULK, "Attempting autopilot run\n"); fgAPRun(); - + // translate FG to LaRCsim structure + fgFlight_2_LaRCsim(f); + // printf("FG_Altitude = %.2f\n", FG_Altitude * 0.3048); + // printf("Altitude = %.2f\n", Altitude * 0.3048); + // printf("Radius to Vehicle = %.2f\n", Radius_to_vehicle * 0.3048); + // end of insertion ls_loop( model_dt, 0); + // printf("%d FG_Altitude = %.2f\n", i, FG_Altitude * 0.3048); + // printf("%d Altitude = %.2f\n", i, Altitude * 0.3048); + // translate LaRCsim back to FG structure so that the // autopilot (and the rest of the sim can use the updated // values @@ -931,9 +936,27 @@ int fgLaRCsim_2_Flight (fgFLIGHT *f) { return ( 0 ); } + +/* Set the altitude (force) */ +int ls_ForceAltitude(double alt_feet) { + Altitude = alt_feet; + ls_geod_to_geoc( Latitude, Altitude, &Sea_level_radius, &Lat_geocentric); + Radius_to_vehicle = Altitude + Sea_level_radius; +} + + /* Flight Gear Modification Log * * $Log$ + * Revision 1.20 1998/07/12 03:11:03 curt + * Removed some printf()'s. + * Fixed the autopilot integration so it should be able to update it's control + * positions every time the internal flight model loop is run, and not just + * once per rendered frame. + * Added a routine to do the necessary stuff to force an arbitrary altitude + * change. + * Gave the Navion engine just a tad more power. + * * Revision 1.19 1998/05/11 18:17:28 curt * Output message tweaking. * diff --git a/LaRCsim/ls_interface.h b/LaRCsim/ls_interface.h index 487dbcc6b..b1756ffee 100644 --- a/LaRCsim/ls_interface.h +++ b/LaRCsim/ls_interface.h @@ -46,15 +46,27 @@ int fgLaRCsim_2_Flight (fgFLIGHT *f); void ls_loop( SCALAR dt, int initialize ); +/* Set the altitude (force) */ +int ls_ForceAltitude(double alt_feet); + #endif /* _LS_INTERFACE_H */ /* $Log$ -/* Revision 1.8 1998/04/21 16:59:39 curt -/* Integrated autopilot. -/* Prepairing for C++ integration. +/* Revision 1.9 1998/07/12 03:11:04 curt +/* Removed some printf()'s. +/* Fixed the autopilot integration so it should be able to update it's control +/* positions every time the internal flight model loop is run, and not just +/* once per rendered frame. +/* Added a routine to do the necessary stuff to force an arbitrary altitude +/* change. +/* Gave the Navion engine just a tad more power. /* + * Revision 1.8 1998/04/21 16:59:39 curt + * Integrated autopilot. + * Prepairing for C++ integration. + * * Revision 1.7 1998/02/07 15:29:39 curt * Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss * diff --git a/LaRCsim/ls_step.c b/LaRCsim/ls_step.c index a58de794a..66f0ca230 100644 --- a/LaRCsim/ls_step.c +++ b/LaRCsim/ls_step.c @@ -50,6 +50,15 @@ $Header$ $Log$ +Revision 1.3 1998/07/12 03:11:04 curt +Removed some printf()'s. +Fixed the autopilot integration so it should be able to update it's control + positions every time the internal flight model loop is run, and not just + once per rendered frame. +Added a routine to do the necessary stuff to force an arbitrary altitude + change. +Gave the Navion engine just a tad more power. + Revision 1.2 1998/01/19 18:40:28 curt Tons of little changes to clean up the code and to remove fatal errors when building with the c++ compiler. @@ -144,7 +153,7 @@ void ls_step( SCALAR dt, int Initialize ) { e_dot_0_past = e_dot_1_past = e_dot_2_past = e_dot_3_past = 0; /* Initialize geocentric position from geodetic latitude and altitude */ - + ls_geod_to_geoc( Latitude, Altitude, &Sea_level_radius, &Lat_geocentric); Earth_position_angle = 0; Lon_geocentric = Longitude; diff --git a/LaRCsim/navion_engine.c b/LaRCsim/navion_engine.c index f84361f8b..d1ae9018e 100644 --- a/LaRCsim/navion_engine.c +++ b/LaRCsim/navion_engine.c @@ -73,8 +73,8 @@ void engine( SCALAR dt, int init ) { /* F_X_engine = Throttle[3]*813.4/0.2; */ /* original code */ /* F_Z_engine = Throttle[3]*11.36/0.2; */ /* original code */ - F_X_engine = Throttle[3]*813.4/0.85; - F_Z_engine = Throttle[3]*11.36/0.85; + F_X_engine = Throttle[3]*813.4/0.83; + F_Z_engine = Throttle[3]*11.36/0.83; Throttle_pct = Throttle[3]; } -- 2.39.2