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).
This commit is contained in:
parent
fee8c33799
commit
daabe407aa
6 changed files with 106 additions and 4 deletions
|
@ -11,7 +11,8 @@ libFlight_a_SOURCES = \
|
||||||
JSBSim.cxx JSBSim.hxx \
|
JSBSim.cxx JSBSim.hxx \
|
||||||
LaRCsim.cxx LaRCsim.hxx \
|
LaRCsim.cxx LaRCsim.hxx \
|
||||||
LaRCsimIC.cxx LaRCsimIC.hxx \
|
LaRCsimIC.cxx LaRCsimIC.hxx \
|
||||||
MagicCarpet.cxx MagicCarpet.hxx
|
MagicCarpet.cxx MagicCarpet.hxx \
|
||||||
|
NullFDM.cxx NullFDM.hxx
|
||||||
|
|
||||||
bin_PROGRAMS = pstest
|
bin_PROGRAMS = pstest
|
||||||
|
|
||||||
|
|
50
src/FDM/NullFDM.cxx
Normal file
50
src/FDM/NullFDM.cxx
Normal file
|
@ -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;
|
||||||
|
}
|
46
src/FDM/NullFDM.hxx
Normal file
46
src/FDM/NullFDM.hxx
Normal file
|
@ -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
|
|
@ -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. */
|
/* Define to empty if the keyword does not work. */
|
||||||
#undef const
|
#undef const
|
||||||
|
|
|
@ -81,6 +81,7 @@
|
||||||
#include <FDM/JSBSim.hxx>
|
#include <FDM/JSBSim.hxx>
|
||||||
#include <FDM/LaRCsim.hxx>
|
#include <FDM/LaRCsim.hxx>
|
||||||
#include <FDM/MagicCarpet.hxx>
|
#include <FDM/MagicCarpet.hxx>
|
||||||
|
#include <FDM/NullFDM.hxx>
|
||||||
#include <Include/general.hxx>
|
#include <Include/general.hxx>
|
||||||
#include <Input/input.hxx>
|
#include <Input/input.hxx>
|
||||||
// #include <Joystick/joystick.hxx>
|
// #include <Joystick/joystick.hxx>
|
||||||
|
@ -557,6 +558,8 @@ bool fgInitSubsystems( void ) {
|
||||||
cur_fdm_state = new FGMagicCarpet( dt );
|
cur_fdm_state = new FGMagicCarpet( dt );
|
||||||
} else if (model == "external") {
|
} else if (model == "external") {
|
||||||
cur_fdm_state = new FGExternal( dt );
|
cur_fdm_state = new FGExternal( dt );
|
||||||
|
} else if (model == "null") {
|
||||||
|
cur_fdm_state = new FGNullFDM( dt );
|
||||||
} else {
|
} else {
|
||||||
SG_LOG(SG_GENERAL, SG_ALERT,
|
SG_LOG(SG_GENERAL, SG_ALERT,
|
||||||
"Unrecognized flight model '" << model
|
"Unrecognized flight model '" << model
|
||||||
|
@ -929,6 +932,8 @@ void fgReInitSubsystems( void )
|
||||||
cur_fdm_state = new FGMagicCarpet( dt );
|
cur_fdm_state = new FGMagicCarpet( dt );
|
||||||
} else if (model == "external") {
|
} else if (model == "external") {
|
||||||
cur_fdm_state = new FGExternal( dt );
|
cur_fdm_state = new FGExternal( dt );
|
||||||
|
} else if (model == "null") {
|
||||||
|
cur_fdm_state = new FGNullFDM( dt );
|
||||||
} else {
|
} else {
|
||||||
SG_LOG(SG_GENERAL, SG_ALERT,
|
SG_LOG(SG_GENERAL, SG_ALERT,
|
||||||
"Unrecognized flight model '" << model
|
"Unrecognized flight model '" << model
|
||||||
|
|
|
@ -876,7 +876,7 @@ parse_option (const string& arg)
|
||||||
|
|
||||||
// convert to fps
|
// convert to fps
|
||||||
speed *= SG_NM_TO_METER * SG_METER_TO_FEET * (1.0/3600);
|
speed *= SG_NM_TO_METER * SG_METER_TO_FEET * (1.0/3600);
|
||||||
dir += 180;
|
// dir += 180;
|
||||||
if (dir >= 360)
|
if (dir >= 360)
|
||||||
dir -= 360;
|
dir -= 360;
|
||||||
dir *= SGD_DEGREES_TO_RADIANS;
|
dir *= SGD_DEGREES_TO_RADIANS;
|
||||||
|
@ -1086,7 +1086,7 @@ fgUsage ()
|
||||||
|
|
||||||
cout << "Flight Model:" << endl;
|
cout << "Flight Model:" << endl;
|
||||||
cout << "\t--fdm=abcd: selects the core flight model code." << 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;
|
<< endl;
|
||||||
cout << "\t--aircraft=abcd: aircraft model to load" << endl;
|
cout << "\t--aircraft=abcd: aircraft model to load" << endl;
|
||||||
cout << "\t--model-hz=n: run the FDM this rate (iterations per second)"
|
cout << "\t--model-hz=n: run the FDM this rate (iterations per second)"
|
||||||
|
|
Loading…
Reference in a new issue