1
0
Fork 0

Incorporated autopilot heading hold contributed by: Jeff Goeke-Smith

<jgoeke@voyager.net>
This commit is contained in:
curt 1998-04-14 02:21:01 +00:00
parent 019d180f84
commit 27ac2e344e
5 changed files with 74 additions and 23 deletions

View file

@ -42,6 +42,7 @@
#include <Include/fg_constants.h> #include <Include/fg_constants.h>
#include <Aircraft/aircraft.h> #include <Aircraft/aircraft.h>
#include <Autopilot/autopilot.h> // Added autopilot.h to list, Jeff Goeke-Smith
#include <Weather/weather.h> #include <Weather/weather.h>
@ -105,8 +106,17 @@ void GLUTkey(unsigned char k, int x, int y) {
case 90: /* Z key */ case 90: /* Z key */
w->visibility /= 1.10; w->visibility /= 1.10;
xglFogf(GL_FOG_END, w->visibility); xglFogf(GL_FOG_END, w->visibility);
fgPrintf( FG_INPUT, FG_DEBUG, "Fog density = %.4f\n", w->visibility); fgPrintf( FG_INPUT, FG_DEBUG,
"Fog density = %.4f\n", w->visibility );
return; return;
// autopilot additions
case 65: /* A key */
fgAPSetMode(1);
return;
case 83: /* S key */
fgAPSetMode(0);
return;
} }
} else { } else {
fgPrintf( FG_INPUT, FG_DEBUG, "\n"); fgPrintf( FG_INPUT, FG_DEBUG, "\n");
@ -247,9 +257,13 @@ void GLUTspecialkey(int k, int x, int y) {
/* $Log$ /* $Log$
/* Revision 1.31 1998/04/08 23:34:05 curt /* Revision 1.32 1998/04/14 02:21:01 curt
/* Patch from Durk to fix trim reversal with numlock key active. /* Incorporated autopilot heading hold contributed by: Jeff Goeke-Smith
/* <jgoeke@voyager.net>
/* /*
* 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 * Revision 1.30 1998/04/03 22:09:02 curt
* Converting to Gnu autoconf system. * Converting to Gnu autoconf system.
* *

View file

@ -57,6 +57,7 @@
#include <Astro/sky.h> #include <Astro/sky.h>
#include <Astro/stars.h> #include <Astro/stars.h>
#include <Astro/sun.h> #include <Astro/sun.h>
#include <Autopilot/autopilot.h>
#include <Cockpit/cockpit.h> #include <Cockpit/cockpit.h>
#include <Joystick/joystick.h> #include <Joystick/joystick.h>
#include <Math/fg_geodesy.h> #include <Math/fg_geodesy.h>
@ -248,7 +249,7 @@ static void fgUpdateViewParams( void ) {
/* Tell GL we are about to modify the projection parameters */ /* Tell GL we are about to modify the projection parameters */
xglMatrixMode(GL_PROJECTION); xglMatrixMode(GL_PROJECTION);
xglLoadIdentity(); xglLoadIdentity();
gluPerspective(45.0, 2.0/win_ratio, 1.0, 100000.0); gluPerspective(65.0, 2.0/win_ratio, 1.0, 100000.0);
} }
else else
{ {
@ -256,7 +257,7 @@ static void fgUpdateViewParams( void ) {
/* Tell GL we are about to modify the projection parameters */ /* Tell GL we are about to modify the projection parameters */
xglMatrixMode(GL_PROJECTION); xglMatrixMode(GL_PROJECTION);
xglLoadIdentity(); 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); xglMatrixMode(GL_MODELVIEW);
@ -626,6 +627,18 @@ static void fgMainLoop( void ) {
"Model iterations needed = %d, new remainder = %d\n", "Model iterations needed = %d, new remainder = %d\n",
multi_loop, remainder); 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 */ /* Run flight model */
if ( ! use_signals ) { if ( ! use_signals ) {
/* flight model */ /* flight model */
@ -811,9 +824,13 @@ extern "C" {
#endif #endif
/* $Log$ /* $Log$
/* Revision 1.69 1998/04/08 23:35:34 curt /* Revision 1.70 1998/04/14 02:21:02 curt
/* Tweaks to Gnu automake/autoconf system. /* Incorporated autopilot heading hold contributed by: Jeff Goeke-Smith
/* <jgoeke@voyager.net>
/* /*
* 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 * Revision 1.68 1998/04/03 22:09:03 curt
* Converting to Gnu autoconf system. * Converting to Gnu autoconf system.
* *

View file

@ -16,16 +16,21 @@ fg_SOURCES = \
fg_LDADD = \ fg_LDADD = \
$(top_builddir)/Simulator/Aircraft/libAircraft.la \ $(top_builddir)/Simulator/Aircraft/libAircraft.la \
$(top_builddir)/Simulator/Astro/libAstro.la \ $(top_builddir)/Simulator/Astro/libAstro.la \
$(top_builddir)/Simulator/Autopilot/libAutopilot.la \
$(top_builddir)/Simulator/Cockpit/libCockpit.la \ $(top_builddir)/Simulator/Cockpit/libCockpit.la \
$(top_builddir)/Simulator/Controls/libControls.la \ $(top_builddir)/Simulator/Controls/libControls.la \
$(top_builddir)/Simulator/Flight/libFlight.la \ $(top_builddir)/Simulator/Flight/libFlight.la \
$(top_builddir)/Simulator/Flight/LaRCsim/libLaRCsim.la \ $(top_builddir)/Simulator/Flight/LaRCsim/libLaRCsim.la \
$(top_builddir)/Simulator/Flight/Slew/libSlew.la \ $(top_builddir)/Simulator/Flight/Slew/libSlew.la \
$(top_builddir)/Simulator/Scenery/libScenery.la \ $(top_builddir)/Simulator/Scenery/libScenery.la \
$(top_builddir)/Simulator/Scenery/Bucket/libBucket.la \
$(top_builddir)/Simulator/Time/libTime.la \ $(top_builddir)/Simulator/Time/libTime.la \
$(top_builddir)/Simulator/Weather/libWeather.la \ $(top_builddir)/Simulator/Weather/libWeather.la \
$(top_builddir)/Simulator/Joystick/libJoystick.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

View file

@ -89,24 +89,25 @@ fg_SOURCES = \
fg_LDADD = \ fg_LDADD = \
$(top_builddir)/Simulator/Aircraft/libAircraft.la \ $(top_builddir)/Simulator/Aircraft/libAircraft.la \
$(top_builddir)/Simulator/Astro/libAstro.la \ $(top_builddir)/Simulator/Astro/libAstro.la \
$(top_builddir)/Simulator/Autopilot/libAutopilot.la \
$(top_builddir)/Simulator/Cockpit/libCockpit.la \ $(top_builddir)/Simulator/Cockpit/libCockpit.la \
$(top_builddir)/Simulator/Controls/libControls.la \ $(top_builddir)/Simulator/Controls/libControls.la \
$(top_builddir)/Simulator/Flight/libFlight.la \ $(top_builddir)/Simulator/Flight/libFlight.la \
$(top_builddir)/Simulator/Flight/LaRCsim/libLaRCsim.la \ $(top_builddir)/Simulator/Flight/LaRCsim/libLaRCsim.la \
$(top_builddir)/Simulator/Flight/Slew/libSlew.la \ $(top_builddir)/Simulator/Flight/Slew/libSlew.la \
$(top_builddir)/Simulator/Scenery/libScenery.la \ $(top_builddir)/Simulator/Scenery/libScenery.la \
$(top_builddir)/Simulator/Scenery/Bucket/libBucket.la \
$(top_builddir)/Simulator/Time/libTime.la \ $(top_builddir)/Simulator/Time/libTime.la \
$(top_builddir)/Simulator/Weather/libWeather.la \ $(top_builddir)/Simulator/Weather/libWeather.la \
$(top_builddir)/Simulator/Joystick/libJoystick.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 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../Simulator/Include/config.h CONFIG_HEADER = ../../Include/config.h
CONFIG_CLEAN_FILES = runfg runfg.bat CONFIG_CLEAN_FILES = runfg runfg.bat
PROGRAMS = $(bin_PROGRAMS) PROGRAMS = $(bin_PROGRAMS)
DEFS = @DEFS@ -I. -I$(srcdir) -I../../Simulator/Include DEFS = @DEFS@ -I. -I$(srcdir) -I../../Include
CPPFLAGS = @CPPFLAGS@ CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@ LDFLAGS = @LDFLAGS@
LIBS = @LIBS@ LIBS = @LIBS@
@ -118,17 +119,18 @@ fg_OBJECTS = GLUTkey.o GLUTmain.o fg_debug.o fg_getopt.o fg_init.o \
views.o views.o
fg_DEPENDENCIES = $(top_builddir)/Simulator/Aircraft/libAircraft.la \ fg_DEPENDENCIES = $(top_builddir)/Simulator/Aircraft/libAircraft.la \
$(top_builddir)/Simulator/Astro/libAstro.la \ $(top_builddir)/Simulator/Astro/libAstro.la \
$(top_builddir)/Simulator/Autopilot/libAutopilot.la \
$(top_builddir)/Simulator/Cockpit/libCockpit.la \ $(top_builddir)/Simulator/Cockpit/libCockpit.la \
$(top_builddir)/Simulator/Controls/libControls.la \ $(top_builddir)/Simulator/Controls/libControls.la \
$(top_builddir)/Simulator/Flight/libFlight.la \ $(top_builddir)/Simulator/Flight/libFlight.la \
$(top_builddir)/Simulator/Flight/LaRCsim/libLaRCsim.la \ $(top_builddir)/Simulator/Flight/LaRCsim/libLaRCsim.la \
$(top_builddir)/Simulator/Flight/Slew/libSlew.la \ $(top_builddir)/Simulator/Flight/Slew/libSlew.la \
$(top_builddir)/Simulator/Scenery/libScenery.la \ $(top_builddir)/Simulator/Scenery/libScenery.la \
$(top_builddir)/Simulator/Scenery/Bucket/libBucket.la \
$(top_builddir)/Simulator/Time/libTime.la \ $(top_builddir)/Simulator/Time/libTime.la \
$(top_builddir)/Simulator/Weather/libWeather.la \ $(top_builddir)/Simulator/Weather/libWeather.la \
$(top_builddir)/Simulator/Joystick/libJoystick.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 = fg_LDFLAGS =
SCRIPTS = $(bin_SCRIPTS) SCRIPTS = $(bin_SCRIPTS)
@ -377,7 +379,11 @@ distclean-generic clean-generic maintainer-clean-generic clean \
mostlyclean distclean maintainer-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. # 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. # Otherwise a system limit (for SysV at least) may be exceeded.

View file

@ -42,6 +42,7 @@
#include <Astro/sky.h> #include <Astro/sky.h>
#include <Astro/stars.h> #include <Astro/stars.h>
#include <Astro/sun.h> #include <Astro/sun.h>
#include <Autopilot/autopilot.h>
#include <Cockpit/cockpit.h> #include <Cockpit/cockpit.h>
#include <Joystick/joystick.h> #include <Joystick/joystick.h>
#include <Math/fg_random.h> #include <Math/fg_random.h>
@ -227,10 +228,10 @@ int fgInitSubsystems( void ) {
// FG_Altitude = FG_Runway_altitude + 3.758099; // FG_Altitude = FG_Runway_altitude + 3.758099;
// Test Position // Test Position
// FG_Longitude = ( -139.5 ) * DEG_TO_RAD; FG_Longitude = ( -113.5 ) * DEG_TO_RAD;
// FG_Latitude = ( -9.5 ) * DEG_TO_RAD; FG_Latitude = ( 33.5 ) * DEG_TO_RAD;
// FG_Runway_altitude = 13000.0 * METER_TO_FEET; FG_Runway_altitude = 8000.0;
// FG_Altitude = FG_Runway_altitude + 3.758099; FG_Altitude = FG_Runway_altitude + 3.758099;
// A random test position // A random test position
// FG_Longitude = ( 88128.00 / 3600.0 ) * DEG_TO_RAD; // 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" ); fgPrintf( FG_GENERAL, FG_EXIT, "Error in Joystick initialization!\n" );
} }
/// Autopilot init added here, by Jeff Goeke-Smith
fgAPInit(&current_aircraft);
// end added section;
// One more try here to get the sky synced up // One more try here to get the sky synced up
fgSkyColorsInit(); fgSkyColorsInit();
ret_val = 0; ret_val = 0;
@ -400,9 +405,13 @@ int fgInitSubsystems( void ) {
/* $Log$ /* $Log$
/* Revision 1.54 1998/04/08 23:35:36 curt /* Revision 1.55 1998/04/14 02:21:03 curt
/* Tweaks to Gnu automake/autoconf system. /* Incorporated autopilot heading hold contributed by: Jeff Goeke-Smith
/* <jgoeke@voyager.net>
/* /*
* 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 * Revision 1.53 1998/04/03 22:09:06 curt
* Converting to Gnu autoconf system. * Converting to Gnu autoconf system.
* *