]> git.mxchange.org Git - flightgear.git/commit
From David Megginson:
authorcurt <curt>
Thu, 5 Apr 2001 20:20:44 +0000 (20:20 +0000)
committercurt <curt>
Thu, 5 Apr 2001 20:20:44 +0000 (20:20 +0000)
commit65f6e343ab83b6c48ee8a74dbf3261715543b3dd
tree530df4442f8841569998d7eb92279ecf5680f8a5
parent397a83d69f4203abc2cc90519814d268bc23f4bd
From David Megginson:

The files in the attached tarball make the following changes to
FlightGear:

- rename the existing FGInterface::init() method to
FGInterface::_setup to get it out of the way

- move *all* FDM initialization code out of src/Main/fg_init.cxx and
into FGInterface::init(), and clean up fg_init.cxx a little
(especially by removing the zillions of attempts to place the plane on
the ground at various locations in the code)

- modify FGInterface::bind() so that no values are picked up
automatically at bind time (they are set previously by init() instead)

- modify the init() methods of the classes derived from FGInterface
(i.e. larcsim, jsbsim, balloon, magic, and ada) to invoke
FGInterface::init() explicitly before doing their own setup

I don't claim that the code in FGInterface::init() is optimal (or even
correct), but it seems to work for on-ground starts with both LaRCSim
and JSBSim on runways pointing various directions from near sea level
to about 700' ASL (the range I happened to test).  I expect that Jon
and Tony will want to look at the code and refactor and correct it now
that they can see what's going on in one place.

Here's a quick outline of what is invoked:

  cur_fdm_state = new <whatever>(dt);
  cur_fdm_state->init();
  cur_fdm_state->bind();

The constructor allocates memory and sets default values only (with
the help of the FGInterface::_setup() method).  The init() method pull
any required properties out of the property tree and sets up the
initial state of the FDM.  The bind() method takes ownership of
FDM-related properties so that the FDM can publish them to the rest of
the sim.

Note that bind() and init() are virtual, so any implementation in a
subclass will hide the implementation in FGInterface; that's why
subclass implementations of init() and bind() have to invoke
FGInterface::init() and FGInterface::bind() explicitly, probably at
the start, so that they get the basic initialization.
src/FDM/ADA.cxx
src/FDM/Balloon.cxx
src/FDM/JSBSim.cxx
src/FDM/LaRCsim.cxx
src/FDM/MagicCarpet.cxx
src/FDM/flight.cxx
src/FDM/flight.hxx
src/Main/fg_init.cxx