From 27ac2e344e69de50cc5fe02ff15d4a9dcda9e7b2 Mon Sep 17 00:00:00 2001 From: curt Date: Tue, 14 Apr 1998 02:21:01 +0000 Subject: [PATCH] Incorporated autopilot heading hold contributed by: Jeff Goeke-Smith --- Main/GLUTkey.c | 22 ++++++++++++++++++---- Main/GLUTmain.c | 25 +++++++++++++++++++++---- Main/Makefile.am | 11 ++++++++--- Main/Makefile.in | 20 +++++++++++++------- Main/fg_init.c | 21 +++++++++++++++------ 5 files changed, 75 insertions(+), 24 deletions(-) diff --git a/Main/GLUTkey.c b/Main/GLUTkey.c index 38c4268aa..a513c01e1 100644 --- a/Main/GLUTkey.c +++ b/Main/GLUTkey.c @@ -42,6 +42,7 @@ #include #include +#include // Added autopilot.h to list, Jeff Goeke-Smith #include @@ -105,8 +106,17 @@ void GLUTkey(unsigned char k, int x, int y) { case 90: /* Z key */ w->visibility /= 1.10; xglFogf(GL_FOG_END, w->visibility); - fgPrintf( FG_INPUT, FG_DEBUG, "Fog density = %.4f\n", w->visibility); - return; + fgPrintf( FG_INPUT, FG_DEBUG, + "Fog density = %.4f\n", w->visibility ); + return; + // autopilot additions + case 65: /* A key */ + fgAPSetMode(1); + return; + case 83: /* S key */ + fgAPSetMode(0); + return; + } } else { fgPrintf( FG_INPUT, FG_DEBUG, "\n"); @@ -247,9 +257,13 @@ void GLUTspecialkey(int k, int x, int y) { /* $Log$ -/* Revision 1.31 1998/04/08 23:34:05 curt -/* Patch from Durk to fix trim reversal with numlock key active. +/* Revision 1.32 1998/04/14 02:21:01 curt +/* Incorporated autopilot heading hold contributed by: Jeff Goeke-Smith +/* /* + * Revision 1.31 1998/04/08 23:34:05 curt + * Patch from Durk to fix trim reversal with numlock key active. + * * Revision 1.30 1998/04/03 22:09:02 curt * Converting to Gnu autoconf system. * diff --git a/Main/GLUTmain.c b/Main/GLUTmain.c index 0dd996cde..5d5b7395c 100644 --- a/Main/GLUTmain.c +++ b/Main/GLUTmain.c @@ -57,6 +57,7 @@ #include #include #include +#include #include #include #include @@ -248,7 +249,7 @@ static void fgUpdateViewParams( void ) { /* Tell GL we are about to modify the projection parameters */ xglMatrixMode(GL_PROJECTION); xglLoadIdentity(); - gluPerspective(45.0, 2.0/win_ratio, 1.0, 100000.0); + gluPerspective(65.0, 2.0/win_ratio, 1.0, 100000.0); } else { @@ -256,7 +257,7 @@ static void fgUpdateViewParams( void ) { /* Tell GL we are about to modify the projection parameters */ xglMatrixMode(GL_PROJECTION); xglLoadIdentity(); - gluPerspective(45.0, 1.0/win_ratio, 10.0, 100000.0); + gluPerspective(65.0, 1.0/win_ratio, 10.0, 100000.0); } xglMatrixMode(GL_MODELVIEW); @@ -625,6 +626,18 @@ static void fgMainLoop( void ) { fgPrintf( FG_ALL, FG_BULK, "Model iterations needed = %d, new remainder = %d\n", multi_loop, remainder); + + //Insertion by Jeff Goeke-Smith for Autopilot. + // Where should this really go? + // Maybe this should run in tandem with the Flight model. + + /* run Autopilot system */ + fgPrintf( FG_ALL, FG_BULK,"Attempting autopilot run\n"); + + fgAPRun(); + + // end of insertion + /* Run flight model */ if ( ! use_signals ) { @@ -811,9 +824,13 @@ extern "C" { #endif /* $Log$ -/* Revision 1.69 1998/04/08 23:35:34 curt -/* Tweaks to Gnu automake/autoconf system. +/* Revision 1.70 1998/04/14 02:21:02 curt +/* Incorporated autopilot heading hold contributed by: Jeff Goeke-Smith +/* /* + * Revision 1.69 1998/04/08 23:35:34 curt + * Tweaks to Gnu automake/autoconf system. + * * Revision 1.68 1998/04/03 22:09:03 curt * Converting to Gnu autoconf system. * diff --git a/Main/Makefile.am b/Main/Makefile.am index c6ac62072..46bd1aa74 100644 --- a/Main/Makefile.am +++ b/Main/Makefile.am @@ -16,16 +16,21 @@ fg_SOURCES = \ fg_LDADD = \ $(top_builddir)/Simulator/Aircraft/libAircraft.la \ $(top_builddir)/Simulator/Astro/libAstro.la \ + $(top_builddir)/Simulator/Autopilot/libAutopilot.la \ $(top_builddir)/Simulator/Cockpit/libCockpit.la \ $(top_builddir)/Simulator/Controls/libControls.la \ $(top_builddir)/Simulator/Flight/libFlight.la \ $(top_builddir)/Simulator/Flight/LaRCsim/libLaRCsim.la \ $(top_builddir)/Simulator/Flight/Slew/libSlew.la \ $(top_builddir)/Simulator/Scenery/libScenery.la \ - $(top_builddir)/Simulator/Scenery/Bucket/libBucket.la \ $(top_builddir)/Simulator/Time/libTime.la \ $(top_builddir)/Simulator/Weather/libWeather.la \ $(top_builddir)/Simulator/Joystick/libJoystick.la \ - $(top_builddir)/Simulator/Math/libMath.la + $(top_builddir)/Simulator/Math/libMath.la \ + $(top_builddir)/Lib/Bucket/libBucket.la -INCLUDES += -I.. -DGLUT +INCLUDES += \ + -DGLUT \ + -I$(top_builddir) \ + -I$(top_builddir)/Lib \ + -I$(top_builddir)/Simulator diff --git a/Main/Makefile.in b/Main/Makefile.in index 289ac5db7..a22f5960c 100644 --- a/Main/Makefile.in +++ b/Main/Makefile.in @@ -89,24 +89,25 @@ fg_SOURCES = \ fg_LDADD = \ $(top_builddir)/Simulator/Aircraft/libAircraft.la \ $(top_builddir)/Simulator/Astro/libAstro.la \ + $(top_builddir)/Simulator/Autopilot/libAutopilot.la \ $(top_builddir)/Simulator/Cockpit/libCockpit.la \ $(top_builddir)/Simulator/Controls/libControls.la \ $(top_builddir)/Simulator/Flight/libFlight.la \ $(top_builddir)/Simulator/Flight/LaRCsim/libLaRCsim.la \ $(top_builddir)/Simulator/Flight/Slew/libSlew.la \ $(top_builddir)/Simulator/Scenery/libScenery.la \ - $(top_builddir)/Simulator/Scenery/Bucket/libBucket.la \ $(top_builddir)/Simulator/Time/libTime.la \ $(top_builddir)/Simulator/Weather/libWeather.la \ $(top_builddir)/Simulator/Joystick/libJoystick.la \ - $(top_builddir)/Simulator/Math/libMath.la + $(top_builddir)/Simulator/Math/libMath.la \ + $(top_builddir)/Lib/Bucket/libBucket.la mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = ../../Simulator/Include/config.h +CONFIG_HEADER = ../../Include/config.h CONFIG_CLEAN_FILES = runfg runfg.bat PROGRAMS = $(bin_PROGRAMS) -DEFS = @DEFS@ -I. -I$(srcdir) -I../../Simulator/Include +DEFS = @DEFS@ -I. -I$(srcdir) -I../../Include CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ @@ -118,17 +119,18 @@ fg_OBJECTS = GLUTkey.o GLUTmain.o fg_debug.o fg_getopt.o fg_init.o \ views.o fg_DEPENDENCIES = $(top_builddir)/Simulator/Aircraft/libAircraft.la \ $(top_builddir)/Simulator/Astro/libAstro.la \ +$(top_builddir)/Simulator/Autopilot/libAutopilot.la \ $(top_builddir)/Simulator/Cockpit/libCockpit.la \ $(top_builddir)/Simulator/Controls/libControls.la \ $(top_builddir)/Simulator/Flight/libFlight.la \ $(top_builddir)/Simulator/Flight/LaRCsim/libLaRCsim.la \ $(top_builddir)/Simulator/Flight/Slew/libSlew.la \ $(top_builddir)/Simulator/Scenery/libScenery.la \ -$(top_builddir)/Simulator/Scenery/Bucket/libBucket.la \ $(top_builddir)/Simulator/Time/libTime.la \ $(top_builddir)/Simulator/Weather/libWeather.la \ $(top_builddir)/Simulator/Joystick/libJoystick.la \ -$(top_builddir)/Simulator/Math/libMath.la +$(top_builddir)/Simulator/Math/libMath.la \ +$(top_builddir)/Lib/Bucket/libBucket.la fg_LDFLAGS = SCRIPTS = $(bin_SCRIPTS) @@ -377,7 +379,11 @@ distclean-generic clean-generic maintainer-clean-generic clean \ mostlyclean distclean maintainer-clean -INCLUDES += -I.. -DGLUT +INCLUDES += \ + -DGLUT \ + -I$(top_builddir) \ + -I$(top_builddir)/Lib \ + -I$(top_builddir)/Simulator # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/Main/fg_init.c b/Main/fg_init.c index 479a3b09f..95201d543 100644 --- a/Main/fg_init.c +++ b/Main/fg_init.c @@ -42,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -227,10 +228,10 @@ int fgInitSubsystems( void ) { // FG_Altitude = FG_Runway_altitude + 3.758099; // Test Position - // FG_Longitude = ( -139.5 ) * DEG_TO_RAD; - // FG_Latitude = ( -9.5 ) * DEG_TO_RAD; - // FG_Runway_altitude = 13000.0 * METER_TO_FEET; - // FG_Altitude = FG_Runway_altitude + 3.758099; + FG_Longitude = ( -113.5 ) * DEG_TO_RAD; + FG_Latitude = ( 33.5 ) * DEG_TO_RAD; + FG_Runway_altitude = 8000.0; + FG_Altitude = FG_Runway_altitude + 3.758099; // A random test position // FG_Longitude = ( 88128.00 / 3600.0 ) * DEG_TO_RAD; @@ -390,6 +391,10 @@ int fgInitSubsystems( void ) { fgPrintf( FG_GENERAL, FG_EXIT, "Error in Joystick initialization!\n" ); } + /// Autopilot init added here, by Jeff Goeke-Smith + fgAPInit(¤t_aircraft); + // end added section; + // One more try here to get the sky synced up fgSkyColorsInit(); ret_val = 0; @@ -400,9 +405,13 @@ int fgInitSubsystems( void ) { /* $Log$ -/* Revision 1.54 1998/04/08 23:35:36 curt -/* Tweaks to Gnu automake/autoconf system. +/* Revision 1.55 1998/04/14 02:21:03 curt +/* Incorporated autopilot heading hold contributed by: Jeff Goeke-Smith +/* /* + * Revision 1.54 1998/04/08 23:35:36 curt + * Tweaks to Gnu automake/autoconf system. + * * Revision 1.53 1998/04/03 22:09:06 curt * Converting to Gnu autoconf system. * -- 2.39.2