Integrated autopilot.
Prepairing for C++ integration.
This commit is contained in:
parent
7d39aa3777
commit
e2ddc6f2b8
6 changed files with 59 additions and 15 deletions
12
FDM/flight.c
12
FDM/flight.c
|
@ -59,9 +59,7 @@ int fgFlightModelUpdate(int model, fgFLIGHT *f, int multiloop) {
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
if ( model == FG_LARCSIM ) {
|
if ( model == FG_LARCSIM ) {
|
||||||
fgFlight_2_LaRCsim(f); /* translate FG to LaRCsim structure */
|
fgLaRCsimUpdate(f, multiloop);
|
||||||
fgLaRCsimUpdate(multiloop);
|
|
||||||
fgLaRCsim_2_Flight(f); /* translate LaRCsim back to FG structure */
|
|
||||||
} else {
|
} else {
|
||||||
fgPrintf(FG_FLIGHT,FG_WARN,"Unimplemented flight model == %d\n", model);
|
fgPrintf(FG_FLIGHT,FG_WARN,"Unimplemented flight model == %d\n", model);
|
||||||
}
|
}
|
||||||
|
@ -73,9 +71,13 @@ int fgFlightModelUpdate(int model, fgFLIGHT *f, int multiloop) {
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.11 1998/04/18 04:14:04 curt
|
/* Revision 1.12 1998/04/21 16:59:33 curt
|
||||||
/* Moved fg_debug.c to it's own library.
|
/* Integrated autopilot.
|
||||||
|
/* Prepairing for C++ integration.
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.11 1998/04/18 04:14:04 curt
|
||||||
|
* Moved fg_debug.c to it's own library.
|
||||||
|
*
|
||||||
* Revision 1.10 1998/02/07 15:29:37 curt
|
* Revision 1.10 1998/02/07 15:29:37 curt
|
||||||
* Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss
|
* Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss
|
||||||
* <chotchkiss@namg.us.anritsu.com>
|
* <chotchkiss@namg.us.anritsu.com>
|
||||||
|
|
20
FDM/flight.h
20
FDM/flight.h
|
@ -28,6 +28,11 @@
|
||||||
#define _FLIGHT_H
|
#define _FLIGHT_H
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include <Flight/Slew/slew.h>
|
#include <Flight/Slew/slew.h>
|
||||||
/* #include <Flight/LaRCsim/ls_interface.h> */
|
/* #include <Flight/LaRCsim/ls_interface.h> */
|
||||||
|
|
||||||
|
@ -397,14 +402,23 @@ int fgFlightModelInit(int model, fgFLIGHT *f, double dt);
|
||||||
int fgFlightModelUpdate(int model, fgFLIGHT *f, int multiloop);
|
int fgFlightModelUpdate(int model, fgFLIGHT *f, int multiloop);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif /* _FLIGHT_H */
|
#endif /* _FLIGHT_H */
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.14 1998/02/07 15:29:37 curt
|
/* Revision 1.15 1998/04/21 16:59:33 curt
|
||||||
/* Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss
|
/* Integrated autopilot.
|
||||||
/* <chotchkiss@namg.us.anritsu.com>
|
/* Prepairing for C++ integration.
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.14 1998/02/07 15:29:37 curt
|
||||||
|
* Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss
|
||||||
|
* <chotchkiss@namg.us.anritsu.com>
|
||||||
|
*
|
||||||
* Revision 1.13 1998/01/24 00:04:59 curt
|
* Revision 1.13 1998/01/24 00:04:59 curt
|
||||||
* misc. tweaks.
|
* misc. tweaks.
|
||||||
*
|
*
|
||||||
|
|
|
@ -20,4 +20,4 @@ libLaRCsim_la_SOURCES = \
|
||||||
navion_init.c navion_init.h \
|
navion_init.c navion_init.h \
|
||||||
ls_interface.c ls_interface.h
|
ls_interface.c ls_interface.h
|
||||||
|
|
||||||
INCLUDES += -I$(top_builddir) -I$(top_builddir)/Simulator
|
INCLUDES += -I$(top_builddir) -I$(top_builddir)/Lib -I$(top_builddir)/Simulator
|
||||||
|
|
|
@ -335,7 +335,7 @@ installdirs mostlyclean-generic distclean-generic clean-generic \
|
||||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||||
|
|
||||||
|
|
||||||
INCLUDES += -I$(top_builddir) -I$(top_builddir)/Simulator
|
INCLUDES += -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.
|
||||||
|
|
|
@ -242,6 +242,9 @@ $Original log: LaRCsim.c,v $
|
||||||
#include "ls_init.h"
|
#include "ls_init.h"
|
||||||
#include <Flight/flight.h>
|
#include <Flight/flight.h>
|
||||||
#include <Aircraft/aircraft.h>
|
#include <Aircraft/aircraft.h>
|
||||||
|
#include <Autopilot/autopilot.h>
|
||||||
|
#include <Debug/fg_debug.h>
|
||||||
|
|
||||||
|
|
||||||
/* global variable declarations */
|
/* global variable declarations */
|
||||||
|
|
||||||
|
@ -545,15 +548,32 @@ int fgLaRCsimInit(double dt) {
|
||||||
|
|
||||||
|
|
||||||
/* Run an iteration of the EOM (equations of motion) */
|
/* Run an iteration of the EOM (equations of motion) */
|
||||||
int fgLaRCsimUpdate(int multiloop) {
|
int fgLaRCsimUpdate(fgFLIGHT *f, int multiloop) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (speedup > 0) {
|
if (speedup > 0) {
|
||||||
ls_cockpit();
|
ls_cockpit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// translate FG to LaRCsim structure
|
||||||
|
fgFlight_2_LaRCsim(f);
|
||||||
|
|
||||||
for ( i = 0; i < multiloop; i++ ) {
|
for ( i = 0; i < multiloop; i++ ) {
|
||||||
|
//Insertion by Jeff Goeke-Smith for Autopilot.
|
||||||
|
|
||||||
|
// run Autopilot system
|
||||||
|
fgPrintf( FG_ALL, FG_BULK,"Attempting autopilot run\n");
|
||||||
|
|
||||||
|
fgAPRun();
|
||||||
|
|
||||||
|
// end of insertion
|
||||||
|
|
||||||
ls_loop( model_dt, 0);
|
ls_loop( model_dt, 0);
|
||||||
|
|
||||||
|
// translate LaRCsim back to FG structure so that the
|
||||||
|
// autopilot (and the rest of the sim can use the updated
|
||||||
|
// values
|
||||||
|
fgLaRCsim_2_Flight(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
return(1);
|
return(1);
|
||||||
|
@ -914,6 +934,10 @@ int fgLaRCsim_2_Flight (fgFLIGHT *f) {
|
||||||
/* Flight Gear Modification Log
|
/* Flight Gear Modification Log
|
||||||
*
|
*
|
||||||
* $Log$
|
* $Log$
|
||||||
|
* Revision 1.18 1998/04/21 16:59:38 curt
|
||||||
|
* Integrated autopilot.
|
||||||
|
* Prepairing for C++ integration.
|
||||||
|
*
|
||||||
* Revision 1.17 1998/02/23 19:07:58 curt
|
* Revision 1.17 1998/02/23 19:07:58 curt
|
||||||
* Incorporated Durk's Astro/ tweaks. Includes unifying the sun position
|
* Incorporated Durk's Astro/ tweaks. Includes unifying the sun position
|
||||||
* calculation code between sun display, and other FG sections that use this
|
* calculation code between sun display, and other FG sections that use this
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
int fgLaRCsimInit(double dt);
|
int fgLaRCsimInit(double dt);
|
||||||
|
|
||||||
/* update position based on inputs, positions, velocities, etc. */
|
/* update position based on inputs, positions, velocities, etc. */
|
||||||
int fgLaRCsimUpdate(int multiloop);
|
int fgLaRCsimUpdate(fgFLIGHT *f, int multiloop);
|
||||||
|
|
||||||
/* Convert from the fgFLIGHT struct to the LaRCsim generic_ struct */
|
/* Convert from the fgFLIGHT struct to the LaRCsim generic_ struct */
|
||||||
int fgFlight_2_LaRCsim (fgFLIGHT *f);
|
int fgFlight_2_LaRCsim (fgFLIGHT *f);
|
||||||
|
@ -51,10 +51,14 @@ void ls_loop( SCALAR dt, int initialize );
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.7 1998/02/07 15:29:39 curt
|
/* Revision 1.8 1998/04/21 16:59:39 curt
|
||||||
/* Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss
|
/* Integrated autopilot.
|
||||||
/* <chotchkiss@namg.us.anritsu.com>
|
/* Prepairing for C++ integration.
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.7 1998/02/07 15:29:39 curt
|
||||||
|
* Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss
|
||||||
|
* <chotchkiss@namg.us.anritsu.com>
|
||||||
|
*
|
||||||
* Revision 1.6 1998/02/03 23:20:17 curt
|
* Revision 1.6 1998/02/03 23:20:17 curt
|
||||||
* Lots of little tweaks to fix various consistency problems discovered by
|
* Lots of little tweaks to fix various consistency problems discovered by
|
||||||
* Solaris' CC. Fixed a bug in fg_debug.c with how the fgPrintf() wrapper
|
* Solaris' CC. Fixed a bug in fg_debug.c with how the fgPrintf() wrapper
|
||||||
|
|
Loading…
Add table
Reference in a new issue