From daabe407aab19d49d3ab0bd2c0ba9bcbdba939d5 Mon Sep 17 00:00:00 2001 From: curt Date: Mon, 12 Nov 2001 04:49:06 +0000 Subject: [PATCH] Add the "null" flight model which is a better name for what the "external" flightmodel used to be called. Fixed wind (it was 180 degrees off). --- src/FDM/Makefile.am | 3 ++- src/FDM/NullFDM.cxx | 50 +++++++++++++++++++++++++++++++++++++++++ src/FDM/NullFDM.hxx | 46 +++++++++++++++++++++++++++++++++++++ src/Include/config.h.in | 2 +- src/Main/fg_init.cxx | 5 +++++ src/Main/options.cxx | 4 ++-- 6 files changed, 106 insertions(+), 4 deletions(-) create mode 100644 src/FDM/NullFDM.cxx create mode 100644 src/FDM/NullFDM.hxx diff --git a/src/FDM/Makefile.am b/src/FDM/Makefile.am index 5a3bc036c..485dbf5d8 100644 --- a/src/FDM/Makefile.am +++ b/src/FDM/Makefile.am @@ -11,7 +11,8 @@ libFlight_a_SOURCES = \ JSBSim.cxx JSBSim.hxx \ LaRCsim.cxx LaRCsim.hxx \ LaRCsimIC.cxx LaRCsimIC.hxx \ - MagicCarpet.cxx MagicCarpet.hxx + MagicCarpet.cxx MagicCarpet.hxx \ + NullFDM.cxx NullFDM.hxx bin_PROGRAMS = pstest diff --git a/src/FDM/NullFDM.cxx b/src/FDM/NullFDM.cxx new file mode 100644 index 000000000..54b410228 --- /dev/null +++ b/src/FDM/NullFDM.cxx @@ -0,0 +1,50 @@ +// NullFDM.hxx -- a do-nothing flight model, used as a placeholder if the +// action is externally driven. +// Written by Curtis Olson, started November 1999. +// +// Copyright (C) 1999 - 2001 Curtis L. Olson - curt@flightgear.org +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +// +// $Id$ + + +#include "NullFDM.hxx" + + +FGNullFDM::FGNullFDM( double dt ) { + set_delta_t( dt ); +} + + +FGNullFDM::~FGNullFDM() { +} + + +// Initialize the NullFDM flight model, dt is the time increment +// for each subsequent iteration through the EOM +void FGNullFDM::init() { + // cout << "FGNullFDM::init()" << endl; +} + + +// Run an iteration of the EOM. This is a NOP here because the flight +// model values are getting filled in elsewhere (most likely from some +// external source.) +bool FGNullFDM::update( int multiloop ) { + // cout << "FGNullFDM::update()" << endl; + + return true; +} diff --git a/src/FDM/NullFDM.hxx b/src/FDM/NullFDM.hxx new file mode 100644 index 000000000..94dd32826 --- /dev/null +++ b/src/FDM/NullFDM.hxx @@ -0,0 +1,46 @@ +// NullFDM.hxx -- a do-nothing flight model, used as a placeholder if the +// action is externally driven. +// +// Written by Curtis Olson, started November 1999. +// +// Copyright (C) 1999 - 2001 Curtis L. Olson - curt@flightgear.org +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +// +// $Id$ + + +#ifndef _NULLFDM_HXX +#define _NULLFDM_HXX + + +#include "flight.hxx" + + +class FGNullFDM: public FGInterface { + +public: + FGNullFDM::FGNullFDM( double dt ); + FGNullFDM::~FGNullFDM(); + + // reset flight params to a specific position + void init(); + + // update position based on inputs, positions, velocities, etc. + bool update( int multiloop ); +}; + + +#endif // _NULLFDM_HXX diff --git a/src/Include/config.h.in b/src/Include/config.h.in index 3c18956c7..553a55a5a 100644 --- a/src/Include/config.h.in +++ b/src/Include/config.h.in @@ -1,4 +1,4 @@ -/* src/Include/config.h.in. Generated automatically from configure.in by autoheader. */ +/* src/Include/config.h.in. Generated automatically from configure.in by autoheader 2.13. */ /* Define to empty if the keyword does not work. */ #undef const diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index d39a22457..4632eb313 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -81,6 +81,7 @@ #include #include #include +#include #include #include // #include @@ -557,6 +558,8 @@ bool fgInitSubsystems( void ) { cur_fdm_state = new FGMagicCarpet( dt ); } else if (model == "external") { cur_fdm_state = new FGExternal( dt ); + } else if (model == "null") { + cur_fdm_state = new FGNullFDM( dt ); } else { SG_LOG(SG_GENERAL, SG_ALERT, "Unrecognized flight model '" << model @@ -929,6 +932,8 @@ void fgReInitSubsystems( void ) cur_fdm_state = new FGMagicCarpet( dt ); } else if (model == "external") { cur_fdm_state = new FGExternal( dt ); + } else if (model == "null") { + cur_fdm_state = new FGNullFDM( dt ); } else { SG_LOG(SG_GENERAL, SG_ALERT, "Unrecognized flight model '" << model diff --git a/src/Main/options.cxx b/src/Main/options.cxx index 0662cf676..1796c8cc0 100644 --- a/src/Main/options.cxx +++ b/src/Main/options.cxx @@ -876,7 +876,7 @@ parse_option (const string& arg) // convert to fps speed *= SG_NM_TO_METER * SG_METER_TO_FEET * (1.0/3600); - dir += 180; + // dir += 180; if (dir >= 360) dir -= 360; dir *= SGD_DEGREES_TO_RADIANS; @@ -1086,7 +1086,7 @@ fgUsage () cout << "Flight Model:" << endl; cout << "\t--fdm=abcd: selects the core flight model code." << endl; - cout << "\t\tcan be one of jsb, larcsim, magic, external, balloon, or ada" + cout << "\t\tcan be one of jsb, larcsim, magic, null, external, balloon, or ada" << endl; cout << "\t--aircraft=abcd: aircraft model to load" << endl; cout << "\t--model-hz=n: run the FDM this rate (iterations per second)"