2001-07-13 05:12:53 +00:00
|
|
|
// flight.cxx -- a general interface to the various flight models
|
1998-09-29 14:56:30 +00:00
|
|
|
//
|
|
|
|
// Written by Curtis Olson, started May 1997.
|
|
|
|
//
|
2004-11-19 22:10:41 +00:00
|
|
|
// Copyright (C) 1997 Curtis L. Olson - http://www.flightgear.org/~curt
|
1998-09-29 14:56:30 +00:00
|
|
|
//
|
|
|
|
// 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
|
2006-02-21 01:16:04 +00:00
|
|
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
1998-09-29 14:56:30 +00:00
|
|
|
//
|
|
|
|
// $Id$
|
|
|
|
|
2006-02-18 13:58:09 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
1997-05-29 02:35:04 +00:00
|
|
|
|
2007-07-29 10:21:22 +00:00
|
|
|
#include "flight.hxx"
|
2001-11-12 16:06:29 +00:00
|
|
|
|
2000-02-15 03:30:01 +00:00
|
|
|
#include <simgear/constants.h>
|
2000-02-16 23:01:03 +00:00
|
|
|
#include <simgear/debug/logstream.hxx>
|
2007-07-29 10:21:22 +00:00
|
|
|
#include <simgear/math/SGMath.hxx>
|
2000-11-30 18:43:31 +00:00
|
|
|
#include <simgear/timing/timestamp.hxx>
|
2000-02-15 03:30:01 +00:00
|
|
|
|
2000-10-28 16:30:30 +00:00
|
|
|
#include <Scenery/scenery.hxx>
|
2000-10-19 23:09:33 +00:00
|
|
|
#include <Main/globals.hxx>
|
2001-01-16 20:21:03 +00:00
|
|
|
#include <Main/fg_props.hxx>
|
2004-11-22 10:10:33 +00:00
|
|
|
#include <FDM/groundcache.hxx>
|
1997-05-29 02:35:04 +00:00
|
|
|
|
1999-02-26 22:09:10 +00:00
|
|
|
|
2007-07-29 10:21:22 +00:00
|
|
|
static inline void assign(double* ptr, const SGVec3d& vec)
|
|
|
|
{
|
|
|
|
ptr[0] = vec[0];
|
|
|
|
ptr[1] = vec[1];
|
|
|
|
ptr[2] = vec[2];
|
|
|
|
}
|
1998-02-07 15:29:31 +00:00
|
|
|
|
2000-08-14 20:12:17 +00:00
|
|
|
// Constructor
|
2002-06-28 19:06:23 +00:00
|
|
|
FGInterface::FGInterface()
|
|
|
|
{
|
2001-04-05 20:20:44 +00:00
|
|
|
_setup();
|
2001-12-07 22:38:19 +00:00
|
|
|
}
|
2001-04-02 20:14:04 +00:00
|
|
|
|
2002-06-28 19:06:23 +00:00
|
|
|
FGInterface::FGInterface( double dt )
|
|
|
|
{
|
2001-04-05 20:20:44 +00:00
|
|
|
_setup();
|
2001-04-02 20:14:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Destructor
|
|
|
|
FGInterface::~FGInterface() {
|
2001-12-07 22:38:19 +00:00
|
|
|
// unbind(); // FIXME: should be called explicitly
|
2001-04-02 20:14:04 +00:00
|
|
|
}
|
|
|
|
|
2002-05-11 16:28:50 +00:00
|
|
|
int
|
|
|
|
FGInterface::_calc_multiloop (double dt)
|
|
|
|
{
|
2009-03-17 06:51:48 +00:00
|
|
|
// Since some time the simulation time increments we get here are
|
|
|
|
// already a multiple of the basic update freqency.
|
|
|
|
// So, there is no need to do our own multiloop rounding with all bad
|
|
|
|
// roundoff problems when we already have nearly accurate values.
|
|
|
|
// Only the speedup thing must be still handled here
|
2002-05-11 16:28:50 +00:00
|
|
|
int hz = fgGetInt("/sim/model-hz");
|
2009-03-17 06:51:48 +00:00
|
|
|
int multiloop = SGMiscd::roundToInt(dt*hz);
|
2002-05-11 16:28:50 +00:00
|
|
|
int speedup = fgGetInt("/sim/speed-up");
|
2009-03-17 06:51:48 +00:00
|
|
|
return multiloop * speedup;
|
2002-05-11 16:28:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-04-05 20:20:44 +00:00
|
|
|
/**
|
|
|
|
* Set default values for the state of the FDM.
|
|
|
|
*
|
|
|
|
* This method is invoked by the constructors.
|
|
|
|
*/
|
2001-04-02 20:14:04 +00:00
|
|
|
void
|
2001-04-05 20:20:44 +00:00
|
|
|
FGInterface::_setup ()
|
2001-04-02 20:14:04 +00:00
|
|
|
{
|
2001-10-28 16:16:30 +00:00
|
|
|
inited = false;
|
|
|
|
bound = false;
|
|
|
|
|
2007-07-29 10:21:22 +00:00
|
|
|
d_cg_rp_body_v = SGVec3d::zeros();
|
|
|
|
v_dot_local_v = SGVec3d::zeros();
|
|
|
|
v_dot_body_v = SGVec3d::zeros();
|
|
|
|
a_cg_body_v = SGVec3d::zeros();
|
|
|
|
a_pilot_body_v = SGVec3d::zeros();
|
|
|
|
n_cg_body_v = SGVec3d::zeros();
|
|
|
|
v_local_v = SGVec3d::zeros();
|
|
|
|
v_local_rel_ground_v = SGVec3d::zeros();
|
|
|
|
v_local_airmass_v = SGVec3d::zeros();
|
|
|
|
v_wind_body_v = SGVec3d::zeros();
|
|
|
|
omega_body_v = SGVec3d::zeros();
|
|
|
|
euler_rates_v = SGVec3d::zeros();
|
|
|
|
geocentric_rates_v = SGVec3d::zeros();
|
|
|
|
geodetic_position_v = SGGeod::fromRadM(0, 0, 0);
|
|
|
|
cartesian_position_v = SGVec3d::fromGeod(geodetic_position_v);
|
|
|
|
geocentric_position_v = SGGeoc::fromCart(cartesian_position_v);
|
|
|
|
euler_angles_v = SGVec3d::zeros();
|
|
|
|
|
2001-12-07 22:38:19 +00:00
|
|
|
nlf=0;
|
2007-07-29 10:21:22 +00:00
|
|
|
v_rel_wind=v_true_kts=0;
|
|
|
|
v_ground_speed=v_equiv_kts=0;
|
|
|
|
v_calibrated_kts=0;
|
|
|
|
alpha=beta=0;
|
|
|
|
gamma_vert_rad=0;
|
|
|
|
density=mach_number=0;
|
|
|
|
static_pressure=total_pressure=0;
|
I tested:
LaRCsim c172 on-ground and in-air starts, reset: all work
UIUC Cessna172 on-ground and in-air starts work as expected, reset
results in an aircraft that is upside down but does not crash FG. I
don't know what it was like before, so it may well be no change.
JSBSim c172 and X15 in-air starts work fine, resets now work (and are
trimmed), on-ground starts do not -- the c172 ends up on its back. I
suspect this is no worse than before.
I did not test:
Balloon (the weather code returns nan's for the atmosphere data --this
is in the weather module and apparently is a linux only bug)
ADA (don't know how)
MagicCarpet (needs work yet)
External (don't know how)
known to be broken:
LaRCsim c172 on-ground starts with a negative terrain altitude (this
happens at KPAO when the scenery is not present). The FDM inits to
about 50 feet AGL and the model falls to the ground. It does stay
upright, however, and seems to be fine once it settles out, FWIW.
To do:
--implement set_Model on the bus
--bring Christian's weather data into JSBSim
-- add default method to bus for updating things like the sin and cos of
latitude (for Balloon, MagicCarpet)
-- lots of cleanup
The files:
src/FDM/flight.cxx
src/FDM/flight.hxx
-- all data members now declared protected instead of private.
-- eliminated all but a small set of 'setters', no change to getters.
-- that small set is declared virtual, the default implementation
provided preserves the old behavior
-- all of the vector data members are now initialized.
-- added busdump() method -- FG_LOG's all the bus data when called,
useful for diagnostics.
src/FDM/ADA.cxx
-- bus data members now directly assigned to
src/FDM/Balloon.cxx
-- bus data members now directly assigned to
-- changed V_equiv_kts to V_calibrated_kts
src/FDM/JSBSim.cxx
src/FDM/JSBSim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with JSBSim specific
logic
-- changed the static FDMExec to a dynamic fdmex (needed so that the
JSBSim object can be deleted when a model change is called for)
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- added logic to bring up FGEngInterface objects and set the RPM and
throttle values.
src/FDM/LaRCsim.cxx
src/FDM/LaRCsim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with LaRCsim specific
logic, uses LaRCsimIC
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- moved default inertias to here from fg_init.cxx
-- eliminated the climb rate calculation. The equivalent, climb_rate =
-1*vdown, is now in copy_from_LaRCsim().
src/FDM/LaRCsimIC.cxx
src/FDM/LaRCsimIC.hxx
-- similar to FGInitialCondition, this class has all the logic needed to
turn data like Vc and Mach into the more fundamental quantities LaRCsim
needs to initialize.
-- put it in src/FDM since it is a class
src/FDM/MagicCarpet.cxx
-- bus data members now directly assigned to
src/FDM/Makefile.am
-- adds LaRCsimIC.hxx and cxx
src/FDM/JSBSim/FGAtmosphere.h
src/FDM/JSBSim/FGDefs.h
src/FDM/JSBSim/FGInitialCondition.cpp
src/FDM/JSBSim/FGInitialCondition.h
src/FDM/JSBSim/JSBSim.cpp
-- changes to accomodate the new bus
src/FDM/LaRCsim/atmos_62.h
src/FDM/LaRCsim/ls_geodesy.h
-- surrounded prototypes with #ifdef __cplusplus ... #endif , functions
here are needed in LaRCsimIC
src/FDM/LaRCsim/c172_main.c
src/FDM/LaRCsim/cherokee_aero.c
src/FDM/LaRCsim/ls_aux.c
src/FDM/LaRCsim/ls_constants.h
src/FDM/LaRCsim/ls_geodesy.c
src/FDM/LaRCsim/ls_geodesy.h
src/FDM/LaRCsim/ls_step.c
src/FDM/UIUCModel/uiuc_betaprobe.cpp
-- changed PI to LS_PI, eliminates preprocessor naming conflict with
weather module
src/FDM/LaRCsim/ls_interface.c
src/FDM/LaRCsim/ls_interface.h
-- added function ls_set_model_dt()
src/Main/bfi.cxx
-- eliminated calls that set the NED speeds to body components. They
are no longer needed and confuse the new bus.
src/Main/fg_init.cxx
-- eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). or set default values. The bus now handles the
defaults and updates itself when the setters are called (for LaRCsim and
JSBSim). A default method for doing this needs to be added to the bus.
-- added fgVelocityInit() to set the speed the user asked for. Both
JSBSim and LaRCsim can now be initialized using any of:
vc,mach, NED components, UVW components.
src/Main/main.cxx
--eliminated call to fgFDMSetGroundElevation, this data is now 'pulled'
onto the bus every update()
src/Main/options.cxx
src/Main/options.hxx
-- added enum to keep track of the speed requested by the user
-- eliminated calls to set NED velocity properties to body speeds, they
are no longer needed.
-- added options for the NED components.
src/Network/garmin.cxx
src/Network/nmea.cxx
--eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). The bus now updates itself when the setters are
called (for LaRCsim and JSBSim). A default method for doing this needs
to be added to the bus.
-- changed set_V_equiv_kts to set_V_calibrated_kts. set_V_equiv_kts no
longer exists ( get_V_equiv_kts still does, though)
src/WeatherCM/FGLocalWeatherDatabase.cpp
-- commented out the code to put the weather data on the bus, a
different scheme for this is needed.
2000-10-24 00:34:50 +00:00
|
|
|
dynamic_pressure=0;
|
|
|
|
static_temperature=total_temperature=0;
|
|
|
|
sea_level_radius=earth_position_angle=0;
|
2007-07-29 10:21:22 +00:00
|
|
|
runway_altitude=0;
|
2001-12-07 22:38:19 +00:00
|
|
|
climb_rate=0;
|
I tested:
LaRCsim c172 on-ground and in-air starts, reset: all work
UIUC Cessna172 on-ground and in-air starts work as expected, reset
results in an aircraft that is upside down but does not crash FG. I
don't know what it was like before, so it may well be no change.
JSBSim c172 and X15 in-air starts work fine, resets now work (and are
trimmed), on-ground starts do not -- the c172 ends up on its back. I
suspect this is no worse than before.
I did not test:
Balloon (the weather code returns nan's for the atmosphere data --this
is in the weather module and apparently is a linux only bug)
ADA (don't know how)
MagicCarpet (needs work yet)
External (don't know how)
known to be broken:
LaRCsim c172 on-ground starts with a negative terrain altitude (this
happens at KPAO when the scenery is not present). The FDM inits to
about 50 feet AGL and the model falls to the ground. It does stay
upright, however, and seems to be fine once it settles out, FWIW.
To do:
--implement set_Model on the bus
--bring Christian's weather data into JSBSim
-- add default method to bus for updating things like the sin and cos of
latitude (for Balloon, MagicCarpet)
-- lots of cleanup
The files:
src/FDM/flight.cxx
src/FDM/flight.hxx
-- all data members now declared protected instead of private.
-- eliminated all but a small set of 'setters', no change to getters.
-- that small set is declared virtual, the default implementation
provided preserves the old behavior
-- all of the vector data members are now initialized.
-- added busdump() method -- FG_LOG's all the bus data when called,
useful for diagnostics.
src/FDM/ADA.cxx
-- bus data members now directly assigned to
src/FDM/Balloon.cxx
-- bus data members now directly assigned to
-- changed V_equiv_kts to V_calibrated_kts
src/FDM/JSBSim.cxx
src/FDM/JSBSim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with JSBSim specific
logic
-- changed the static FDMExec to a dynamic fdmex (needed so that the
JSBSim object can be deleted when a model change is called for)
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- added logic to bring up FGEngInterface objects and set the RPM and
throttle values.
src/FDM/LaRCsim.cxx
src/FDM/LaRCsim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with LaRCsim specific
logic, uses LaRCsimIC
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- moved default inertias to here from fg_init.cxx
-- eliminated the climb rate calculation. The equivalent, climb_rate =
-1*vdown, is now in copy_from_LaRCsim().
src/FDM/LaRCsimIC.cxx
src/FDM/LaRCsimIC.hxx
-- similar to FGInitialCondition, this class has all the logic needed to
turn data like Vc and Mach into the more fundamental quantities LaRCsim
needs to initialize.
-- put it in src/FDM since it is a class
src/FDM/MagicCarpet.cxx
-- bus data members now directly assigned to
src/FDM/Makefile.am
-- adds LaRCsimIC.hxx and cxx
src/FDM/JSBSim/FGAtmosphere.h
src/FDM/JSBSim/FGDefs.h
src/FDM/JSBSim/FGInitialCondition.cpp
src/FDM/JSBSim/FGInitialCondition.h
src/FDM/JSBSim/JSBSim.cpp
-- changes to accomodate the new bus
src/FDM/LaRCsim/atmos_62.h
src/FDM/LaRCsim/ls_geodesy.h
-- surrounded prototypes with #ifdef __cplusplus ... #endif , functions
here are needed in LaRCsimIC
src/FDM/LaRCsim/c172_main.c
src/FDM/LaRCsim/cherokee_aero.c
src/FDM/LaRCsim/ls_aux.c
src/FDM/LaRCsim/ls_constants.h
src/FDM/LaRCsim/ls_geodesy.c
src/FDM/LaRCsim/ls_geodesy.h
src/FDM/LaRCsim/ls_step.c
src/FDM/UIUCModel/uiuc_betaprobe.cpp
-- changed PI to LS_PI, eliminates preprocessor naming conflict with
weather module
src/FDM/LaRCsim/ls_interface.c
src/FDM/LaRCsim/ls_interface.h
-- added function ls_set_model_dt()
src/Main/bfi.cxx
-- eliminated calls that set the NED speeds to body components. They
are no longer needed and confuse the new bus.
src/Main/fg_init.cxx
-- eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). or set default values. The bus now handles the
defaults and updates itself when the setters are called (for LaRCsim and
JSBSim). A default method for doing this needs to be added to the bus.
-- added fgVelocityInit() to set the speed the user asked for. Both
JSBSim and LaRCsim can now be initialized using any of:
vc,mach, NED components, UVW components.
src/Main/main.cxx
--eliminated call to fgFDMSetGroundElevation, this data is now 'pulled'
onto the bus every update()
src/Main/options.cxx
src/Main/options.hxx
-- added enum to keep track of the speed requested by the user
-- eliminated calls to set NED velocity properties to body speeds, they
are no longer needed.
-- added options for the NED components.
src/Network/garmin.cxx
src/Network/nmea.cxx
--eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). The bus now updates itself when the setters are
called (for LaRCsim and JSBSim). A default method for doing this needs
to be added to the bus.
-- changed set_V_equiv_kts to set_V_calibrated_kts. set_V_equiv_kts no
longer exists ( get_V_equiv_kts still does, though)
src/WeatherCM/FGLocalWeatherDatabase.cpp
-- commented out the code to put the weather data on the bus, a
different scheme for this is needed.
2000-10-24 00:34:50 +00:00
|
|
|
altitude_agl=0;
|
2010-01-26 10:06:37 +00:00
|
|
|
track=0;
|
2001-01-16 20:21:03 +00:00
|
|
|
}
|
|
|
|
|
2001-11-06 22:33:05 +00:00
|
|
|
void
|
|
|
|
FGInterface::init () {}
|
2001-04-05 20:20:44 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialize the state of the FDM.
|
|
|
|
*
|
|
|
|
* Subclasses of FGInterface may do their own, additional initialization,
|
2001-11-06 22:33:05 +00:00
|
|
|
* but there is some that is common to all. Normally, they should call
|
2001-12-07 22:38:19 +00:00
|
|
|
* this before they begin their own init to make sure the basic structures
|
2001-11-06 22:33:05 +00:00
|
|
|
* are set up properly.
|
2001-04-05 20:20:44 +00:00
|
|
|
*/
|
|
|
|
void
|
2001-11-06 22:33:05 +00:00
|
|
|
FGInterface::common_init ()
|
2001-04-05 20:20:44 +00:00
|
|
|
{
|
2001-11-06 22:33:05 +00:00
|
|
|
SG_LOG( SG_FLIGHT, SG_INFO, "Start common FDM init" );
|
|
|
|
|
|
|
|
set_inited( true );
|
|
|
|
|
2009-03-15 18:18:21 +00:00
|
|
|
ground_cache.set_cache_time_offset(globals->get_sim_time_sec());
|
|
|
|
|
2001-11-06 22:33:05 +00:00
|
|
|
// Set initial position
|
|
|
|
SG_LOG( SG_FLIGHT, SG_INFO, "...initializing position..." );
|
Mathias Fröhlich:
I have introduced the posibility to start directly on the carrier.
With that patch you will have a --carrrier=id argument where id can either be
the pennant number configured in the nimitz scenario or the carriers name
also configured in the carriers scenario.
Additionaly you can use --parkpos=id to select different positions on the
carrier. They are also configured in the scenario file.
That includes the switch of the whole FGInterface class to make use of the
groundcache.
That means that an aircraft no longer uses the current elevation value from
the scenery class. It rather has its own local cache of the aircrafts
environment which is setup in the common_init method of FGInterface and
updated either manually by calling
FGInterface::get_groundlevel_m(lat, lon, alt_m);
or implicitly by calling the above method in the
FGInterface::_updateGeo*Position(lat, lon, alt);
methods.
A call get_groundlevel_m rebuilds the groundcache if the request is outside
the range of the cache.
Note that for the real usage of the groundcache including the correct
information about the movement of objects and the velocity information, you
still need to set up the groundcache in the usual way like YASim and JSBSim
currently does.
If you use the native interface, you will get only static objects correctly.
But for FDM's only using one single ground level for a whole step this is IMO
sufficient.
The AIManager gets a way to return the location of a object which is placed
wrt an AI Object. At the moment it only honours AICarriers for that.
That method is a static one, which loads the scenario file for that reason and
throws it away afterwards. This looked like the aprioriate way, because the
AIManager is initialized much later in flightgears bootstrap, and I did not
find an easy way to reorder that for my needs. Since this additional load is
very small and does only happen if such a relative location is required, I
think that this is ok.
Note that moving on the carrier will only work correctly for JSBSim and YASim,
but you should now be able to start and move on every not itself moving
object with any FDM.
2005-07-03 09:39:14 +00:00
|
|
|
double lon = fgGetDouble("/sim/presets/longitude-deg")
|
|
|
|
* SGD_DEGREES_TO_RADIANS;
|
|
|
|
double lat = fgGetDouble("/sim/presets/latitude-deg")
|
|
|
|
* SGD_DEGREES_TO_RADIANS;
|
|
|
|
double alt_ft = fgGetDouble("/sim/presets/altitude-ft");
|
|
|
|
double alt_m = alt_ft * SG_FEET_TO_METER;
|
|
|
|
set_Longitude( lon );
|
|
|
|
set_Latitude( lat );
|
2005-12-04 10:43:49 +00:00
|
|
|
SG_LOG( SG_FLIGHT, SG_INFO, "Checking for lon = "
|
|
|
|
<< lon*SGD_RADIANS_TO_DEGREES << "deg, lat = "
|
|
|
|
<< lat*SGD_RADIANS_TO_DEGREES << "deg, alt = "
|
|
|
|
<< alt_ft << "ft");
|
Mathias Fröhlich:
I have introduced the posibility to start directly on the carrier.
With that patch you will have a --carrrier=id argument where id can either be
the pennant number configured in the nimitz scenario or the carriers name
also configured in the carriers scenario.
Additionaly you can use --parkpos=id to select different positions on the
carrier. They are also configured in the scenario file.
That includes the switch of the whole FGInterface class to make use of the
groundcache.
That means that an aircraft no longer uses the current elevation value from
the scenery class. It rather has its own local cache of the aircrafts
environment which is setup in the common_init method of FGInterface and
updated either manually by calling
FGInterface::get_groundlevel_m(lat, lon, alt_m);
or implicitly by calling the above method in the
FGInterface::_updateGeo*Position(lat, lon, alt);
methods.
A call get_groundlevel_m rebuilds the groundcache if the request is outside
the range of the cache.
Note that for the real usage of the groundcache including the correct
information about the movement of objects and the velocity information, you
still need to set up the groundcache in the usual way like YASim and JSBSim
currently does.
If you use the native interface, you will get only static objects correctly.
But for FDM's only using one single ground level for a whole step this is IMO
sufficient.
The AIManager gets a way to return the location of a object which is placed
wrt an AI Object. At the moment it only honours AICarriers for that.
That method is a static one, which loads the scenario file for that reason and
throws it away afterwards. This looked like the aprioriate way, because the
AIManager is initialized much later in flightgears bootstrap, and I did not
find an easy way to reorder that for my needs. Since this additional load is
very small and does only happen if such a relative location is required, I
think that this is ok.
Note that moving on the carrier will only work correctly for JSBSim and YASim,
but you should now be able to start and move on every not itself moving
object with any FDM.
2005-07-03 09:39:14 +00:00
|
|
|
|
|
|
|
double ground_elev_m = get_groundlevel_m(lat, lon, alt_m);
|
2001-11-12 16:06:29 +00:00
|
|
|
double ground_elev_ft = ground_elev_m * SG_METER_TO_FEET;
|
From: "Jim Wilson" <jimw@kelcomaine.com>
This is a new improved patch for the previous tile manager fixes.
Rather than building dependencies between FGlocation or the viewer or fdm with
tilemgr what I ended up doing was linking the pieces together in the Mainloop
in main.cxx. You'll see what I mean...it's been commented fairly well. More
than likely we should move that chunk somewhere...just not sure where yet.
The changes seem clean now. As I get more ideas there could be some further
improvement in organizing the update in tilemgr. You'll note that I left an
override in there for the tilemgr::update() function to preserve earlier
functionality if someone needs it (e.g. usage independent of an fdm or
viewer), not to mention there are a few places in flightgear that call it
directly that have not been changed to the new interface (and may not need to be).
The code has been optimized to avoid duplicate traversals and seems to run
generally quite well. Note that there can be a short delay reloading tiles
that have been dropped from static views. We could call the tile scheduler on
a view switch, but it's not a big deal and at the moment I'd like to get this
in so people can try it and comment on it as it is.
Everything has been resycned with CVS tonight and I've included the
description submitted earlier (below).
Best,
Jim
Changes synced with CVS approx 20:30EDT 2002-05-09 (after this evenings updates).
Files:
http://www.spiderbark.com/fgfs/viewer-update-20020516.tar.gz
or
http://www.spiderbark.com/fgfs/viewer-update-20020516.diffs.gz
Description:
In a nutshell, these patches begin to take what was one value for ground
elevation and calculate ground elevation values seperately for the FDM and the
viewer (eye position). Several outstanding view related bugs have been fixed.
With the introduction of the new viewer code a lot of that Flight Gear code
broke related to use of a global variable called "scenery.cur_elev".
Therefore the ground_elevation and other associated items (like the current
tile bucket) is maintained per FDM instance and per View. Each of these has a
"point" or location that can be identified. See changes to FGLocation class
and main.cxx.
Most of the problems related to the new viewer in terms of sky, ground and
runway lights, and tower views are fixed.
There are four minor problems remaining. 1) The sun/moon spins when you pan
the "lookat" tower view only (view #3). 2) Under stress (esp. magic carpet
full speed with max visibility), there is a memory leak in the tile caching
that was not introduced with these changes. 3) I have not tested these
changes or made corrections to the ADA or External FDM interfaces. 4) The
change view function doesn't call the time/light update (not a problem unless
a tower is very far away).
Details:
FDM/flight.cxx, flight.hxx - FGInterface ties to FGAircraftModel so that it's
location data can be accessed for runway (ground elevation under aircraft)
elevation.
FDM/larsim.cxx, larcsim.hxx - gets runway elevation from FGInterface now.
Commented out function that is causing a namespace conflict, hasn't been
called with recent code anyway.
FDM/JSBSim/JSBSim.cxx, YASim/YASim.cxx - gets runway elevation from
FGInterface now.
Scenery/newcache.cxx, newcache.hxx - changed caching scheme to time based
(oldest tiles discard).
Scenery/tileentry.cxx, tileentry.hxx - added place to record time, changed
rendering to reference viewer altitude in order to fix a problem with ground
and runway lights.
Scenery/tilemgr.cxx, tilemgr.hxx - Modified update() to accept values for
multiple locations. Refresh function added in order to periodically make
the tiles current for a non-moving view (like a tower).
Main/fg_init.cxx - register event for making tiles current in a non-moving
view (like a tower).
Main/location.hxx - added support for current ground elevation data.
Main/main.cxx - added second tilemgr call for fdm, fixed places where viewer
position data was required for correct sky rendering.
Main/options.cxx - fixed segfault reported by Curtis when using --view-offset
command line parameter.
Main/viewer.cxx, viewer.hxx - removed fudging of view position. Fixed numerous
bugs that were causing eye and target values to get mixed up.
2002-05-17 17:25:28 +00:00
|
|
|
_set_Runway_altitude ( ground_elev_ft );
|
Mathias Fröhlich:
I have introduced the posibility to start directly on the carrier.
With that patch you will have a --carrrier=id argument where id can either be
the pennant number configured in the nimitz scenario or the carriers name
also configured in the carriers scenario.
Additionaly you can use --parkpos=id to select different positions on the
carrier. They are also configured in the scenario file.
That includes the switch of the whole FGInterface class to make use of the
groundcache.
That means that an aircraft no longer uses the current elevation value from
the scenery class. It rather has its own local cache of the aircrafts
environment which is setup in the common_init method of FGInterface and
updated either manually by calling
FGInterface::get_groundlevel_m(lat, lon, alt_m);
or implicitly by calling the above method in the
FGInterface::_updateGeo*Position(lat, lon, alt);
methods.
A call get_groundlevel_m rebuilds the groundcache if the request is outside
the range of the cache.
Note that for the real usage of the groundcache including the correct
information about the movement of objects and the velocity information, you
still need to set up the groundcache in the usual way like YASim and JSBSim
currently does.
If you use the native interface, you will get only static objects correctly.
But for FDM's only using one single ground level for a whole step this is IMO
sufficient.
The AIManager gets a way to return the location of a object which is placed
wrt an AI Object. At the moment it only honours AICarriers for that.
That method is a static one, which loads the scenario file for that reason and
throws it away afterwards. This looked like the aprioriate way, because the
AIManager is initialized much later in flightgears bootstrap, and I did not
find an easy way to reorder that for my needs. Since this additional load is
very small and does only happen if such a relative location is required, I
think that this is ok.
Note that moving on the carrier will only work correctly for JSBSim and YASim,
but you should now be able to start and move on every not itself moving
object with any FDM.
2005-07-03 09:39:14 +00:00
|
|
|
if ( fgGetBool("/sim/presets/onground") || alt_ft < ground_elev_ft ) {
|
|
|
|
fgSetDouble("/position/altitude-ft", ground_elev_ft + 0.1);
|
|
|
|
set_Altitude( ground_elev_ft + 0.1);
|
2004-04-05 16:47:13 +00:00
|
|
|
} else {
|
Mathias Fröhlich:
I have introduced the posibility to start directly on the carrier.
With that patch you will have a --carrrier=id argument where id can either be
the pennant number configured in the nimitz scenario or the carriers name
also configured in the carriers scenario.
Additionaly you can use --parkpos=id to select different positions on the
carrier. They are also configured in the scenario file.
That includes the switch of the whole FGInterface class to make use of the
groundcache.
That means that an aircraft no longer uses the current elevation value from
the scenery class. It rather has its own local cache of the aircrafts
environment which is setup in the common_init method of FGInterface and
updated either manually by calling
FGInterface::get_groundlevel_m(lat, lon, alt_m);
or implicitly by calling the above method in the
FGInterface::_updateGeo*Position(lat, lon, alt);
methods.
A call get_groundlevel_m rebuilds the groundcache if the request is outside
the range of the cache.
Note that for the real usage of the groundcache including the correct
information about the movement of objects and the velocity information, you
still need to set up the groundcache in the usual way like YASim and JSBSim
currently does.
If you use the native interface, you will get only static objects correctly.
But for FDM's only using one single ground level for a whole step this is IMO
sufficient.
The AIManager gets a way to return the location of a object which is placed
wrt an AI Object. At the moment it only honours AICarriers for that.
That method is a static one, which loads the scenario file for that reason and
throws it away afterwards. This looked like the aprioriate way, because the
AIManager is initialized much later in flightgears bootstrap, and I did not
find an easy way to reorder that for my needs. Since this additional load is
very small and does only happen if such a relative location is required, I
think that this is ok.
Note that moving on the carrier will only work correctly for JSBSim and YASim,
but you should now be able to start and move on every not itself moving
object with any FDM.
2005-07-03 09:39:14 +00:00
|
|
|
set_Altitude( alt_ft );
|
2001-11-06 22:33:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Set ground elevation
|
|
|
|
SG_LOG( SG_FLIGHT, SG_INFO,
|
|
|
|
"...initializing ground elevation to " << ground_elev_ft
|
|
|
|
<< "ft..." );
|
|
|
|
|
|
|
|
// Set sea-level radius
|
|
|
|
SG_LOG( SG_FLIGHT, SG_INFO, "...initializing sea-level radius..." );
|
|
|
|
SG_LOG( SG_FLIGHT, SG_INFO, " lat = "
|
2002-11-15 21:13:29 +00:00
|
|
|
<< fgGetDouble("/sim/presets/latitude-deg")
|
2004-04-05 16:47:13 +00:00
|
|
|
<< " alt = " << get_Altitude() );
|
2007-07-29 10:21:22 +00:00
|
|
|
double slr = SGGeodesy::SGGeodToSeaLevelRadius(geodetic_position_v);
|
|
|
|
_set_Sea_level_radius( slr * SG_METER_TO_FEET );
|
2001-11-06 22:33:05 +00:00
|
|
|
|
|
|
|
// Set initial velocities
|
|
|
|
SG_LOG( SG_FLIGHT, SG_INFO, "...initializing velocities..." );
|
2002-11-15 21:13:29 +00:00
|
|
|
if ( !fgHasNode("/sim/presets/speed-set") ) {
|
2001-11-06 22:33:05 +00:00
|
|
|
set_V_calibrated_kts(0.0);
|
2001-04-05 20:20:44 +00:00
|
|
|
} else {
|
2002-11-15 21:13:29 +00:00
|
|
|
const string speedset = fgGetString("/sim/presets/speed-set");
|
2001-11-06 22:33:05 +00:00
|
|
|
if ( speedset == "knots" || speedset == "KNOTS" ) {
|
2002-11-15 21:13:29 +00:00
|
|
|
set_V_calibrated_kts( fgGetDouble("/sim/presets/airspeed-kt") );
|
2001-11-06 22:33:05 +00:00
|
|
|
} else if ( speedset == "mach" || speedset == "MACH" ) {
|
2002-11-15 21:13:29 +00:00
|
|
|
set_Mach_number( fgGetDouble("/sim/presets/mach") );
|
2001-11-06 22:33:05 +00:00
|
|
|
} else if ( speedset == "UVW" || speedset == "uvw" ) {
|
|
|
|
set_Velocities_Wind_Body(
|
2002-11-15 21:13:29 +00:00
|
|
|
fgGetDouble("/sim/presets/uBody-fps"),
|
|
|
|
fgGetDouble("/sim/presets/vBody-fps"),
|
|
|
|
fgGetDouble("/sim/presets/wBody-fps") );
|
2001-11-06 22:33:05 +00:00
|
|
|
} else if ( speedset == "NED" || speedset == "ned" ) {
|
|
|
|
set_Velocities_Local(
|
2002-11-15 21:13:29 +00:00
|
|
|
fgGetDouble("/sim/presets/speed-north-fps"),
|
|
|
|
fgGetDouble("/sim/presets/speed-east-fps"),
|
|
|
|
fgGetDouble("/sim/presets/speed-down-fps") );
|
2001-11-06 22:33:05 +00:00
|
|
|
} else {
|
|
|
|
SG_LOG( SG_FLIGHT, SG_ALERT,
|
2002-11-15 21:13:29 +00:00
|
|
|
"Unrecognized value for /sim/presets/speed-set: "
|
2001-11-06 22:33:05 +00:00
|
|
|
<< speedset);
|
|
|
|
set_V_calibrated_kts( 0.0 );
|
|
|
|
}
|
2001-04-05 20:20:44 +00:00
|
|
|
}
|
|
|
|
|
2001-11-06 22:33:05 +00:00
|
|
|
// Set initial Euler angles
|
|
|
|
SG_LOG( SG_FLIGHT, SG_INFO, "...initializing Euler angles..." );
|
2002-11-15 21:13:29 +00:00
|
|
|
set_Euler_Angles( fgGetDouble("/sim/presets/roll-deg")
|
2001-11-06 22:33:05 +00:00
|
|
|
* SGD_DEGREES_TO_RADIANS,
|
2002-11-15 21:13:29 +00:00
|
|
|
fgGetDouble("/sim/presets/pitch-deg")
|
2001-11-06 22:33:05 +00:00
|
|
|
* SGD_DEGREES_TO_RADIANS,
|
2002-11-15 21:13:29 +00:00
|
|
|
fgGetDouble("/sim/presets/heading-deg")
|
2001-11-06 22:33:05 +00:00
|
|
|
* SGD_DEGREES_TO_RADIANS );
|
2001-04-05 20:20:44 +00:00
|
|
|
|
2001-11-06 22:33:05 +00:00
|
|
|
SG_LOG( SG_FLIGHT, SG_INFO, "End common FDM init" );
|
2001-04-05 20:20:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Bind getters and setters to properties.
|
|
|
|
*
|
|
|
|
* The bind() method will be invoked after init(). Note that unlike
|
|
|
|
* the usual implementations of FGSubsystem::bind(), this method does
|
|
|
|
* not automatically pick up existing values for the properties at
|
|
|
|
* bind time; instead, all values are set explicitly in the init()
|
|
|
|
* method.
|
|
|
|
*/
|
2001-01-16 20:21:03 +00:00
|
|
|
void
|
|
|
|
FGInterface::bind ()
|
|
|
|
{
|
2001-10-28 16:16:30 +00:00
|
|
|
bound = true;
|
|
|
|
|
2001-01-16 21:41:28 +00:00
|
|
|
// Aircraft position
|
2001-07-02 22:27:24 +00:00
|
|
|
fgTie("/position/latitude-deg", this,
|
2001-12-07 22:38:19 +00:00
|
|
|
&FGInterface::get_Latitude_deg,
|
|
|
|
&FGInterface::set_Latitude_deg,
|
|
|
|
false);
|
2001-07-12 23:35:18 +00:00
|
|
|
fgSetArchivable("/position/latitude-deg");
|
2001-07-02 22:27:24 +00:00
|
|
|
fgTie("/position/longitude-deg", this,
|
2001-12-07 22:38:19 +00:00
|
|
|
&FGInterface::get_Longitude_deg,
|
|
|
|
&FGInterface::set_Longitude_deg,
|
|
|
|
false);
|
2001-07-12 23:35:18 +00:00
|
|
|
fgSetArchivable("/position/longitude-deg");
|
2001-07-02 22:27:24 +00:00
|
|
|
fgTie("/position/altitude-ft", this,
|
2001-12-07 22:38:19 +00:00
|
|
|
&FGInterface::get_Altitude,
|
|
|
|
&FGInterface::set_Altitude,
|
|
|
|
false);
|
2001-07-12 23:35:18 +00:00
|
|
|
fgSetArchivable("/position/altitude-ft");
|
2001-07-02 22:27:24 +00:00
|
|
|
fgTie("/position/altitude-agl-ft", this,
|
2010-06-16 07:31:59 +00:00
|
|
|
&FGInterface::get_Altitude_AGL, &FGInterface::set_AltitudeAGL);
|
Mathias Fröhlich:
I have introduced the posibility to start directly on the carrier.
With that patch you will have a --carrrier=id argument where id can either be
the pennant number configured in the nimitz scenario or the carriers name
also configured in the carriers scenario.
Additionaly you can use --parkpos=id to select different positions on the
carrier. They are also configured in the scenario file.
That includes the switch of the whole FGInterface class to make use of the
groundcache.
That means that an aircraft no longer uses the current elevation value from
the scenery class. It rather has its own local cache of the aircrafts
environment which is setup in the common_init method of FGInterface and
updated either manually by calling
FGInterface::get_groundlevel_m(lat, lon, alt_m);
or implicitly by calling the above method in the
FGInterface::_updateGeo*Position(lat, lon, alt);
methods.
A call get_groundlevel_m rebuilds the groundcache if the request is outside
the range of the cache.
Note that for the real usage of the groundcache including the correct
information about the movement of objects and the velocity information, you
still need to set up the groundcache in the usual way like YASim and JSBSim
currently does.
If you use the native interface, you will get only static objects correctly.
But for FDM's only using one single ground level for a whole step this is IMO
sufficient.
The AIManager gets a way to return the location of a object which is placed
wrt an AI Object. At the moment it only honours AICarriers for that.
That method is a static one, which loads the scenario file for that reason and
throws it away afterwards. This looked like the aprioriate way, because the
AIManager is initialized much later in flightgears bootstrap, and I did not
find an easy way to reorder that for my needs. Since this additional load is
very small and does only happen if such a relative location is required, I
think that this is ok.
Note that moving on the carrier will only work correctly for JSBSim and YASim,
but you should now be able to start and move on every not itself moving
object with any FDM.
2005-07-03 09:39:14 +00:00
|
|
|
fgSetArchivable("/position/ground-elev-ft");
|
|
|
|
fgTie("/position/ground-elev-ft", this,
|
|
|
|
&FGInterface::get_Runway_altitude); // read-only
|
|
|
|
fgSetArchivable("/position/ground-elev-m");
|
|
|
|
fgTie("/position/ground-elev-m", this,
|
|
|
|
&FGInterface::get_Runway_altitude_m); // read-only
|
2005-08-14 12:57:12 +00:00
|
|
|
fgTie("/environment/ground-elevation-m", this,
|
|
|
|
&FGInterface::get_Runway_altitude_m); // read-only
|
Mathias Fröhlich:
I have introduced the posibility to start directly on the carrier.
With that patch you will have a --carrrier=id argument where id can either be
the pennant number configured in the nimitz scenario or the carriers name
also configured in the carriers scenario.
Additionaly you can use --parkpos=id to select different positions on the
carrier. They are also configured in the scenario file.
That includes the switch of the whole FGInterface class to make use of the
groundcache.
That means that an aircraft no longer uses the current elevation value from
the scenery class. It rather has its own local cache of the aircrafts
environment which is setup in the common_init method of FGInterface and
updated either manually by calling
FGInterface::get_groundlevel_m(lat, lon, alt_m);
or implicitly by calling the above method in the
FGInterface::_updateGeo*Position(lat, lon, alt);
methods.
A call get_groundlevel_m rebuilds the groundcache if the request is outside
the range of the cache.
Note that for the real usage of the groundcache including the correct
information about the movement of objects and the velocity information, you
still need to set up the groundcache in the usual way like YASim and JSBSim
currently does.
If you use the native interface, you will get only static objects correctly.
But for FDM's only using one single ground level for a whole step this is IMO
sufficient.
The AIManager gets a way to return the location of a object which is placed
wrt an AI Object. At the moment it only honours AICarriers for that.
That method is a static one, which loads the scenario file for that reason and
throws it away afterwards. This looked like the aprioriate way, because the
AIManager is initialized much later in flightgears bootstrap, and I did not
find an easy way to reorder that for my needs. Since this additional load is
very small and does only happen if such a relative location is required, I
think that this is ok.
Note that moving on the carrier will only work correctly for JSBSim and YASim,
but you should now be able to start and move on every not itself moving
object with any FDM.
2005-07-03 09:39:14 +00:00
|
|
|
fgSetArchivable("/position/sea-level-radius-ft");
|
|
|
|
fgTie("/position/sea-level-radius-ft", this,
|
2010-06-16 07:31:59 +00:00
|
|
|
&FGInterface::get_Sea_level_radius,
|
|
|
|
&FGInterface::_set_Sea_level_radius);
|
2001-01-16 20:21:03 +00:00
|
|
|
|
|
|
|
// Orientation
|
2001-07-02 22:27:24 +00:00
|
|
|
fgTie("/orientation/roll-deg", this,
|
2001-03-29 01:44:54 +00:00
|
|
|
&FGInterface::get_Phi_deg,
|
2001-04-05 20:20:44 +00:00
|
|
|
&FGInterface::set_Phi_deg);
|
2001-07-12 23:35:18 +00:00
|
|
|
fgSetArchivable("/orientation/roll-deg");
|
2001-07-02 22:27:24 +00:00
|
|
|
fgTie("/orientation/pitch-deg", this,
|
2001-03-29 01:44:54 +00:00
|
|
|
&FGInterface::get_Theta_deg,
|
2001-04-05 20:20:44 +00:00
|
|
|
&FGInterface::set_Theta_deg);
|
2001-07-12 23:35:18 +00:00
|
|
|
fgSetArchivable("/orientation/pitch-deg");
|
2001-07-02 22:27:24 +00:00
|
|
|
fgTie("/orientation/heading-deg", this,
|
2001-03-29 01:44:54 +00:00
|
|
|
&FGInterface::get_Psi_deg,
|
2001-04-05 20:20:44 +00:00
|
|
|
&FGInterface::set_Psi_deg);
|
2001-07-12 23:35:18 +00:00
|
|
|
fgSetArchivable("/orientation/heading-deg");
|
2010-01-02 18:29:01 +00:00
|
|
|
fgTie("/orientation/track-deg", this,
|
|
|
|
&FGInterface::get_Track);
|
2001-01-16 20:21:03 +00:00
|
|
|
|
2002-10-29 19:27:05 +00:00
|
|
|
// Body-axis "euler rates" (rotation speed, but in a funny
|
|
|
|
// representation).
|
|
|
|
fgTie("/orientation/roll-rate-degps", this,
|
2010-06-16 07:31:59 +00:00
|
|
|
&FGInterface::get_Phi_dot_degps, &FGInterface::set_Phi_dot_degps);
|
2002-10-29 19:27:05 +00:00
|
|
|
fgTie("/orientation/pitch-rate-degps", this,
|
2010-06-16 07:31:59 +00:00
|
|
|
&FGInterface::get_Theta_dot_degps, &FGInterface::set_Theta_dot_degps);
|
2002-10-29 19:27:05 +00:00
|
|
|
fgTie("/orientation/yaw-rate-degps", this,
|
2010-06-16 07:31:59 +00:00
|
|
|
&FGInterface::get_Psi_dot_degps, &FGInterface::set_Psi_dot_degps);
|
2002-10-29 19:27:05 +00:00
|
|
|
|
2010-06-16 07:31:59 +00:00
|
|
|
fgTie("/orientation/p-body", this, &FGInterface::get_P_body);
|
|
|
|
fgTie("/orientation/q-body", this, &FGInterface::get_Q_body);
|
|
|
|
fgTie("/orientation/r-body", this, &FGInterface::get_R_body);
|
|
|
|
|
2007-06-10 15:58:50 +00:00
|
|
|
// Ground speed knots
|
|
|
|
fgTie("/velocities/groundspeed-kt", this,
|
|
|
|
&FGInterface::get_V_ground_speed_kt);
|
|
|
|
|
2001-01-16 20:21:03 +00:00
|
|
|
// Calibrated airspeed
|
2001-07-02 22:27:24 +00:00
|
|
|
fgTie("/velocities/airspeed-kt", this,
|
2001-03-29 01:44:54 +00:00
|
|
|
&FGInterface::get_V_calibrated_kts,
|
2001-07-16 04:34:46 +00:00
|
|
|
&FGInterface::set_V_calibrated_kts,
|
2003-03-19 16:06:17 +00:00
|
|
|
false);
|
|
|
|
|
2010-06-16 07:31:59 +00:00
|
|
|
fgTie("/velocities/equivalent-kt", this,
|
|
|
|
&FGInterface::get_V_equiv_kts);
|
|
|
|
|
2003-03-19 16:06:17 +00:00
|
|
|
// Mach number
|
|
|
|
fgTie("/velocities/mach", this,
|
|
|
|
&FGInterface::get_Mach_number,
|
|
|
|
&FGInterface::set_Mach_number,
|
2001-07-16 04:34:46 +00:00
|
|
|
false);
|
2001-01-16 20:21:03 +00:00
|
|
|
|
|
|
|
// Local velocities
|
2001-07-13 21:45:48 +00:00
|
|
|
// fgTie("/velocities/speed-north-fps", this,
|
|
|
|
// &FGInterface::get_V_north,
|
|
|
|
// &FGInterface::set_V_north);
|
|
|
|
// fgSetArchivable("/velocities/speed-north-fps");
|
|
|
|
// fgTie("/velocities/speed-east-fps", this,
|
|
|
|
// &FGInterface::get_V_east,
|
|
|
|
// &FGInterface::set_V_east);
|
|
|
|
// fgSetArchivable("/velocities/speed-east-fps");
|
|
|
|
// fgTie("/velocities/speed-down-fps", this,
|
|
|
|
// &FGInterface::get_V_down,
|
|
|
|
// &FGInterface::set_V_down);
|
|
|
|
// fgSetArchivable("/velocities/speed-down-fps");
|
|
|
|
// FIXME: Temporarily read-only, until the
|
|
|
|
// incompatibilities between JSBSim and
|
|
|
|
// LaRCSim are fixed (LaRCSim adds the
|
|
|
|
// earth's rotation to the east velocity).
|
2001-07-02 22:27:24 +00:00
|
|
|
fgTie("/velocities/speed-north-fps", this,
|
2010-06-16 07:31:59 +00:00
|
|
|
&FGInterface::get_V_north, &FGInterface::set_V_north);
|
2001-07-02 22:27:24 +00:00
|
|
|
fgTie("/velocities/speed-east-fps", this,
|
2010-06-16 07:31:59 +00:00
|
|
|
&FGInterface::get_V_east, &FGInterface::set_V_east);
|
2001-07-02 22:27:24 +00:00
|
|
|
fgTie("/velocities/speed-down-fps", this,
|
2010-06-16 07:31:59 +00:00
|
|
|
&FGInterface::get_V_down, &FGInterface::set_V_down);
|
2001-01-16 20:21:03 +00:00
|
|
|
|
2010-06-26 13:21:16 +00:00
|
|
|
fgTie("/velocities/north-relground-fps", this,
|
|
|
|
&FGInterface::get_V_north_rel_ground);
|
|
|
|
fgTie("/velocities/east-relground-fps", this,
|
|
|
|
&FGInterface::get_V_east_rel_ground);
|
|
|
|
fgTie("/velocities/down-relground-fps", this,
|
|
|
|
&FGInterface::get_V_down_rel_ground);
|
|
|
|
|
|
|
|
|
2001-01-16 20:21:03 +00:00
|
|
|
// Relative wind
|
2001-07-13 21:45:48 +00:00
|
|
|
// FIXME: temporarily archivable, until
|
|
|
|
// the NED problem is fixed.
|
2001-07-02 22:27:24 +00:00
|
|
|
fgTie("/velocities/uBody-fps", this,
|
2001-03-29 01:44:54 +00:00
|
|
|
&FGInterface::get_uBody,
|
2001-07-16 04:34:46 +00:00
|
|
|
&FGInterface::set_uBody,
|
|
|
|
false);
|
2001-07-13 21:45:48 +00:00
|
|
|
fgSetArchivable("/velocities/uBody-fps");
|
2001-07-02 22:27:24 +00:00
|
|
|
fgTie("/velocities/vBody-fps", this,
|
2001-03-29 01:44:54 +00:00
|
|
|
&FGInterface::get_vBody,
|
2001-07-16 04:34:46 +00:00
|
|
|
&FGInterface::set_vBody,
|
|
|
|
false);
|
2001-07-13 21:45:48 +00:00
|
|
|
fgSetArchivable("/velocities/vBody-fps");
|
2001-07-02 22:27:24 +00:00
|
|
|
fgTie("/velocities/wBody-fps", this,
|
2001-03-29 01:44:54 +00:00
|
|
|
&FGInterface::get_wBody,
|
2001-07-16 04:34:46 +00:00
|
|
|
&FGInterface::set_wBody,
|
|
|
|
false);
|
2001-07-13 21:45:48 +00:00
|
|
|
fgSetArchivable("/velocities/wBody-fps");
|
2001-01-16 20:21:03 +00:00
|
|
|
|
|
|
|
// Climb and slip (read-only)
|
2001-07-02 22:27:24 +00:00
|
|
|
fgTie("/velocities/vertical-speed-fps", this,
|
2002-02-18 19:18:51 +00:00
|
|
|
&FGInterface::get_Climb_Rate,
|
|
|
|
&FGInterface::set_Climb_Rate );
|
|
|
|
fgTie("/velocities/glideslope", this,
|
|
|
|
&FGInterface::get_Gamma_vert_rad,
|
|
|
|
&FGInterface::set_Gamma_vert_rad );
|
2003-01-26 15:53:35 +00:00
|
|
|
fgTie("/orientation/side-slip-rad", this,
|
2010-06-16 07:31:59 +00:00
|
|
|
&FGInterface::get_Beta, &FGInterface::_set_Beta);
|
2003-01-26 15:53:35 +00:00
|
|
|
fgTie("/orientation/side-slip-deg", this,
|
2002-02-17 21:05:27 +00:00
|
|
|
&FGInterface::get_Beta_deg); // read-only
|
2003-01-26 15:53:35 +00:00
|
|
|
fgTie("/orientation/alpha-deg", this,
|
2010-06-16 07:31:59 +00:00
|
|
|
&FGInterface::get_Alpha_deg, &FGInterface::set_Alpha_deg); // read-only
|
2002-02-17 21:05:27 +00:00
|
|
|
fgTie("/accelerations/nlf", this,
|
|
|
|
&FGInterface::get_Nlf); // read-only
|
2003-01-25 17:25:30 +00:00
|
|
|
|
2003-01-26 15:53:35 +00:00
|
|
|
// NED accelerations
|
|
|
|
fgTie("/accelerations/ned/north-accel-fps_sec",
|
|
|
|
this, &FGInterface::get_V_dot_north);
|
|
|
|
fgTie("/accelerations/ned/east-accel-fps_sec",
|
|
|
|
this, &FGInterface::get_V_dot_east);
|
|
|
|
fgTie("/accelerations/ned/down-accel-fps_sec",
|
|
|
|
this, &FGInterface::get_V_dot_down);
|
|
|
|
|
2003-01-25 17:25:30 +00:00
|
|
|
// Pilot accelerations
|
2003-01-26 15:53:35 +00:00
|
|
|
fgTie("/accelerations/pilot/x-accel-fps_sec",
|
2010-06-16 07:31:59 +00:00
|
|
|
this, &FGInterface::get_A_X_pilot, &FGInterface::set_A_X_pilot);
|
2003-01-26 15:53:35 +00:00
|
|
|
fgTie("/accelerations/pilot/y-accel-fps_sec",
|
2010-06-16 07:31:59 +00:00
|
|
|
this, &FGInterface::get_A_Y_pilot, &FGInterface::set_A_Y_pilot);
|
2003-01-26 15:53:35 +00:00
|
|
|
fgTie("/accelerations/pilot/z-accel-fps_sec",
|
2010-06-16 07:31:59 +00:00
|
|
|
this, &FGInterface::get_A_Z_pilot, &FGInterface::set_A_Z_pilot);
|
2010-06-26 13:21:16 +00:00
|
|
|
|
|
|
|
fgTie("/accelerations/n-z-cg-fps_sec", this, &FGInterface::get_N_Z_cg);
|
2003-01-25 17:25:30 +00:00
|
|
|
|
2001-01-16 20:21:03 +00:00
|
|
|
}
|
|
|
|
|
2001-04-05 20:20:44 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Unbind any properties bound to this FDM.
|
|
|
|
*
|
|
|
|
* This method allows the FDM to release properties so that a new
|
|
|
|
* FDM can bind them instead.
|
|
|
|
*/
|
2001-01-16 20:21:03 +00:00
|
|
|
void
|
|
|
|
FGInterface::unbind ()
|
|
|
|
{
|
2010-07-01 01:04:16 +00:00
|
|
|
if (!bound) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2001-10-28 16:16:30 +00:00
|
|
|
bound = false;
|
|
|
|
|
2001-07-02 22:27:24 +00:00
|
|
|
fgUntie("/position/latitude-deg");
|
|
|
|
fgUntie("/position/longitude-deg");
|
|
|
|
fgUntie("/position/altitude-ft");
|
2001-10-28 16:16:30 +00:00
|
|
|
fgUntie("/position/altitude-agl-ft");
|
Mathias Fröhlich:
I have introduced the posibility to start directly on the carrier.
With that patch you will have a --carrrier=id argument where id can either be
the pennant number configured in the nimitz scenario or the carriers name
also configured in the carriers scenario.
Additionaly you can use --parkpos=id to select different positions on the
carrier. They are also configured in the scenario file.
That includes the switch of the whole FGInterface class to make use of the
groundcache.
That means that an aircraft no longer uses the current elevation value from
the scenery class. It rather has its own local cache of the aircrafts
environment which is setup in the common_init method of FGInterface and
updated either manually by calling
FGInterface::get_groundlevel_m(lat, lon, alt_m);
or implicitly by calling the above method in the
FGInterface::_updateGeo*Position(lat, lon, alt);
methods.
A call get_groundlevel_m rebuilds the groundcache if the request is outside
the range of the cache.
Note that for the real usage of the groundcache including the correct
information about the movement of objects and the velocity information, you
still need to set up the groundcache in the usual way like YASim and JSBSim
currently does.
If you use the native interface, you will get only static objects correctly.
But for FDM's only using one single ground level for a whole step this is IMO
sufficient.
The AIManager gets a way to return the location of a object which is placed
wrt an AI Object. At the moment it only honours AICarriers for that.
That method is a static one, which loads the scenario file for that reason and
throws it away afterwards. This looked like the aprioriate way, because the
AIManager is initialized much later in flightgears bootstrap, and I did not
find an easy way to reorder that for my needs. Since this additional load is
very small and does only happen if such a relative location is required, I
think that this is ok.
Note that moving on the carrier will only work correctly for JSBSim and YASim,
but you should now be able to start and move on every not itself moving
object with any FDM.
2005-07-03 09:39:14 +00:00
|
|
|
fgUntie("/position/ground-elev-ft");
|
|
|
|
fgUntie("/position/ground-elev-m");
|
2005-08-14 12:57:12 +00:00
|
|
|
fgUntie("/environment/ground-elevation-m");
|
Mathias Fröhlich:
I have introduced the posibility to start directly on the carrier.
With that patch you will have a --carrrier=id argument where id can either be
the pennant number configured in the nimitz scenario or the carriers name
also configured in the carriers scenario.
Additionaly you can use --parkpos=id to select different positions on the
carrier. They are also configured in the scenario file.
That includes the switch of the whole FGInterface class to make use of the
groundcache.
That means that an aircraft no longer uses the current elevation value from
the scenery class. It rather has its own local cache of the aircrafts
environment which is setup in the common_init method of FGInterface and
updated either manually by calling
FGInterface::get_groundlevel_m(lat, lon, alt_m);
or implicitly by calling the above method in the
FGInterface::_updateGeo*Position(lat, lon, alt);
methods.
A call get_groundlevel_m rebuilds the groundcache if the request is outside
the range of the cache.
Note that for the real usage of the groundcache including the correct
information about the movement of objects and the velocity information, you
still need to set up the groundcache in the usual way like YASim and JSBSim
currently does.
If you use the native interface, you will get only static objects correctly.
But for FDM's only using one single ground level for a whole step this is IMO
sufficient.
The AIManager gets a way to return the location of a object which is placed
wrt an AI Object. At the moment it only honours AICarriers for that.
That method is a static one, which loads the scenario file for that reason and
throws it away afterwards. This looked like the aprioriate way, because the
AIManager is initialized much later in flightgears bootstrap, and I did not
find an easy way to reorder that for my needs. Since this additional load is
very small and does only happen if such a relative location is required, I
think that this is ok.
Note that moving on the carrier will only work correctly for JSBSim and YASim,
but you should now be able to start and move on every not itself moving
object with any FDM.
2005-07-03 09:39:14 +00:00
|
|
|
fgUntie("/position/sea-level-radius-ft");
|
2001-10-28 16:16:30 +00:00
|
|
|
fgUntie("/orientation/roll-deg");
|
2003-01-25 17:25:30 +00:00
|
|
|
fgUntie("/orientation/pitch-deg");
|
|
|
|
fgUntie("/orientation/heading-deg");
|
2010-01-02 18:29:01 +00:00
|
|
|
fgUntie("/orientation/track-deg");
|
2003-03-30 02:26:05 +00:00
|
|
|
fgUntie("/orientation/roll-rate-degps");
|
|
|
|
fgUntie("/orientation/pitch-rate-degps");
|
|
|
|
fgUntie("/orientation/yaw-rate-degps");
|
2010-06-16 07:31:59 +00:00
|
|
|
fgUntie("/orientation/p-body");
|
|
|
|
fgUntie("/orientation/q-body");
|
|
|
|
fgUntie("/orientation/r-body");
|
2003-03-30 02:26:05 +00:00
|
|
|
fgUntie("/orientation/side-slip-rad");
|
|
|
|
fgUntie("/orientation/side-slip-deg");
|
|
|
|
fgUntie("/orientation/alpha-deg");
|
2001-07-02 22:27:24 +00:00
|
|
|
fgUntie("/velocities/airspeed-kt");
|
2007-06-10 16:01:09 +00:00
|
|
|
fgUntie("/velocities/groundspeed-kt");
|
2010-06-16 07:31:59 +00:00
|
|
|
fgUntie("/velocities/equivalent-kt");
|
2003-03-19 17:46:52 +00:00
|
|
|
fgUntie("/velocities/mach");
|
2001-07-02 22:27:24 +00:00
|
|
|
fgUntie("/velocities/speed-north-fps");
|
|
|
|
fgUntie("/velocities/speed-east-fps");
|
|
|
|
fgUntie("/velocities/speed-down-fps");
|
2010-06-26 13:21:16 +00:00
|
|
|
fgUntie("/velocities/north-relground-fps");
|
|
|
|
fgUntie("/velocities/east-relground-fps");
|
|
|
|
fgUntie("/velocities/down-relground-fps");
|
2001-07-02 22:27:24 +00:00
|
|
|
fgUntie("/velocities/uBody-fps");
|
|
|
|
fgUntie("/velocities/vBody-fps");
|
|
|
|
fgUntie("/velocities/wBody-fps");
|
|
|
|
fgUntie("/velocities/vertical-speed-fps");
|
2002-02-18 19:18:51 +00:00
|
|
|
fgUntie("/velocities/glideslope");
|
2002-02-17 21:05:27 +00:00
|
|
|
fgUntie("/accelerations/nlf");
|
2003-01-25 17:25:30 +00:00
|
|
|
fgUntie("/accelerations/pilot/x-accel-fps_sec");
|
|
|
|
fgUntie("/accelerations/pilot/y-accel-fps_sec");
|
|
|
|
fgUntie("/accelerations/pilot/z-accel-fps_sec");
|
2003-03-30 02:26:05 +00:00
|
|
|
fgUntie("/accelerations/ned/north-accel-fps_sec");
|
|
|
|
fgUntie("/accelerations/ned/east-accel-fps_sec");
|
|
|
|
fgUntie("/accelerations/ned/down-accel-fps_sec");
|
2010-06-26 13:21:16 +00:00
|
|
|
fgUntie("/accelerations/n-z-cg-fps_sec");
|
2001-12-07 22:38:19 +00:00
|
|
|
}
|
2001-04-05 20:20:44 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Update the state of the FDM (i.e. run the equations of motion).
|
|
|
|
*/
|
2001-01-16 20:21:03 +00:00
|
|
|
void
|
2002-05-11 16:28:50 +00:00
|
|
|
FGInterface::update (double dt)
|
2001-01-16 20:21:03 +00:00
|
|
|
{
|
2002-03-16 00:18:38 +00:00
|
|
|
SG_LOG(SG_FLIGHT, SG_ALERT, "dummy update() ... SHOULDN'T BE CALLED!");
|
1999-10-11 23:09:07 +00:00
|
|
|
}
|
|
|
|
|
2001-12-07 22:38:19 +00:00
|
|
|
|
2007-07-29 10:21:22 +00:00
|
|
|
void FGInterface::_updatePositionM(const SGVec3d& cartPos)
|
2001-12-12 05:18:46 +00:00
|
|
|
{
|
2010-01-02 18:29:01 +00:00
|
|
|
TrackComputer tracker( track, geodetic_position_v );
|
2007-07-29 10:21:22 +00:00
|
|
|
cartesian_position_v = cartPos;
|
|
|
|
geodetic_position_v = SGGeod::fromCart(cartesian_position_v);
|
|
|
|
geocentric_position_v = SGGeoc::fromCart(cartesian_position_v);
|
|
|
|
_set_Sea_level_radius( SGGeodesy::SGGeodToSeaLevelRadius(geodetic_position_v)*SG_METER_TO_FEET );
|
2005-10-08 12:33:06 +00:00
|
|
|
_update_ground_elev_at_pos();
|
2001-12-12 05:18:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-07-29 10:21:22 +00:00
|
|
|
void FGInterface::_updatePosition(const SGGeod& geod)
|
2001-12-12 05:18:46 +00:00
|
|
|
{
|
2010-01-02 18:29:01 +00:00
|
|
|
TrackComputer tracker( track, geodetic_position_v );
|
2007-07-29 10:21:22 +00:00
|
|
|
geodetic_position_v = geod;
|
|
|
|
cartesian_position_v = SGVec3d::fromGeod(geodetic_position_v);
|
|
|
|
geocentric_position_v = SGGeoc::fromCart(cartesian_position_v);
|
2001-09-04 14:38:15 +00:00
|
|
|
|
2007-07-29 10:21:22 +00:00
|
|
|
_set_Sea_level_radius( SGGeodesy::SGGeodToSeaLevelRadius(geodetic_position_v)*SG_METER_TO_FEET );
|
|
|
|
_update_ground_elev_at_pos();
|
|
|
|
}
|
2000-10-28 16:30:30 +00:00
|
|
|
|
|
|
|
|
2007-07-29 10:21:22 +00:00
|
|
|
void FGInterface::_updatePosition(const SGGeoc& geoc)
|
|
|
|
{
|
2010-01-02 18:29:01 +00:00
|
|
|
TrackComputer tracker( track, geodetic_position_v );
|
2007-07-29 10:21:22 +00:00
|
|
|
geocentric_position_v = geoc;
|
|
|
|
cartesian_position_v = SGVec3d::fromGeoc(geocentric_position_v);
|
|
|
|
geodetic_position_v = SGGeod::fromCart(cartesian_position_v);
|
2001-12-07 22:38:19 +00:00
|
|
|
|
2007-07-29 10:21:22 +00:00
|
|
|
_set_Sea_level_radius( SGGeodesy::SGGeodToSeaLevelRadius(geodetic_position_v)*SG_METER_TO_FEET );
|
2005-10-08 12:33:06 +00:00
|
|
|
_update_ground_elev_at_pos();
|
2007-07-29 10:21:22 +00:00
|
|
|
}
|
|
|
|
|
2001-12-07 22:38:19 +00:00
|
|
|
|
2007-07-29 10:21:22 +00:00
|
|
|
void FGInterface::_updateGeodeticPosition( double lat, double lon, double alt )
|
|
|
|
{
|
|
|
|
_updatePosition(SGGeod::fromRadFt(lon, lat, alt));
|
|
|
|
}
|
2001-12-07 22:38:19 +00:00
|
|
|
|
|
|
|
|
2007-07-29 10:21:22 +00:00
|
|
|
void FGInterface::_updateGeocentricPosition( double lat, double lon,
|
|
|
|
double alt )
|
|
|
|
{
|
|
|
|
_updatePosition(SGGeoc::fromRadFt(lon, lat, get_Sea_level_radius() + alt));
|
2000-10-28 16:30:30 +00:00
|
|
|
}
|
|
|
|
|
2005-10-08 12:33:06 +00:00
|
|
|
void FGInterface::_update_ground_elev_at_pos( void ) {
|
2007-07-29 10:21:22 +00:00
|
|
|
double groundlevel_m = get_groundlevel_m(geodetic_position_v);
|
2005-10-08 12:33:06 +00:00
|
|
|
_set_Runway_altitude( groundlevel_m * SG_METER_TO_FEET );
|
|
|
|
}
|
1999-10-11 23:09:07 +00:00
|
|
|
|
I tested:
LaRCsim c172 on-ground and in-air starts, reset: all work
UIUC Cessna172 on-ground and in-air starts work as expected, reset
results in an aircraft that is upside down but does not crash FG. I
don't know what it was like before, so it may well be no change.
JSBSim c172 and X15 in-air starts work fine, resets now work (and are
trimmed), on-ground starts do not -- the c172 ends up on its back. I
suspect this is no worse than before.
I did not test:
Balloon (the weather code returns nan's for the atmosphere data --this
is in the weather module and apparently is a linux only bug)
ADA (don't know how)
MagicCarpet (needs work yet)
External (don't know how)
known to be broken:
LaRCsim c172 on-ground starts with a negative terrain altitude (this
happens at KPAO when the scenery is not present). The FDM inits to
about 50 feet AGL and the model falls to the ground. It does stay
upright, however, and seems to be fine once it settles out, FWIW.
To do:
--implement set_Model on the bus
--bring Christian's weather data into JSBSim
-- add default method to bus for updating things like the sin and cos of
latitude (for Balloon, MagicCarpet)
-- lots of cleanup
The files:
src/FDM/flight.cxx
src/FDM/flight.hxx
-- all data members now declared protected instead of private.
-- eliminated all but a small set of 'setters', no change to getters.
-- that small set is declared virtual, the default implementation
provided preserves the old behavior
-- all of the vector data members are now initialized.
-- added busdump() method -- FG_LOG's all the bus data when called,
useful for diagnostics.
src/FDM/ADA.cxx
-- bus data members now directly assigned to
src/FDM/Balloon.cxx
-- bus data members now directly assigned to
-- changed V_equiv_kts to V_calibrated_kts
src/FDM/JSBSim.cxx
src/FDM/JSBSim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with JSBSim specific
logic
-- changed the static FDMExec to a dynamic fdmex (needed so that the
JSBSim object can be deleted when a model change is called for)
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- added logic to bring up FGEngInterface objects and set the RPM and
throttle values.
src/FDM/LaRCsim.cxx
src/FDM/LaRCsim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with LaRCsim specific
logic, uses LaRCsimIC
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- moved default inertias to here from fg_init.cxx
-- eliminated the climb rate calculation. The equivalent, climb_rate =
-1*vdown, is now in copy_from_LaRCsim().
src/FDM/LaRCsimIC.cxx
src/FDM/LaRCsimIC.hxx
-- similar to FGInitialCondition, this class has all the logic needed to
turn data like Vc and Mach into the more fundamental quantities LaRCsim
needs to initialize.
-- put it in src/FDM since it is a class
src/FDM/MagicCarpet.cxx
-- bus data members now directly assigned to
src/FDM/Makefile.am
-- adds LaRCsimIC.hxx and cxx
src/FDM/JSBSim/FGAtmosphere.h
src/FDM/JSBSim/FGDefs.h
src/FDM/JSBSim/FGInitialCondition.cpp
src/FDM/JSBSim/FGInitialCondition.h
src/FDM/JSBSim/JSBSim.cpp
-- changes to accomodate the new bus
src/FDM/LaRCsim/atmos_62.h
src/FDM/LaRCsim/ls_geodesy.h
-- surrounded prototypes with #ifdef __cplusplus ... #endif , functions
here are needed in LaRCsimIC
src/FDM/LaRCsim/c172_main.c
src/FDM/LaRCsim/cherokee_aero.c
src/FDM/LaRCsim/ls_aux.c
src/FDM/LaRCsim/ls_constants.h
src/FDM/LaRCsim/ls_geodesy.c
src/FDM/LaRCsim/ls_geodesy.h
src/FDM/LaRCsim/ls_step.c
src/FDM/UIUCModel/uiuc_betaprobe.cpp
-- changed PI to LS_PI, eliminates preprocessor naming conflict with
weather module
src/FDM/LaRCsim/ls_interface.c
src/FDM/LaRCsim/ls_interface.h
-- added function ls_set_model_dt()
src/Main/bfi.cxx
-- eliminated calls that set the NED speeds to body components. They
are no longer needed and confuse the new bus.
src/Main/fg_init.cxx
-- eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). or set default values. The bus now handles the
defaults and updates itself when the setters are called (for LaRCsim and
JSBSim). A default method for doing this needs to be added to the bus.
-- added fgVelocityInit() to set the speed the user asked for. Both
JSBSim and LaRCsim can now be initialized using any of:
vc,mach, NED components, UVW components.
src/Main/main.cxx
--eliminated call to fgFDMSetGroundElevation, this data is now 'pulled'
onto the bus every update()
src/Main/options.cxx
src/Main/options.hxx
-- added enum to keep track of the speed requested by the user
-- eliminated calls to set NED velocity properties to body speeds, they
are no longer needed.
-- added options for the NED components.
src/Network/garmin.cxx
src/Network/nmea.cxx
--eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). The bus now updates itself when the setters are
called (for LaRCsim and JSBSim). A default method for doing this needs
to be added to the bus.
-- changed set_V_equiv_kts to set_V_calibrated_kts. set_V_equiv_kts no
longer exists ( get_V_equiv_kts still does, though)
src/WeatherCM/FGLocalWeatherDatabase.cpp
-- commented out the code to put the weather data on the bus, a
different scheme for this is needed.
2000-10-24 00:34:50 +00:00
|
|
|
// Positions
|
2001-12-07 22:38:19 +00:00
|
|
|
void FGInterface::set_Latitude(double lat) {
|
2007-07-29 10:21:22 +00:00
|
|
|
geodetic_position_v.setLatitudeRad(lat);
|
2001-12-07 22:38:19 +00:00
|
|
|
}
|
I tested:
LaRCsim c172 on-ground and in-air starts, reset: all work
UIUC Cessna172 on-ground and in-air starts work as expected, reset
results in an aircraft that is upside down but does not crash FG. I
don't know what it was like before, so it may well be no change.
JSBSim c172 and X15 in-air starts work fine, resets now work (and are
trimmed), on-ground starts do not -- the c172 ends up on its back. I
suspect this is no worse than before.
I did not test:
Balloon (the weather code returns nan's for the atmosphere data --this
is in the weather module and apparently is a linux only bug)
ADA (don't know how)
MagicCarpet (needs work yet)
External (don't know how)
known to be broken:
LaRCsim c172 on-ground starts with a negative terrain altitude (this
happens at KPAO when the scenery is not present). The FDM inits to
about 50 feet AGL and the model falls to the ground. It does stay
upright, however, and seems to be fine once it settles out, FWIW.
To do:
--implement set_Model on the bus
--bring Christian's weather data into JSBSim
-- add default method to bus for updating things like the sin and cos of
latitude (for Balloon, MagicCarpet)
-- lots of cleanup
The files:
src/FDM/flight.cxx
src/FDM/flight.hxx
-- all data members now declared protected instead of private.
-- eliminated all but a small set of 'setters', no change to getters.
-- that small set is declared virtual, the default implementation
provided preserves the old behavior
-- all of the vector data members are now initialized.
-- added busdump() method -- FG_LOG's all the bus data when called,
useful for diagnostics.
src/FDM/ADA.cxx
-- bus data members now directly assigned to
src/FDM/Balloon.cxx
-- bus data members now directly assigned to
-- changed V_equiv_kts to V_calibrated_kts
src/FDM/JSBSim.cxx
src/FDM/JSBSim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with JSBSim specific
logic
-- changed the static FDMExec to a dynamic fdmex (needed so that the
JSBSim object can be deleted when a model change is called for)
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- added logic to bring up FGEngInterface objects and set the RPM and
throttle values.
src/FDM/LaRCsim.cxx
src/FDM/LaRCsim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with LaRCsim specific
logic, uses LaRCsimIC
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- moved default inertias to here from fg_init.cxx
-- eliminated the climb rate calculation. The equivalent, climb_rate =
-1*vdown, is now in copy_from_LaRCsim().
src/FDM/LaRCsimIC.cxx
src/FDM/LaRCsimIC.hxx
-- similar to FGInitialCondition, this class has all the logic needed to
turn data like Vc and Mach into the more fundamental quantities LaRCsim
needs to initialize.
-- put it in src/FDM since it is a class
src/FDM/MagicCarpet.cxx
-- bus data members now directly assigned to
src/FDM/Makefile.am
-- adds LaRCsimIC.hxx and cxx
src/FDM/JSBSim/FGAtmosphere.h
src/FDM/JSBSim/FGDefs.h
src/FDM/JSBSim/FGInitialCondition.cpp
src/FDM/JSBSim/FGInitialCondition.h
src/FDM/JSBSim/JSBSim.cpp
-- changes to accomodate the new bus
src/FDM/LaRCsim/atmos_62.h
src/FDM/LaRCsim/ls_geodesy.h
-- surrounded prototypes with #ifdef __cplusplus ... #endif , functions
here are needed in LaRCsimIC
src/FDM/LaRCsim/c172_main.c
src/FDM/LaRCsim/cherokee_aero.c
src/FDM/LaRCsim/ls_aux.c
src/FDM/LaRCsim/ls_constants.h
src/FDM/LaRCsim/ls_geodesy.c
src/FDM/LaRCsim/ls_geodesy.h
src/FDM/LaRCsim/ls_step.c
src/FDM/UIUCModel/uiuc_betaprobe.cpp
-- changed PI to LS_PI, eliminates preprocessor naming conflict with
weather module
src/FDM/LaRCsim/ls_interface.c
src/FDM/LaRCsim/ls_interface.h
-- added function ls_set_model_dt()
src/Main/bfi.cxx
-- eliminated calls that set the NED speeds to body components. They
are no longer needed and confuse the new bus.
src/Main/fg_init.cxx
-- eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). or set default values. The bus now handles the
defaults and updates itself when the setters are called (for LaRCsim and
JSBSim). A default method for doing this needs to be added to the bus.
-- added fgVelocityInit() to set the speed the user asked for. Both
JSBSim and LaRCsim can now be initialized using any of:
vc,mach, NED components, UVW components.
src/Main/main.cxx
--eliminated call to fgFDMSetGroundElevation, this data is now 'pulled'
onto the bus every update()
src/Main/options.cxx
src/Main/options.hxx
-- added enum to keep track of the speed requested by the user
-- eliminated calls to set NED velocity properties to body speeds, they
are no longer needed.
-- added options for the NED components.
src/Network/garmin.cxx
src/Network/nmea.cxx
--eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). The bus now updates itself when the setters are
called (for LaRCsim and JSBSim). A default method for doing this needs
to be added to the bus.
-- changed set_V_equiv_kts to set_V_calibrated_kts. set_V_equiv_kts no
longer exists ( get_V_equiv_kts still does, though)
src/WeatherCM/FGLocalWeatherDatabase.cpp
-- commented out the code to put the weather data on the bus, a
different scheme for this is needed.
2000-10-24 00:34:50 +00:00
|
|
|
|
|
|
|
void FGInterface::set_Longitude(double lon) {
|
2007-07-29 10:21:22 +00:00
|
|
|
geodetic_position_v.setLongitudeRad(lon);
|
2001-12-07 22:38:19 +00:00
|
|
|
}
|
I tested:
LaRCsim c172 on-ground and in-air starts, reset: all work
UIUC Cessna172 on-ground and in-air starts work as expected, reset
results in an aircraft that is upside down but does not crash FG. I
don't know what it was like before, so it may well be no change.
JSBSim c172 and X15 in-air starts work fine, resets now work (and are
trimmed), on-ground starts do not -- the c172 ends up on its back. I
suspect this is no worse than before.
I did not test:
Balloon (the weather code returns nan's for the atmosphere data --this
is in the weather module and apparently is a linux only bug)
ADA (don't know how)
MagicCarpet (needs work yet)
External (don't know how)
known to be broken:
LaRCsim c172 on-ground starts with a negative terrain altitude (this
happens at KPAO when the scenery is not present). The FDM inits to
about 50 feet AGL and the model falls to the ground. It does stay
upright, however, and seems to be fine once it settles out, FWIW.
To do:
--implement set_Model on the bus
--bring Christian's weather data into JSBSim
-- add default method to bus for updating things like the sin and cos of
latitude (for Balloon, MagicCarpet)
-- lots of cleanup
The files:
src/FDM/flight.cxx
src/FDM/flight.hxx
-- all data members now declared protected instead of private.
-- eliminated all but a small set of 'setters', no change to getters.
-- that small set is declared virtual, the default implementation
provided preserves the old behavior
-- all of the vector data members are now initialized.
-- added busdump() method -- FG_LOG's all the bus data when called,
useful for diagnostics.
src/FDM/ADA.cxx
-- bus data members now directly assigned to
src/FDM/Balloon.cxx
-- bus data members now directly assigned to
-- changed V_equiv_kts to V_calibrated_kts
src/FDM/JSBSim.cxx
src/FDM/JSBSim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with JSBSim specific
logic
-- changed the static FDMExec to a dynamic fdmex (needed so that the
JSBSim object can be deleted when a model change is called for)
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- added logic to bring up FGEngInterface objects and set the RPM and
throttle values.
src/FDM/LaRCsim.cxx
src/FDM/LaRCsim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with LaRCsim specific
logic, uses LaRCsimIC
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- moved default inertias to here from fg_init.cxx
-- eliminated the climb rate calculation. The equivalent, climb_rate =
-1*vdown, is now in copy_from_LaRCsim().
src/FDM/LaRCsimIC.cxx
src/FDM/LaRCsimIC.hxx
-- similar to FGInitialCondition, this class has all the logic needed to
turn data like Vc and Mach into the more fundamental quantities LaRCsim
needs to initialize.
-- put it in src/FDM since it is a class
src/FDM/MagicCarpet.cxx
-- bus data members now directly assigned to
src/FDM/Makefile.am
-- adds LaRCsimIC.hxx and cxx
src/FDM/JSBSim/FGAtmosphere.h
src/FDM/JSBSim/FGDefs.h
src/FDM/JSBSim/FGInitialCondition.cpp
src/FDM/JSBSim/FGInitialCondition.h
src/FDM/JSBSim/JSBSim.cpp
-- changes to accomodate the new bus
src/FDM/LaRCsim/atmos_62.h
src/FDM/LaRCsim/ls_geodesy.h
-- surrounded prototypes with #ifdef __cplusplus ... #endif , functions
here are needed in LaRCsimIC
src/FDM/LaRCsim/c172_main.c
src/FDM/LaRCsim/cherokee_aero.c
src/FDM/LaRCsim/ls_aux.c
src/FDM/LaRCsim/ls_constants.h
src/FDM/LaRCsim/ls_geodesy.c
src/FDM/LaRCsim/ls_geodesy.h
src/FDM/LaRCsim/ls_step.c
src/FDM/UIUCModel/uiuc_betaprobe.cpp
-- changed PI to LS_PI, eliminates preprocessor naming conflict with
weather module
src/FDM/LaRCsim/ls_interface.c
src/FDM/LaRCsim/ls_interface.h
-- added function ls_set_model_dt()
src/Main/bfi.cxx
-- eliminated calls that set the NED speeds to body components. They
are no longer needed and confuse the new bus.
src/Main/fg_init.cxx
-- eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). or set default values. The bus now handles the
defaults and updates itself when the setters are called (for LaRCsim and
JSBSim). A default method for doing this needs to be added to the bus.
-- added fgVelocityInit() to set the speed the user asked for. Both
JSBSim and LaRCsim can now be initialized using any of:
vc,mach, NED components, UVW components.
src/Main/main.cxx
--eliminated call to fgFDMSetGroundElevation, this data is now 'pulled'
onto the bus every update()
src/Main/options.cxx
src/Main/options.hxx
-- added enum to keep track of the speed requested by the user
-- eliminated calls to set NED velocity properties to body speeds, they
are no longer needed.
-- added options for the NED components.
src/Network/garmin.cxx
src/Network/nmea.cxx
--eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). The bus now updates itself when the setters are
called (for LaRCsim and JSBSim). A default method for doing this needs
to be added to the bus.
-- changed set_V_equiv_kts to set_V_calibrated_kts. set_V_equiv_kts no
longer exists ( get_V_equiv_kts still does, though)
src/WeatherCM/FGLocalWeatherDatabase.cpp
-- commented out the code to put the weather data on the bus, a
different scheme for this is needed.
2000-10-24 00:34:50 +00:00
|
|
|
|
|
|
|
void FGInterface::set_Altitude(double alt) {
|
2007-07-29 10:21:22 +00:00
|
|
|
geodetic_position_v.setElevationFt(alt);
|
2001-12-07 22:38:19 +00:00
|
|
|
}
|
I tested:
LaRCsim c172 on-ground and in-air starts, reset: all work
UIUC Cessna172 on-ground and in-air starts work as expected, reset
results in an aircraft that is upside down but does not crash FG. I
don't know what it was like before, so it may well be no change.
JSBSim c172 and X15 in-air starts work fine, resets now work (and are
trimmed), on-ground starts do not -- the c172 ends up on its back. I
suspect this is no worse than before.
I did not test:
Balloon (the weather code returns nan's for the atmosphere data --this
is in the weather module and apparently is a linux only bug)
ADA (don't know how)
MagicCarpet (needs work yet)
External (don't know how)
known to be broken:
LaRCsim c172 on-ground starts with a negative terrain altitude (this
happens at KPAO when the scenery is not present). The FDM inits to
about 50 feet AGL and the model falls to the ground. It does stay
upright, however, and seems to be fine once it settles out, FWIW.
To do:
--implement set_Model on the bus
--bring Christian's weather data into JSBSim
-- add default method to bus for updating things like the sin and cos of
latitude (for Balloon, MagicCarpet)
-- lots of cleanup
The files:
src/FDM/flight.cxx
src/FDM/flight.hxx
-- all data members now declared protected instead of private.
-- eliminated all but a small set of 'setters', no change to getters.
-- that small set is declared virtual, the default implementation
provided preserves the old behavior
-- all of the vector data members are now initialized.
-- added busdump() method -- FG_LOG's all the bus data when called,
useful for diagnostics.
src/FDM/ADA.cxx
-- bus data members now directly assigned to
src/FDM/Balloon.cxx
-- bus data members now directly assigned to
-- changed V_equiv_kts to V_calibrated_kts
src/FDM/JSBSim.cxx
src/FDM/JSBSim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with JSBSim specific
logic
-- changed the static FDMExec to a dynamic fdmex (needed so that the
JSBSim object can be deleted when a model change is called for)
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- added logic to bring up FGEngInterface objects and set the RPM and
throttle values.
src/FDM/LaRCsim.cxx
src/FDM/LaRCsim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with LaRCsim specific
logic, uses LaRCsimIC
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- moved default inertias to here from fg_init.cxx
-- eliminated the climb rate calculation. The equivalent, climb_rate =
-1*vdown, is now in copy_from_LaRCsim().
src/FDM/LaRCsimIC.cxx
src/FDM/LaRCsimIC.hxx
-- similar to FGInitialCondition, this class has all the logic needed to
turn data like Vc and Mach into the more fundamental quantities LaRCsim
needs to initialize.
-- put it in src/FDM since it is a class
src/FDM/MagicCarpet.cxx
-- bus data members now directly assigned to
src/FDM/Makefile.am
-- adds LaRCsimIC.hxx and cxx
src/FDM/JSBSim/FGAtmosphere.h
src/FDM/JSBSim/FGDefs.h
src/FDM/JSBSim/FGInitialCondition.cpp
src/FDM/JSBSim/FGInitialCondition.h
src/FDM/JSBSim/JSBSim.cpp
-- changes to accomodate the new bus
src/FDM/LaRCsim/atmos_62.h
src/FDM/LaRCsim/ls_geodesy.h
-- surrounded prototypes with #ifdef __cplusplus ... #endif , functions
here are needed in LaRCsimIC
src/FDM/LaRCsim/c172_main.c
src/FDM/LaRCsim/cherokee_aero.c
src/FDM/LaRCsim/ls_aux.c
src/FDM/LaRCsim/ls_constants.h
src/FDM/LaRCsim/ls_geodesy.c
src/FDM/LaRCsim/ls_geodesy.h
src/FDM/LaRCsim/ls_step.c
src/FDM/UIUCModel/uiuc_betaprobe.cpp
-- changed PI to LS_PI, eliminates preprocessor naming conflict with
weather module
src/FDM/LaRCsim/ls_interface.c
src/FDM/LaRCsim/ls_interface.h
-- added function ls_set_model_dt()
src/Main/bfi.cxx
-- eliminated calls that set the NED speeds to body components. They
are no longer needed and confuse the new bus.
src/Main/fg_init.cxx
-- eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). or set default values. The bus now handles the
defaults and updates itself when the setters are called (for LaRCsim and
JSBSim). A default method for doing this needs to be added to the bus.
-- added fgVelocityInit() to set the speed the user asked for. Both
JSBSim and LaRCsim can now be initialized using any of:
vc,mach, NED components, UVW components.
src/Main/main.cxx
--eliminated call to fgFDMSetGroundElevation, this data is now 'pulled'
onto the bus every update()
src/Main/options.cxx
src/Main/options.hxx
-- added enum to keep track of the speed requested by the user
-- eliminated calls to set NED velocity properties to body speeds, they
are no longer needed.
-- added options for the NED components.
src/Network/garmin.cxx
src/Network/nmea.cxx
--eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). The bus now updates itself when the setters are
called (for LaRCsim and JSBSim). A default method for doing this needs
to be added to the bus.
-- changed set_V_equiv_kts to set_V_calibrated_kts. set_V_equiv_kts no
longer exists ( get_V_equiv_kts still does, though)
src/WeatherCM/FGLocalWeatherDatabase.cpp
-- commented out the code to put the weather data on the bus, a
different scheme for this is needed.
2000-10-24 00:34:50 +00:00
|
|
|
|
|
|
|
void FGInterface::set_AltitudeAGL(double altagl) {
|
|
|
|
altitude_agl=altagl;
|
2001-12-07 22:38:19 +00:00
|
|
|
}
|
I tested:
LaRCsim c172 on-ground and in-air starts, reset: all work
UIUC Cessna172 on-ground and in-air starts work as expected, reset
results in an aircraft that is upside down but does not crash FG. I
don't know what it was like before, so it may well be no change.
JSBSim c172 and X15 in-air starts work fine, resets now work (and are
trimmed), on-ground starts do not -- the c172 ends up on its back. I
suspect this is no worse than before.
I did not test:
Balloon (the weather code returns nan's for the atmosphere data --this
is in the weather module and apparently is a linux only bug)
ADA (don't know how)
MagicCarpet (needs work yet)
External (don't know how)
known to be broken:
LaRCsim c172 on-ground starts with a negative terrain altitude (this
happens at KPAO when the scenery is not present). The FDM inits to
about 50 feet AGL and the model falls to the ground. It does stay
upright, however, and seems to be fine once it settles out, FWIW.
To do:
--implement set_Model on the bus
--bring Christian's weather data into JSBSim
-- add default method to bus for updating things like the sin and cos of
latitude (for Balloon, MagicCarpet)
-- lots of cleanup
The files:
src/FDM/flight.cxx
src/FDM/flight.hxx
-- all data members now declared protected instead of private.
-- eliminated all but a small set of 'setters', no change to getters.
-- that small set is declared virtual, the default implementation
provided preserves the old behavior
-- all of the vector data members are now initialized.
-- added busdump() method -- FG_LOG's all the bus data when called,
useful for diagnostics.
src/FDM/ADA.cxx
-- bus data members now directly assigned to
src/FDM/Balloon.cxx
-- bus data members now directly assigned to
-- changed V_equiv_kts to V_calibrated_kts
src/FDM/JSBSim.cxx
src/FDM/JSBSim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with JSBSim specific
logic
-- changed the static FDMExec to a dynamic fdmex (needed so that the
JSBSim object can be deleted when a model change is called for)
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- added logic to bring up FGEngInterface objects and set the RPM and
throttle values.
src/FDM/LaRCsim.cxx
src/FDM/LaRCsim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with LaRCsim specific
logic, uses LaRCsimIC
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- moved default inertias to here from fg_init.cxx
-- eliminated the climb rate calculation. The equivalent, climb_rate =
-1*vdown, is now in copy_from_LaRCsim().
src/FDM/LaRCsimIC.cxx
src/FDM/LaRCsimIC.hxx
-- similar to FGInitialCondition, this class has all the logic needed to
turn data like Vc and Mach into the more fundamental quantities LaRCsim
needs to initialize.
-- put it in src/FDM since it is a class
src/FDM/MagicCarpet.cxx
-- bus data members now directly assigned to
src/FDM/Makefile.am
-- adds LaRCsimIC.hxx and cxx
src/FDM/JSBSim/FGAtmosphere.h
src/FDM/JSBSim/FGDefs.h
src/FDM/JSBSim/FGInitialCondition.cpp
src/FDM/JSBSim/FGInitialCondition.h
src/FDM/JSBSim/JSBSim.cpp
-- changes to accomodate the new bus
src/FDM/LaRCsim/atmos_62.h
src/FDM/LaRCsim/ls_geodesy.h
-- surrounded prototypes with #ifdef __cplusplus ... #endif , functions
here are needed in LaRCsimIC
src/FDM/LaRCsim/c172_main.c
src/FDM/LaRCsim/cherokee_aero.c
src/FDM/LaRCsim/ls_aux.c
src/FDM/LaRCsim/ls_constants.h
src/FDM/LaRCsim/ls_geodesy.c
src/FDM/LaRCsim/ls_geodesy.h
src/FDM/LaRCsim/ls_step.c
src/FDM/UIUCModel/uiuc_betaprobe.cpp
-- changed PI to LS_PI, eliminates preprocessor naming conflict with
weather module
src/FDM/LaRCsim/ls_interface.c
src/FDM/LaRCsim/ls_interface.h
-- added function ls_set_model_dt()
src/Main/bfi.cxx
-- eliminated calls that set the NED speeds to body components. They
are no longer needed and confuse the new bus.
src/Main/fg_init.cxx
-- eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). or set default values. The bus now handles the
defaults and updates itself when the setters are called (for LaRCsim and
JSBSim). A default method for doing this needs to be added to the bus.
-- added fgVelocityInit() to set the speed the user asked for. Both
JSBSim and LaRCsim can now be initialized using any of:
vc,mach, NED components, UVW components.
src/Main/main.cxx
--eliminated call to fgFDMSetGroundElevation, this data is now 'pulled'
onto the bus every update()
src/Main/options.cxx
src/Main/options.hxx
-- added enum to keep track of the speed requested by the user
-- eliminated calls to set NED velocity properties to body speeds, they
are no longer needed.
-- added options for the NED components.
src/Network/garmin.cxx
src/Network/nmea.cxx
--eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). The bus now updates itself when the setters are
called (for LaRCsim and JSBSim). A default method for doing this needs
to be added to the bus.
-- changed set_V_equiv_kts to set_V_calibrated_kts. set_V_equiv_kts no
longer exists ( get_V_equiv_kts still does, though)
src/WeatherCM/FGLocalWeatherDatabase.cpp
-- commented out the code to put the weather data on the bus, a
different scheme for this is needed.
2000-10-24 00:34:50 +00:00
|
|
|
|
|
|
|
// Velocities
|
|
|
|
void FGInterface::set_V_calibrated_kts(double vc) {
|
|
|
|
v_calibrated_kts = vc;
|
2001-12-07 22:38:19 +00:00
|
|
|
}
|
I tested:
LaRCsim c172 on-ground and in-air starts, reset: all work
UIUC Cessna172 on-ground and in-air starts work as expected, reset
results in an aircraft that is upside down but does not crash FG. I
don't know what it was like before, so it may well be no change.
JSBSim c172 and X15 in-air starts work fine, resets now work (and are
trimmed), on-ground starts do not -- the c172 ends up on its back. I
suspect this is no worse than before.
I did not test:
Balloon (the weather code returns nan's for the atmosphere data --this
is in the weather module and apparently is a linux only bug)
ADA (don't know how)
MagicCarpet (needs work yet)
External (don't know how)
known to be broken:
LaRCsim c172 on-ground starts with a negative terrain altitude (this
happens at KPAO when the scenery is not present). The FDM inits to
about 50 feet AGL and the model falls to the ground. It does stay
upright, however, and seems to be fine once it settles out, FWIW.
To do:
--implement set_Model on the bus
--bring Christian's weather data into JSBSim
-- add default method to bus for updating things like the sin and cos of
latitude (for Balloon, MagicCarpet)
-- lots of cleanup
The files:
src/FDM/flight.cxx
src/FDM/flight.hxx
-- all data members now declared protected instead of private.
-- eliminated all but a small set of 'setters', no change to getters.
-- that small set is declared virtual, the default implementation
provided preserves the old behavior
-- all of the vector data members are now initialized.
-- added busdump() method -- FG_LOG's all the bus data when called,
useful for diagnostics.
src/FDM/ADA.cxx
-- bus data members now directly assigned to
src/FDM/Balloon.cxx
-- bus data members now directly assigned to
-- changed V_equiv_kts to V_calibrated_kts
src/FDM/JSBSim.cxx
src/FDM/JSBSim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with JSBSim specific
logic
-- changed the static FDMExec to a dynamic fdmex (needed so that the
JSBSim object can be deleted when a model change is called for)
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- added logic to bring up FGEngInterface objects and set the RPM and
throttle values.
src/FDM/LaRCsim.cxx
src/FDM/LaRCsim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with LaRCsim specific
logic, uses LaRCsimIC
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- moved default inertias to here from fg_init.cxx
-- eliminated the climb rate calculation. The equivalent, climb_rate =
-1*vdown, is now in copy_from_LaRCsim().
src/FDM/LaRCsimIC.cxx
src/FDM/LaRCsimIC.hxx
-- similar to FGInitialCondition, this class has all the logic needed to
turn data like Vc and Mach into the more fundamental quantities LaRCsim
needs to initialize.
-- put it in src/FDM since it is a class
src/FDM/MagicCarpet.cxx
-- bus data members now directly assigned to
src/FDM/Makefile.am
-- adds LaRCsimIC.hxx and cxx
src/FDM/JSBSim/FGAtmosphere.h
src/FDM/JSBSim/FGDefs.h
src/FDM/JSBSim/FGInitialCondition.cpp
src/FDM/JSBSim/FGInitialCondition.h
src/FDM/JSBSim/JSBSim.cpp
-- changes to accomodate the new bus
src/FDM/LaRCsim/atmos_62.h
src/FDM/LaRCsim/ls_geodesy.h
-- surrounded prototypes with #ifdef __cplusplus ... #endif , functions
here are needed in LaRCsimIC
src/FDM/LaRCsim/c172_main.c
src/FDM/LaRCsim/cherokee_aero.c
src/FDM/LaRCsim/ls_aux.c
src/FDM/LaRCsim/ls_constants.h
src/FDM/LaRCsim/ls_geodesy.c
src/FDM/LaRCsim/ls_geodesy.h
src/FDM/LaRCsim/ls_step.c
src/FDM/UIUCModel/uiuc_betaprobe.cpp
-- changed PI to LS_PI, eliminates preprocessor naming conflict with
weather module
src/FDM/LaRCsim/ls_interface.c
src/FDM/LaRCsim/ls_interface.h
-- added function ls_set_model_dt()
src/Main/bfi.cxx
-- eliminated calls that set the NED speeds to body components. They
are no longer needed and confuse the new bus.
src/Main/fg_init.cxx
-- eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). or set default values. The bus now handles the
defaults and updates itself when the setters are called (for LaRCsim and
JSBSim). A default method for doing this needs to be added to the bus.
-- added fgVelocityInit() to set the speed the user asked for. Both
JSBSim and LaRCsim can now be initialized using any of:
vc,mach, NED components, UVW components.
src/Main/main.cxx
--eliminated call to fgFDMSetGroundElevation, this data is now 'pulled'
onto the bus every update()
src/Main/options.cxx
src/Main/options.hxx
-- added enum to keep track of the speed requested by the user
-- eliminated calls to set NED velocity properties to body speeds, they
are no longer needed.
-- added options for the NED components.
src/Network/garmin.cxx
src/Network/nmea.cxx
--eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). The bus now updates itself when the setters are
called (for LaRCsim and JSBSim). A default method for doing this needs
to be added to the bus.
-- changed set_V_equiv_kts to set_V_calibrated_kts. set_V_equiv_kts no
longer exists ( get_V_equiv_kts still does, though)
src/WeatherCM/FGLocalWeatherDatabase.cpp
-- commented out the code to put the weather data on the bus, a
different scheme for this is needed.
2000-10-24 00:34:50 +00:00
|
|
|
|
|
|
|
void FGInterface::set_Mach_number(double mach) {
|
|
|
|
mach_number = mach;
|
2001-12-07 22:38:19 +00:00
|
|
|
}
|
I tested:
LaRCsim c172 on-ground and in-air starts, reset: all work
UIUC Cessna172 on-ground and in-air starts work as expected, reset
results in an aircraft that is upside down but does not crash FG. I
don't know what it was like before, so it may well be no change.
JSBSim c172 and X15 in-air starts work fine, resets now work (and are
trimmed), on-ground starts do not -- the c172 ends up on its back. I
suspect this is no worse than before.
I did not test:
Balloon (the weather code returns nan's for the atmosphere data --this
is in the weather module and apparently is a linux only bug)
ADA (don't know how)
MagicCarpet (needs work yet)
External (don't know how)
known to be broken:
LaRCsim c172 on-ground starts with a negative terrain altitude (this
happens at KPAO when the scenery is not present). The FDM inits to
about 50 feet AGL and the model falls to the ground. It does stay
upright, however, and seems to be fine once it settles out, FWIW.
To do:
--implement set_Model on the bus
--bring Christian's weather data into JSBSim
-- add default method to bus for updating things like the sin and cos of
latitude (for Balloon, MagicCarpet)
-- lots of cleanup
The files:
src/FDM/flight.cxx
src/FDM/flight.hxx
-- all data members now declared protected instead of private.
-- eliminated all but a small set of 'setters', no change to getters.
-- that small set is declared virtual, the default implementation
provided preserves the old behavior
-- all of the vector data members are now initialized.
-- added busdump() method -- FG_LOG's all the bus data when called,
useful for diagnostics.
src/FDM/ADA.cxx
-- bus data members now directly assigned to
src/FDM/Balloon.cxx
-- bus data members now directly assigned to
-- changed V_equiv_kts to V_calibrated_kts
src/FDM/JSBSim.cxx
src/FDM/JSBSim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with JSBSim specific
logic
-- changed the static FDMExec to a dynamic fdmex (needed so that the
JSBSim object can be deleted when a model change is called for)
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- added logic to bring up FGEngInterface objects and set the RPM and
throttle values.
src/FDM/LaRCsim.cxx
src/FDM/LaRCsim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with LaRCsim specific
logic, uses LaRCsimIC
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- moved default inertias to here from fg_init.cxx
-- eliminated the climb rate calculation. The equivalent, climb_rate =
-1*vdown, is now in copy_from_LaRCsim().
src/FDM/LaRCsimIC.cxx
src/FDM/LaRCsimIC.hxx
-- similar to FGInitialCondition, this class has all the logic needed to
turn data like Vc and Mach into the more fundamental quantities LaRCsim
needs to initialize.
-- put it in src/FDM since it is a class
src/FDM/MagicCarpet.cxx
-- bus data members now directly assigned to
src/FDM/Makefile.am
-- adds LaRCsimIC.hxx and cxx
src/FDM/JSBSim/FGAtmosphere.h
src/FDM/JSBSim/FGDefs.h
src/FDM/JSBSim/FGInitialCondition.cpp
src/FDM/JSBSim/FGInitialCondition.h
src/FDM/JSBSim/JSBSim.cpp
-- changes to accomodate the new bus
src/FDM/LaRCsim/atmos_62.h
src/FDM/LaRCsim/ls_geodesy.h
-- surrounded prototypes with #ifdef __cplusplus ... #endif , functions
here are needed in LaRCsimIC
src/FDM/LaRCsim/c172_main.c
src/FDM/LaRCsim/cherokee_aero.c
src/FDM/LaRCsim/ls_aux.c
src/FDM/LaRCsim/ls_constants.h
src/FDM/LaRCsim/ls_geodesy.c
src/FDM/LaRCsim/ls_geodesy.h
src/FDM/LaRCsim/ls_step.c
src/FDM/UIUCModel/uiuc_betaprobe.cpp
-- changed PI to LS_PI, eliminates preprocessor naming conflict with
weather module
src/FDM/LaRCsim/ls_interface.c
src/FDM/LaRCsim/ls_interface.h
-- added function ls_set_model_dt()
src/Main/bfi.cxx
-- eliminated calls that set the NED speeds to body components. They
are no longer needed and confuse the new bus.
src/Main/fg_init.cxx
-- eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). or set default values. The bus now handles the
defaults and updates itself when the setters are called (for LaRCsim and
JSBSim). A default method for doing this needs to be added to the bus.
-- added fgVelocityInit() to set the speed the user asked for. Both
JSBSim and LaRCsim can now be initialized using any of:
vc,mach, NED components, UVW components.
src/Main/main.cxx
--eliminated call to fgFDMSetGroundElevation, this data is now 'pulled'
onto the bus every update()
src/Main/options.cxx
src/Main/options.hxx
-- added enum to keep track of the speed requested by the user
-- eliminated calls to set NED velocity properties to body speeds, they
are no longer needed.
-- added options for the NED components.
src/Network/garmin.cxx
src/Network/nmea.cxx
--eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). The bus now updates itself when the setters are
called (for LaRCsim and JSBSim). A default method for doing this needs
to be added to the bus.
-- changed set_V_equiv_kts to set_V_calibrated_kts. set_V_equiv_kts no
longer exists ( get_V_equiv_kts still does, though)
src/WeatherCM/FGLocalWeatherDatabase.cpp
-- commented out the code to put the weather data on the bus, a
different scheme for this is needed.
2000-10-24 00:34:50 +00:00
|
|
|
|
|
|
|
void FGInterface::set_Velocities_Local( double north,
|
|
|
|
double east,
|
|
|
|
double down ){
|
|
|
|
v_local_v[0] = north;
|
|
|
|
v_local_v[1] = east;
|
2001-12-07 22:38:19 +00:00
|
|
|
v_local_v[2] = down;
|
|
|
|
}
|
I tested:
LaRCsim c172 on-ground and in-air starts, reset: all work
UIUC Cessna172 on-ground and in-air starts work as expected, reset
results in an aircraft that is upside down but does not crash FG. I
don't know what it was like before, so it may well be no change.
JSBSim c172 and X15 in-air starts work fine, resets now work (and are
trimmed), on-ground starts do not -- the c172 ends up on its back. I
suspect this is no worse than before.
I did not test:
Balloon (the weather code returns nan's for the atmosphere data --this
is in the weather module and apparently is a linux only bug)
ADA (don't know how)
MagicCarpet (needs work yet)
External (don't know how)
known to be broken:
LaRCsim c172 on-ground starts with a negative terrain altitude (this
happens at KPAO when the scenery is not present). The FDM inits to
about 50 feet AGL and the model falls to the ground. It does stay
upright, however, and seems to be fine once it settles out, FWIW.
To do:
--implement set_Model on the bus
--bring Christian's weather data into JSBSim
-- add default method to bus for updating things like the sin and cos of
latitude (for Balloon, MagicCarpet)
-- lots of cleanup
The files:
src/FDM/flight.cxx
src/FDM/flight.hxx
-- all data members now declared protected instead of private.
-- eliminated all but a small set of 'setters', no change to getters.
-- that small set is declared virtual, the default implementation
provided preserves the old behavior
-- all of the vector data members are now initialized.
-- added busdump() method -- FG_LOG's all the bus data when called,
useful for diagnostics.
src/FDM/ADA.cxx
-- bus data members now directly assigned to
src/FDM/Balloon.cxx
-- bus data members now directly assigned to
-- changed V_equiv_kts to V_calibrated_kts
src/FDM/JSBSim.cxx
src/FDM/JSBSim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with JSBSim specific
logic
-- changed the static FDMExec to a dynamic fdmex (needed so that the
JSBSim object can be deleted when a model change is called for)
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- added logic to bring up FGEngInterface objects and set the RPM and
throttle values.
src/FDM/LaRCsim.cxx
src/FDM/LaRCsim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with LaRCsim specific
logic, uses LaRCsimIC
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- moved default inertias to here from fg_init.cxx
-- eliminated the climb rate calculation. The equivalent, climb_rate =
-1*vdown, is now in copy_from_LaRCsim().
src/FDM/LaRCsimIC.cxx
src/FDM/LaRCsimIC.hxx
-- similar to FGInitialCondition, this class has all the logic needed to
turn data like Vc and Mach into the more fundamental quantities LaRCsim
needs to initialize.
-- put it in src/FDM since it is a class
src/FDM/MagicCarpet.cxx
-- bus data members now directly assigned to
src/FDM/Makefile.am
-- adds LaRCsimIC.hxx and cxx
src/FDM/JSBSim/FGAtmosphere.h
src/FDM/JSBSim/FGDefs.h
src/FDM/JSBSim/FGInitialCondition.cpp
src/FDM/JSBSim/FGInitialCondition.h
src/FDM/JSBSim/JSBSim.cpp
-- changes to accomodate the new bus
src/FDM/LaRCsim/atmos_62.h
src/FDM/LaRCsim/ls_geodesy.h
-- surrounded prototypes with #ifdef __cplusplus ... #endif , functions
here are needed in LaRCsimIC
src/FDM/LaRCsim/c172_main.c
src/FDM/LaRCsim/cherokee_aero.c
src/FDM/LaRCsim/ls_aux.c
src/FDM/LaRCsim/ls_constants.h
src/FDM/LaRCsim/ls_geodesy.c
src/FDM/LaRCsim/ls_geodesy.h
src/FDM/LaRCsim/ls_step.c
src/FDM/UIUCModel/uiuc_betaprobe.cpp
-- changed PI to LS_PI, eliminates preprocessor naming conflict with
weather module
src/FDM/LaRCsim/ls_interface.c
src/FDM/LaRCsim/ls_interface.h
-- added function ls_set_model_dt()
src/Main/bfi.cxx
-- eliminated calls that set the NED speeds to body components. They
are no longer needed and confuse the new bus.
src/Main/fg_init.cxx
-- eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). or set default values. The bus now handles the
defaults and updates itself when the setters are called (for LaRCsim and
JSBSim). A default method for doing this needs to be added to the bus.
-- added fgVelocityInit() to set the speed the user asked for. Both
JSBSim and LaRCsim can now be initialized using any of:
vc,mach, NED components, UVW components.
src/Main/main.cxx
--eliminated call to fgFDMSetGroundElevation, this data is now 'pulled'
onto the bus every update()
src/Main/options.cxx
src/Main/options.hxx
-- added enum to keep track of the speed requested by the user
-- eliminated calls to set NED velocity properties to body speeds, they
are no longer needed.
-- added options for the NED components.
src/Network/garmin.cxx
src/Network/nmea.cxx
--eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). The bus now updates itself when the setters are
called (for LaRCsim and JSBSim). A default method for doing this needs
to be added to the bus.
-- changed set_V_equiv_kts to set_V_calibrated_kts. set_V_equiv_kts no
longer exists ( get_V_equiv_kts still does, though)
src/WeatherCM/FGLocalWeatherDatabase.cpp
-- commented out the code to put the weather data on the bus, a
different scheme for this is needed.
2000-10-24 00:34:50 +00:00
|
|
|
|
|
|
|
void FGInterface::set_Velocities_Wind_Body( double u,
|
|
|
|
double v,
|
|
|
|
double w){
|
|
|
|
v_wind_body_v[0] = u;
|
|
|
|
v_wind_body_v[1] = v;
|
|
|
|
v_wind_body_v[2] = w;
|
2001-12-07 22:38:19 +00:00
|
|
|
}
|
I tested:
LaRCsim c172 on-ground and in-air starts, reset: all work
UIUC Cessna172 on-ground and in-air starts work as expected, reset
results in an aircraft that is upside down but does not crash FG. I
don't know what it was like before, so it may well be no change.
JSBSim c172 and X15 in-air starts work fine, resets now work (and are
trimmed), on-ground starts do not -- the c172 ends up on its back. I
suspect this is no worse than before.
I did not test:
Balloon (the weather code returns nan's for the atmosphere data --this
is in the weather module and apparently is a linux only bug)
ADA (don't know how)
MagicCarpet (needs work yet)
External (don't know how)
known to be broken:
LaRCsim c172 on-ground starts with a negative terrain altitude (this
happens at KPAO when the scenery is not present). The FDM inits to
about 50 feet AGL and the model falls to the ground. It does stay
upright, however, and seems to be fine once it settles out, FWIW.
To do:
--implement set_Model on the bus
--bring Christian's weather data into JSBSim
-- add default method to bus for updating things like the sin and cos of
latitude (for Balloon, MagicCarpet)
-- lots of cleanup
The files:
src/FDM/flight.cxx
src/FDM/flight.hxx
-- all data members now declared protected instead of private.
-- eliminated all but a small set of 'setters', no change to getters.
-- that small set is declared virtual, the default implementation
provided preserves the old behavior
-- all of the vector data members are now initialized.
-- added busdump() method -- FG_LOG's all the bus data when called,
useful for diagnostics.
src/FDM/ADA.cxx
-- bus data members now directly assigned to
src/FDM/Balloon.cxx
-- bus data members now directly assigned to
-- changed V_equiv_kts to V_calibrated_kts
src/FDM/JSBSim.cxx
src/FDM/JSBSim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with JSBSim specific
logic
-- changed the static FDMExec to a dynamic fdmex (needed so that the
JSBSim object can be deleted when a model change is called for)
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- added logic to bring up FGEngInterface objects and set the RPM and
throttle values.
src/FDM/LaRCsim.cxx
src/FDM/LaRCsim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with LaRCsim specific
logic, uses LaRCsimIC
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- moved default inertias to here from fg_init.cxx
-- eliminated the climb rate calculation. The equivalent, climb_rate =
-1*vdown, is now in copy_from_LaRCsim().
src/FDM/LaRCsimIC.cxx
src/FDM/LaRCsimIC.hxx
-- similar to FGInitialCondition, this class has all the logic needed to
turn data like Vc and Mach into the more fundamental quantities LaRCsim
needs to initialize.
-- put it in src/FDM since it is a class
src/FDM/MagicCarpet.cxx
-- bus data members now directly assigned to
src/FDM/Makefile.am
-- adds LaRCsimIC.hxx and cxx
src/FDM/JSBSim/FGAtmosphere.h
src/FDM/JSBSim/FGDefs.h
src/FDM/JSBSim/FGInitialCondition.cpp
src/FDM/JSBSim/FGInitialCondition.h
src/FDM/JSBSim/JSBSim.cpp
-- changes to accomodate the new bus
src/FDM/LaRCsim/atmos_62.h
src/FDM/LaRCsim/ls_geodesy.h
-- surrounded prototypes with #ifdef __cplusplus ... #endif , functions
here are needed in LaRCsimIC
src/FDM/LaRCsim/c172_main.c
src/FDM/LaRCsim/cherokee_aero.c
src/FDM/LaRCsim/ls_aux.c
src/FDM/LaRCsim/ls_constants.h
src/FDM/LaRCsim/ls_geodesy.c
src/FDM/LaRCsim/ls_geodesy.h
src/FDM/LaRCsim/ls_step.c
src/FDM/UIUCModel/uiuc_betaprobe.cpp
-- changed PI to LS_PI, eliminates preprocessor naming conflict with
weather module
src/FDM/LaRCsim/ls_interface.c
src/FDM/LaRCsim/ls_interface.h
-- added function ls_set_model_dt()
src/Main/bfi.cxx
-- eliminated calls that set the NED speeds to body components. They
are no longer needed and confuse the new bus.
src/Main/fg_init.cxx
-- eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). or set default values. The bus now handles the
defaults and updates itself when the setters are called (for LaRCsim and
JSBSim). A default method for doing this needs to be added to the bus.
-- added fgVelocityInit() to set the speed the user asked for. Both
JSBSim and LaRCsim can now be initialized using any of:
vc,mach, NED components, UVW components.
src/Main/main.cxx
--eliminated call to fgFDMSetGroundElevation, this data is now 'pulled'
onto the bus every update()
src/Main/options.cxx
src/Main/options.hxx
-- added enum to keep track of the speed requested by the user
-- eliminated calls to set NED velocity properties to body speeds, they
are no longer needed.
-- added options for the NED components.
src/Network/garmin.cxx
src/Network/nmea.cxx
--eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). The bus now updates itself when the setters are
called (for LaRCsim and JSBSim). A default method for doing this needs
to be added to the bus.
-- changed set_V_equiv_kts to set_V_calibrated_kts. set_V_equiv_kts no
longer exists ( get_V_equiv_kts still does, though)
src/WeatherCM/FGLocalWeatherDatabase.cpp
-- commented out the code to put the weather data on the bus, a
different scheme for this is needed.
2000-10-24 00:34:50 +00:00
|
|
|
|
|
|
|
// Euler angles
|
|
|
|
void FGInterface::set_Euler_Angles( double phi,
|
|
|
|
double theta,
|
|
|
|
double psi ) {
|
|
|
|
euler_angles_v[0] = phi;
|
|
|
|
euler_angles_v[1] = theta;
|
|
|
|
euler_angles_v[2] = psi;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Flight Path
|
|
|
|
void FGInterface::set_Climb_Rate( double roc) {
|
|
|
|
climb_rate = roc;
|
2001-12-07 22:38:19 +00:00
|
|
|
}
|
I tested:
LaRCsim c172 on-ground and in-air starts, reset: all work
UIUC Cessna172 on-ground and in-air starts work as expected, reset
results in an aircraft that is upside down but does not crash FG. I
don't know what it was like before, so it may well be no change.
JSBSim c172 and X15 in-air starts work fine, resets now work (and are
trimmed), on-ground starts do not -- the c172 ends up on its back. I
suspect this is no worse than before.
I did not test:
Balloon (the weather code returns nan's for the atmosphere data --this
is in the weather module and apparently is a linux only bug)
ADA (don't know how)
MagicCarpet (needs work yet)
External (don't know how)
known to be broken:
LaRCsim c172 on-ground starts with a negative terrain altitude (this
happens at KPAO when the scenery is not present). The FDM inits to
about 50 feet AGL and the model falls to the ground. It does stay
upright, however, and seems to be fine once it settles out, FWIW.
To do:
--implement set_Model on the bus
--bring Christian's weather data into JSBSim
-- add default method to bus for updating things like the sin and cos of
latitude (for Balloon, MagicCarpet)
-- lots of cleanup
The files:
src/FDM/flight.cxx
src/FDM/flight.hxx
-- all data members now declared protected instead of private.
-- eliminated all but a small set of 'setters', no change to getters.
-- that small set is declared virtual, the default implementation
provided preserves the old behavior
-- all of the vector data members are now initialized.
-- added busdump() method -- FG_LOG's all the bus data when called,
useful for diagnostics.
src/FDM/ADA.cxx
-- bus data members now directly assigned to
src/FDM/Balloon.cxx
-- bus data members now directly assigned to
-- changed V_equiv_kts to V_calibrated_kts
src/FDM/JSBSim.cxx
src/FDM/JSBSim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with JSBSim specific
logic
-- changed the static FDMExec to a dynamic fdmex (needed so that the
JSBSim object can be deleted when a model change is called for)
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- added logic to bring up FGEngInterface objects and set the RPM and
throttle values.
src/FDM/LaRCsim.cxx
src/FDM/LaRCsim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with LaRCsim specific
logic, uses LaRCsimIC
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- moved default inertias to here from fg_init.cxx
-- eliminated the climb rate calculation. The equivalent, climb_rate =
-1*vdown, is now in copy_from_LaRCsim().
src/FDM/LaRCsimIC.cxx
src/FDM/LaRCsimIC.hxx
-- similar to FGInitialCondition, this class has all the logic needed to
turn data like Vc and Mach into the more fundamental quantities LaRCsim
needs to initialize.
-- put it in src/FDM since it is a class
src/FDM/MagicCarpet.cxx
-- bus data members now directly assigned to
src/FDM/Makefile.am
-- adds LaRCsimIC.hxx and cxx
src/FDM/JSBSim/FGAtmosphere.h
src/FDM/JSBSim/FGDefs.h
src/FDM/JSBSim/FGInitialCondition.cpp
src/FDM/JSBSim/FGInitialCondition.h
src/FDM/JSBSim/JSBSim.cpp
-- changes to accomodate the new bus
src/FDM/LaRCsim/atmos_62.h
src/FDM/LaRCsim/ls_geodesy.h
-- surrounded prototypes with #ifdef __cplusplus ... #endif , functions
here are needed in LaRCsimIC
src/FDM/LaRCsim/c172_main.c
src/FDM/LaRCsim/cherokee_aero.c
src/FDM/LaRCsim/ls_aux.c
src/FDM/LaRCsim/ls_constants.h
src/FDM/LaRCsim/ls_geodesy.c
src/FDM/LaRCsim/ls_geodesy.h
src/FDM/LaRCsim/ls_step.c
src/FDM/UIUCModel/uiuc_betaprobe.cpp
-- changed PI to LS_PI, eliminates preprocessor naming conflict with
weather module
src/FDM/LaRCsim/ls_interface.c
src/FDM/LaRCsim/ls_interface.h
-- added function ls_set_model_dt()
src/Main/bfi.cxx
-- eliminated calls that set the NED speeds to body components. They
are no longer needed and confuse the new bus.
src/Main/fg_init.cxx
-- eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). or set default values. The bus now handles the
defaults and updates itself when the setters are called (for LaRCsim and
JSBSim). A default method for doing this needs to be added to the bus.
-- added fgVelocityInit() to set the speed the user asked for. Both
JSBSim and LaRCsim can now be initialized using any of:
vc,mach, NED components, UVW components.
src/Main/main.cxx
--eliminated call to fgFDMSetGroundElevation, this data is now 'pulled'
onto the bus every update()
src/Main/options.cxx
src/Main/options.hxx
-- added enum to keep track of the speed requested by the user
-- eliminated calls to set NED velocity properties to body speeds, they
are no longer needed.
-- added options for the NED components.
src/Network/garmin.cxx
src/Network/nmea.cxx
--eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). The bus now updates itself when the setters are
called (for LaRCsim and JSBSim). A default method for doing this needs
to be added to the bus.
-- changed set_V_equiv_kts to set_V_calibrated_kts. set_V_equiv_kts no
longer exists ( get_V_equiv_kts still does, though)
src/WeatherCM/FGLocalWeatherDatabase.cpp
-- commented out the code to put the weather data on the bus, a
different scheme for this is needed.
2000-10-24 00:34:50 +00:00
|
|
|
|
|
|
|
void FGInterface::set_Gamma_vert_rad( double gamma) {
|
|
|
|
gamma_vert_rad = gamma;
|
2001-12-07 22:38:19 +00:00
|
|
|
}
|
I tested:
LaRCsim c172 on-ground and in-air starts, reset: all work
UIUC Cessna172 on-ground and in-air starts work as expected, reset
results in an aircraft that is upside down but does not crash FG. I
don't know what it was like before, so it may well be no change.
JSBSim c172 and X15 in-air starts work fine, resets now work (and are
trimmed), on-ground starts do not -- the c172 ends up on its back. I
suspect this is no worse than before.
I did not test:
Balloon (the weather code returns nan's for the atmosphere data --this
is in the weather module and apparently is a linux only bug)
ADA (don't know how)
MagicCarpet (needs work yet)
External (don't know how)
known to be broken:
LaRCsim c172 on-ground starts with a negative terrain altitude (this
happens at KPAO when the scenery is not present). The FDM inits to
about 50 feet AGL and the model falls to the ground. It does stay
upright, however, and seems to be fine once it settles out, FWIW.
To do:
--implement set_Model on the bus
--bring Christian's weather data into JSBSim
-- add default method to bus for updating things like the sin and cos of
latitude (for Balloon, MagicCarpet)
-- lots of cleanup
The files:
src/FDM/flight.cxx
src/FDM/flight.hxx
-- all data members now declared protected instead of private.
-- eliminated all but a small set of 'setters', no change to getters.
-- that small set is declared virtual, the default implementation
provided preserves the old behavior
-- all of the vector data members are now initialized.
-- added busdump() method -- FG_LOG's all the bus data when called,
useful for diagnostics.
src/FDM/ADA.cxx
-- bus data members now directly assigned to
src/FDM/Balloon.cxx
-- bus data members now directly assigned to
-- changed V_equiv_kts to V_calibrated_kts
src/FDM/JSBSim.cxx
src/FDM/JSBSim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with JSBSim specific
logic
-- changed the static FDMExec to a dynamic fdmex (needed so that the
JSBSim object can be deleted when a model change is called for)
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- added logic to bring up FGEngInterface objects and set the RPM and
throttle values.
src/FDM/LaRCsim.cxx
src/FDM/LaRCsim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with LaRCsim specific
logic, uses LaRCsimIC
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- moved default inertias to here from fg_init.cxx
-- eliminated the climb rate calculation. The equivalent, climb_rate =
-1*vdown, is now in copy_from_LaRCsim().
src/FDM/LaRCsimIC.cxx
src/FDM/LaRCsimIC.hxx
-- similar to FGInitialCondition, this class has all the logic needed to
turn data like Vc and Mach into the more fundamental quantities LaRCsim
needs to initialize.
-- put it in src/FDM since it is a class
src/FDM/MagicCarpet.cxx
-- bus data members now directly assigned to
src/FDM/Makefile.am
-- adds LaRCsimIC.hxx and cxx
src/FDM/JSBSim/FGAtmosphere.h
src/FDM/JSBSim/FGDefs.h
src/FDM/JSBSim/FGInitialCondition.cpp
src/FDM/JSBSim/FGInitialCondition.h
src/FDM/JSBSim/JSBSim.cpp
-- changes to accomodate the new bus
src/FDM/LaRCsim/atmos_62.h
src/FDM/LaRCsim/ls_geodesy.h
-- surrounded prototypes with #ifdef __cplusplus ... #endif , functions
here are needed in LaRCsimIC
src/FDM/LaRCsim/c172_main.c
src/FDM/LaRCsim/cherokee_aero.c
src/FDM/LaRCsim/ls_aux.c
src/FDM/LaRCsim/ls_constants.h
src/FDM/LaRCsim/ls_geodesy.c
src/FDM/LaRCsim/ls_geodesy.h
src/FDM/LaRCsim/ls_step.c
src/FDM/UIUCModel/uiuc_betaprobe.cpp
-- changed PI to LS_PI, eliminates preprocessor naming conflict with
weather module
src/FDM/LaRCsim/ls_interface.c
src/FDM/LaRCsim/ls_interface.h
-- added function ls_set_model_dt()
src/Main/bfi.cxx
-- eliminated calls that set the NED speeds to body components. They
are no longer needed and confuse the new bus.
src/Main/fg_init.cxx
-- eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). or set default values. The bus now handles the
defaults and updates itself when the setters are called (for LaRCsim and
JSBSim). A default method for doing this needs to be added to the bus.
-- added fgVelocityInit() to set the speed the user asked for. Both
JSBSim and LaRCsim can now be initialized using any of:
vc,mach, NED components, UVW components.
src/Main/main.cxx
--eliminated call to fgFDMSetGroundElevation, this data is now 'pulled'
onto the bus every update()
src/Main/options.cxx
src/Main/options.hxx
-- added enum to keep track of the speed requested by the user
-- eliminated calls to set NED velocity properties to body speeds, they
are no longer needed.
-- added options for the NED components.
src/Network/garmin.cxx
src/Network/nmea.cxx
--eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). The bus now updates itself when the setters are
called (for LaRCsim and JSBSim). A default method for doing this needs
to be added to the bus.
-- changed set_V_equiv_kts to set_V_calibrated_kts. set_V_equiv_kts no
longer exists ( get_V_equiv_kts still does, though)
src/WeatherCM/FGLocalWeatherDatabase.cpp
-- commented out the code to put the weather data on the bus, a
different scheme for this is needed.
2000-10-24 00:34:50 +00:00
|
|
|
|
|
|
|
void FGInterface::set_Static_pressure(double p) { static_pressure = p; }
|
|
|
|
void FGInterface::set_Static_temperature(double T) { static_temperature = T; }
|
|
|
|
void FGInterface::set_Density(double rho) { density = rho; }
|
|
|
|
|
|
|
|
void FGInterface::set_Velocities_Local_Airmass (double wnorth,
|
|
|
|
double weast,
|
|
|
|
double wdown ) {
|
|
|
|
v_local_airmass_v[0] = wnorth;
|
|
|
|
v_local_airmass_v[1] = weast;
|
|
|
|
v_local_airmass_v[2] = wdown;
|
2001-12-07 22:38:19 +00:00
|
|
|
}
|
I tested:
LaRCsim c172 on-ground and in-air starts, reset: all work
UIUC Cessna172 on-ground and in-air starts work as expected, reset
results in an aircraft that is upside down but does not crash FG. I
don't know what it was like before, so it may well be no change.
JSBSim c172 and X15 in-air starts work fine, resets now work (and are
trimmed), on-ground starts do not -- the c172 ends up on its back. I
suspect this is no worse than before.
I did not test:
Balloon (the weather code returns nan's for the atmosphere data --this
is in the weather module and apparently is a linux only bug)
ADA (don't know how)
MagicCarpet (needs work yet)
External (don't know how)
known to be broken:
LaRCsim c172 on-ground starts with a negative terrain altitude (this
happens at KPAO when the scenery is not present). The FDM inits to
about 50 feet AGL and the model falls to the ground. It does stay
upright, however, and seems to be fine once it settles out, FWIW.
To do:
--implement set_Model on the bus
--bring Christian's weather data into JSBSim
-- add default method to bus for updating things like the sin and cos of
latitude (for Balloon, MagicCarpet)
-- lots of cleanup
The files:
src/FDM/flight.cxx
src/FDM/flight.hxx
-- all data members now declared protected instead of private.
-- eliminated all but a small set of 'setters', no change to getters.
-- that small set is declared virtual, the default implementation
provided preserves the old behavior
-- all of the vector data members are now initialized.
-- added busdump() method -- FG_LOG's all the bus data when called,
useful for diagnostics.
src/FDM/ADA.cxx
-- bus data members now directly assigned to
src/FDM/Balloon.cxx
-- bus data members now directly assigned to
-- changed V_equiv_kts to V_calibrated_kts
src/FDM/JSBSim.cxx
src/FDM/JSBSim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with JSBSim specific
logic
-- changed the static FDMExec to a dynamic fdmex (needed so that the
JSBSim object can be deleted when a model change is called for)
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- added logic to bring up FGEngInterface objects and set the RPM and
throttle values.
src/FDM/LaRCsim.cxx
src/FDM/LaRCsim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with LaRCsim specific
logic, uses LaRCsimIC
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- moved default inertias to here from fg_init.cxx
-- eliminated the climb rate calculation. The equivalent, climb_rate =
-1*vdown, is now in copy_from_LaRCsim().
src/FDM/LaRCsimIC.cxx
src/FDM/LaRCsimIC.hxx
-- similar to FGInitialCondition, this class has all the logic needed to
turn data like Vc and Mach into the more fundamental quantities LaRCsim
needs to initialize.
-- put it in src/FDM since it is a class
src/FDM/MagicCarpet.cxx
-- bus data members now directly assigned to
src/FDM/Makefile.am
-- adds LaRCsimIC.hxx and cxx
src/FDM/JSBSim/FGAtmosphere.h
src/FDM/JSBSim/FGDefs.h
src/FDM/JSBSim/FGInitialCondition.cpp
src/FDM/JSBSim/FGInitialCondition.h
src/FDM/JSBSim/JSBSim.cpp
-- changes to accomodate the new bus
src/FDM/LaRCsim/atmos_62.h
src/FDM/LaRCsim/ls_geodesy.h
-- surrounded prototypes with #ifdef __cplusplus ... #endif , functions
here are needed in LaRCsimIC
src/FDM/LaRCsim/c172_main.c
src/FDM/LaRCsim/cherokee_aero.c
src/FDM/LaRCsim/ls_aux.c
src/FDM/LaRCsim/ls_constants.h
src/FDM/LaRCsim/ls_geodesy.c
src/FDM/LaRCsim/ls_geodesy.h
src/FDM/LaRCsim/ls_step.c
src/FDM/UIUCModel/uiuc_betaprobe.cpp
-- changed PI to LS_PI, eliminates preprocessor naming conflict with
weather module
src/FDM/LaRCsim/ls_interface.c
src/FDM/LaRCsim/ls_interface.h
-- added function ls_set_model_dt()
src/Main/bfi.cxx
-- eliminated calls that set the NED speeds to body components. They
are no longer needed and confuse the new bus.
src/Main/fg_init.cxx
-- eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). or set default values. The bus now handles the
defaults and updates itself when the setters are called (for LaRCsim and
JSBSim). A default method for doing this needs to be added to the bus.
-- added fgVelocityInit() to set the speed the user asked for. Both
JSBSim and LaRCsim can now be initialized using any of:
vc,mach, NED components, UVW components.
src/Main/main.cxx
--eliminated call to fgFDMSetGroundElevation, this data is now 'pulled'
onto the bus every update()
src/Main/options.cxx
src/Main/options.hxx
-- added enum to keep track of the speed requested by the user
-- eliminated calls to set NED velocity properties to body speeds, they
are no longer needed.
-- added options for the NED components.
src/Network/garmin.cxx
src/Network/nmea.cxx
--eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). The bus now updates itself when the setters are
called (for LaRCsim and JSBSim). A default method for doing this needs
to be added to the bus.
-- changed set_V_equiv_kts to set_V_calibrated_kts. set_V_equiv_kts no
longer exists ( get_V_equiv_kts still does, though)
src/WeatherCM/FGLocalWeatherDatabase.cpp
-- commented out the code to put the weather data on the bus, a
different scheme for this is needed.
2000-10-24 00:34:50 +00:00
|
|
|
|
|
|
|
|
2000-10-28 16:30:30 +00:00
|
|
|
void FGInterface::_busdump(void) {
|
I tested:
LaRCsim c172 on-ground and in-air starts, reset: all work
UIUC Cessna172 on-ground and in-air starts work as expected, reset
results in an aircraft that is upside down but does not crash FG. I
don't know what it was like before, so it may well be no change.
JSBSim c172 and X15 in-air starts work fine, resets now work (and are
trimmed), on-ground starts do not -- the c172 ends up on its back. I
suspect this is no worse than before.
I did not test:
Balloon (the weather code returns nan's for the atmosphere data --this
is in the weather module and apparently is a linux only bug)
ADA (don't know how)
MagicCarpet (needs work yet)
External (don't know how)
known to be broken:
LaRCsim c172 on-ground starts with a negative terrain altitude (this
happens at KPAO when the scenery is not present). The FDM inits to
about 50 feet AGL and the model falls to the ground. It does stay
upright, however, and seems to be fine once it settles out, FWIW.
To do:
--implement set_Model on the bus
--bring Christian's weather data into JSBSim
-- add default method to bus for updating things like the sin and cos of
latitude (for Balloon, MagicCarpet)
-- lots of cleanup
The files:
src/FDM/flight.cxx
src/FDM/flight.hxx
-- all data members now declared protected instead of private.
-- eliminated all but a small set of 'setters', no change to getters.
-- that small set is declared virtual, the default implementation
provided preserves the old behavior
-- all of the vector data members are now initialized.
-- added busdump() method -- FG_LOG's all the bus data when called,
useful for diagnostics.
src/FDM/ADA.cxx
-- bus data members now directly assigned to
src/FDM/Balloon.cxx
-- bus data members now directly assigned to
-- changed V_equiv_kts to V_calibrated_kts
src/FDM/JSBSim.cxx
src/FDM/JSBSim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with JSBSim specific
logic
-- changed the static FDMExec to a dynamic fdmex (needed so that the
JSBSim object can be deleted when a model change is called for)
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- added logic to bring up FGEngInterface objects and set the RPM and
throttle values.
src/FDM/LaRCsim.cxx
src/FDM/LaRCsim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with LaRCsim specific
logic, uses LaRCsimIC
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- moved default inertias to here from fg_init.cxx
-- eliminated the climb rate calculation. The equivalent, climb_rate =
-1*vdown, is now in copy_from_LaRCsim().
src/FDM/LaRCsimIC.cxx
src/FDM/LaRCsimIC.hxx
-- similar to FGInitialCondition, this class has all the logic needed to
turn data like Vc and Mach into the more fundamental quantities LaRCsim
needs to initialize.
-- put it in src/FDM since it is a class
src/FDM/MagicCarpet.cxx
-- bus data members now directly assigned to
src/FDM/Makefile.am
-- adds LaRCsimIC.hxx and cxx
src/FDM/JSBSim/FGAtmosphere.h
src/FDM/JSBSim/FGDefs.h
src/FDM/JSBSim/FGInitialCondition.cpp
src/FDM/JSBSim/FGInitialCondition.h
src/FDM/JSBSim/JSBSim.cpp
-- changes to accomodate the new bus
src/FDM/LaRCsim/atmos_62.h
src/FDM/LaRCsim/ls_geodesy.h
-- surrounded prototypes with #ifdef __cplusplus ... #endif , functions
here are needed in LaRCsimIC
src/FDM/LaRCsim/c172_main.c
src/FDM/LaRCsim/cherokee_aero.c
src/FDM/LaRCsim/ls_aux.c
src/FDM/LaRCsim/ls_constants.h
src/FDM/LaRCsim/ls_geodesy.c
src/FDM/LaRCsim/ls_geodesy.h
src/FDM/LaRCsim/ls_step.c
src/FDM/UIUCModel/uiuc_betaprobe.cpp
-- changed PI to LS_PI, eliminates preprocessor naming conflict with
weather module
src/FDM/LaRCsim/ls_interface.c
src/FDM/LaRCsim/ls_interface.h
-- added function ls_set_model_dt()
src/Main/bfi.cxx
-- eliminated calls that set the NED speeds to body components. They
are no longer needed and confuse the new bus.
src/Main/fg_init.cxx
-- eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). or set default values. The bus now handles the
defaults and updates itself when the setters are called (for LaRCsim and
JSBSim). A default method for doing this needs to be added to the bus.
-- added fgVelocityInit() to set the speed the user asked for. Both
JSBSim and LaRCsim can now be initialized using any of:
vc,mach, NED components, UVW components.
src/Main/main.cxx
--eliminated call to fgFDMSetGroundElevation, this data is now 'pulled'
onto the bus every update()
src/Main/options.cxx
src/Main/options.hxx
-- added enum to keep track of the speed requested by the user
-- eliminated calls to set NED velocity properties to body speeds, they
are no longer needed.
-- added options for the NED components.
src/Network/garmin.cxx
src/Network/nmea.cxx
--eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). The bus now updates itself when the setters are
called (for LaRCsim and JSBSim). A default method for doing this needs
to be added to the bus.
-- changed set_V_equiv_kts to set_V_calibrated_kts. set_V_equiv_kts no
longer exists ( get_V_equiv_kts still does, though)
src/WeatherCM/FGLocalWeatherDatabase.cpp
-- commented out the code to put the weather data on the bus, a
different scheme for this is needed.
2000-10-24 00:34:50 +00:00
|
|
|
|
2007-07-29 10:21:22 +00:00
|
|
|
SG_LOG(SG_FLIGHT,SG_INFO,"d_cg_rp_body_v: " << d_cg_rp_body_v);
|
|
|
|
SG_LOG(SG_FLIGHT,SG_INFO,"v_dot_local_v: " << v_dot_local_v);
|
|
|
|
SG_LOG(SG_FLIGHT,SG_INFO,"v_dot_body_v: " << v_dot_body_v);
|
|
|
|
SG_LOG(SG_FLIGHT,SG_INFO,"a_cg_body_v: " << a_cg_body_v);
|
|
|
|
SG_LOG(SG_FLIGHT,SG_INFO,"a_pilot_body_v: " << a_pilot_body_v);
|
|
|
|
SG_LOG(SG_FLIGHT,SG_INFO,"n_cg_body_v: " << n_cg_body_v);
|
|
|
|
SG_LOG(SG_FLIGHT,SG_INFO,"v_local_v: " << v_local_v);
|
|
|
|
SG_LOG(SG_FLIGHT,SG_INFO,"v_local_rel_ground_v: " << v_local_rel_ground_v);
|
|
|
|
SG_LOG(SG_FLIGHT,SG_INFO,"v_local_airmass_v: " << v_local_airmass_v);
|
|
|
|
SG_LOG(SG_FLIGHT,SG_INFO,"v_wind_body_v: " << v_wind_body_v);
|
|
|
|
SG_LOG(SG_FLIGHT,SG_INFO,"omega_body_v: " << omega_body_v);
|
|
|
|
SG_LOG(SG_FLIGHT,SG_INFO,"euler_rates_v: " << euler_rates_v);
|
|
|
|
SG_LOG(SG_FLIGHT,SG_INFO,"geocentric_rates_v: " << geocentric_rates_v);
|
|
|
|
SG_LOG(SG_FLIGHT,SG_INFO,"geocentric_position_v: " << geocentric_position_v);
|
|
|
|
SG_LOG(SG_FLIGHT,SG_INFO,"geodetic_position_v: " << geodetic_position_v);
|
|
|
|
SG_LOG(SG_FLIGHT,SG_INFO,"euler_angles_v: " << euler_angles_v);
|
2001-03-24 06:03:11 +00:00
|
|
|
|
|
|
|
SG_LOG(SG_FLIGHT,SG_INFO,"nlf: " << nlf );
|
|
|
|
SG_LOG(SG_FLIGHT,SG_INFO,"v_rel_wind: " << v_rel_wind );
|
|
|
|
SG_LOG(SG_FLIGHT,SG_INFO,"v_true_kts: " << v_true_kts );
|
|
|
|
SG_LOG(SG_FLIGHT,SG_INFO,"v_ground_speed: " << v_ground_speed );
|
|
|
|
SG_LOG(SG_FLIGHT,SG_INFO,"v_equiv_kts: " << v_equiv_kts );
|
|
|
|
SG_LOG(SG_FLIGHT,SG_INFO,"v_calibrated_kts: " << v_calibrated_kts );
|
|
|
|
SG_LOG(SG_FLIGHT,SG_INFO,"alpha: " << alpha );
|
|
|
|
SG_LOG(SG_FLIGHT,SG_INFO,"beta: " << beta );
|
|
|
|
SG_LOG(SG_FLIGHT,SG_INFO,"gamma_vert_rad: " << gamma_vert_rad );
|
|
|
|
SG_LOG(SG_FLIGHT,SG_INFO,"density: " << density );
|
|
|
|
SG_LOG(SG_FLIGHT,SG_INFO,"mach_number: " << mach_number );
|
|
|
|
SG_LOG(SG_FLIGHT,SG_INFO,"static_pressure: " << static_pressure );
|
|
|
|
SG_LOG(SG_FLIGHT,SG_INFO,"total_pressure: " << total_pressure );
|
|
|
|
SG_LOG(SG_FLIGHT,SG_INFO,"dynamic_pressure: " << dynamic_pressure );
|
|
|
|
SG_LOG(SG_FLIGHT,SG_INFO,"static_temperature: " << static_temperature );
|
|
|
|
SG_LOG(SG_FLIGHT,SG_INFO,"total_temperature: " << total_temperature );
|
|
|
|
SG_LOG(SG_FLIGHT,SG_INFO,"sea_level_radius: " << sea_level_radius );
|
|
|
|
SG_LOG(SG_FLIGHT,SG_INFO,"earth_position_angle: " << earth_position_angle );
|
|
|
|
SG_LOG(SG_FLIGHT,SG_INFO,"runway_altitude: " << runway_altitude );
|
|
|
|
SG_LOG(SG_FLIGHT,SG_INFO,"climb_rate: " << climb_rate );
|
|
|
|
SG_LOG(SG_FLIGHT,SG_INFO,"altitude_agl: " << altitude_agl );
|
2001-12-07 22:38:19 +00:00
|
|
|
}
|
I tested:
LaRCsim c172 on-ground and in-air starts, reset: all work
UIUC Cessna172 on-ground and in-air starts work as expected, reset
results in an aircraft that is upside down but does not crash FG. I
don't know what it was like before, so it may well be no change.
JSBSim c172 and X15 in-air starts work fine, resets now work (and are
trimmed), on-ground starts do not -- the c172 ends up on its back. I
suspect this is no worse than before.
I did not test:
Balloon (the weather code returns nan's for the atmosphere data --this
is in the weather module and apparently is a linux only bug)
ADA (don't know how)
MagicCarpet (needs work yet)
External (don't know how)
known to be broken:
LaRCsim c172 on-ground starts with a negative terrain altitude (this
happens at KPAO when the scenery is not present). The FDM inits to
about 50 feet AGL and the model falls to the ground. It does stay
upright, however, and seems to be fine once it settles out, FWIW.
To do:
--implement set_Model on the bus
--bring Christian's weather data into JSBSim
-- add default method to bus for updating things like the sin and cos of
latitude (for Balloon, MagicCarpet)
-- lots of cleanup
The files:
src/FDM/flight.cxx
src/FDM/flight.hxx
-- all data members now declared protected instead of private.
-- eliminated all but a small set of 'setters', no change to getters.
-- that small set is declared virtual, the default implementation
provided preserves the old behavior
-- all of the vector data members are now initialized.
-- added busdump() method -- FG_LOG's all the bus data when called,
useful for diagnostics.
src/FDM/ADA.cxx
-- bus data members now directly assigned to
src/FDM/Balloon.cxx
-- bus data members now directly assigned to
-- changed V_equiv_kts to V_calibrated_kts
src/FDM/JSBSim.cxx
src/FDM/JSBSim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with JSBSim specific
logic
-- changed the static FDMExec to a dynamic fdmex (needed so that the
JSBSim object can be deleted when a model change is called for)
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- added logic to bring up FGEngInterface objects and set the RPM and
throttle values.
src/FDM/LaRCsim.cxx
src/FDM/LaRCsim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with LaRCsim specific
logic, uses LaRCsimIC
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- moved default inertias to here from fg_init.cxx
-- eliminated the climb rate calculation. The equivalent, climb_rate =
-1*vdown, is now in copy_from_LaRCsim().
src/FDM/LaRCsimIC.cxx
src/FDM/LaRCsimIC.hxx
-- similar to FGInitialCondition, this class has all the logic needed to
turn data like Vc and Mach into the more fundamental quantities LaRCsim
needs to initialize.
-- put it in src/FDM since it is a class
src/FDM/MagicCarpet.cxx
-- bus data members now directly assigned to
src/FDM/Makefile.am
-- adds LaRCsimIC.hxx and cxx
src/FDM/JSBSim/FGAtmosphere.h
src/FDM/JSBSim/FGDefs.h
src/FDM/JSBSim/FGInitialCondition.cpp
src/FDM/JSBSim/FGInitialCondition.h
src/FDM/JSBSim/JSBSim.cpp
-- changes to accomodate the new bus
src/FDM/LaRCsim/atmos_62.h
src/FDM/LaRCsim/ls_geodesy.h
-- surrounded prototypes with #ifdef __cplusplus ... #endif , functions
here are needed in LaRCsimIC
src/FDM/LaRCsim/c172_main.c
src/FDM/LaRCsim/cherokee_aero.c
src/FDM/LaRCsim/ls_aux.c
src/FDM/LaRCsim/ls_constants.h
src/FDM/LaRCsim/ls_geodesy.c
src/FDM/LaRCsim/ls_geodesy.h
src/FDM/LaRCsim/ls_step.c
src/FDM/UIUCModel/uiuc_betaprobe.cpp
-- changed PI to LS_PI, eliminates preprocessor naming conflict with
weather module
src/FDM/LaRCsim/ls_interface.c
src/FDM/LaRCsim/ls_interface.h
-- added function ls_set_model_dt()
src/Main/bfi.cxx
-- eliminated calls that set the NED speeds to body components. They
are no longer needed and confuse the new bus.
src/Main/fg_init.cxx
-- eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). or set default values. The bus now handles the
defaults and updates itself when the setters are called (for LaRCsim and
JSBSim). A default method for doing this needs to be added to the bus.
-- added fgVelocityInit() to set the speed the user asked for. Both
JSBSim and LaRCsim can now be initialized using any of:
vc,mach, NED components, UVW components.
src/Main/main.cxx
--eliminated call to fgFDMSetGroundElevation, this data is now 'pulled'
onto the bus every update()
src/Main/options.cxx
src/Main/options.hxx
-- added enum to keep track of the speed requested by the user
-- eliminated calls to set NED velocity properties to body speeds, they
are no longer needed.
-- added options for the NED components.
src/Network/garmin.cxx
src/Network/nmea.cxx
--eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). The bus now updates itself when the setters are
called (for LaRCsim and JSBSim). A default method for doing this needs
to be added to the bus.
-- changed set_V_equiv_kts to set_V_calibrated_kts. set_V_equiv_kts no
longer exists ( get_V_equiv_kts still does, though)
src/WeatherCM/FGLocalWeatherDatabase.cpp
-- commented out the code to put the weather data on the bus, a
different scheme for this is needed.
2000-10-24 00:34:50 +00:00
|
|
|
|
2004-11-22 10:10:33 +00:00
|
|
|
bool
|
2009-03-15 11:26:31 +00:00
|
|
|
FGInterface::prepare_ground_cache_m(double startSimTime, double endSimTime,
|
|
|
|
const double pt[3], double rad)
|
2004-11-22 10:10:33 +00:00
|
|
|
{
|
2009-03-15 11:26:31 +00:00
|
|
|
return ground_cache.prepare_ground_cache(startSimTime, endSimTime,
|
|
|
|
SGVec3d(pt), rad);
|
2004-11-22 10:10:33 +00:00
|
|
|
}
|
|
|
|
|
2009-03-15 11:26:31 +00:00
|
|
|
bool
|
|
|
|
FGInterface::prepare_ground_cache_ft(double startSimTime, double endSimTime,
|
|
|
|
const double pt[3], double rad)
|
2004-11-22 10:10:33 +00:00
|
|
|
{
|
|
|
|
// Convert units and do the real work.
|
2006-10-29 19:30:21 +00:00
|
|
|
SGVec3d pt_ft = SG_FEET_TO_METER*SGVec3d(pt);
|
2009-03-15 11:26:31 +00:00
|
|
|
return ground_cache.prepare_ground_cache(startSimTime, endSimTime,
|
|
|
|
pt_ft, rad*SG_FEET_TO_METER);
|
2004-11-22 10:10:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
FGInterface::is_valid_m(double *ref_time, double pt[3], double *rad)
|
|
|
|
{
|
2006-10-29 19:30:21 +00:00
|
|
|
SGVec3d _pt;
|
|
|
|
bool valid = ground_cache.is_valid(*ref_time, _pt, *rad);
|
2007-07-29 10:21:22 +00:00
|
|
|
assign(pt, _pt);
|
2006-10-29 19:30:21 +00:00
|
|
|
return valid;
|
2004-11-22 10:10:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool FGInterface::is_valid_ft(double *ref_time, double pt[3], double *rad)
|
|
|
|
{
|
|
|
|
// Convert units and do the real work.
|
2006-10-29 19:30:21 +00:00
|
|
|
SGVec3d _pt;
|
|
|
|
bool found_ground = ground_cache.is_valid(*ref_time, _pt, *rad);
|
2007-07-29 10:21:22 +00:00
|
|
|
assign(pt, SG_METER_TO_FEET*_pt);
|
2004-11-22 10:10:33 +00:00
|
|
|
*rad *= SG_METER_TO_FEET;
|
|
|
|
return found_ground;
|
|
|
|
}
|
|
|
|
|
|
|
|
double
|
|
|
|
FGInterface::get_cat_m(double t, const double pt[3],
|
|
|
|
double end[2][3], double vel[2][3])
|
|
|
|
{
|
2006-10-29 19:30:21 +00:00
|
|
|
SGVec3d _end[2], _vel[2];
|
|
|
|
double dist = ground_cache.get_cat(t, SGVec3d(pt), _end, _vel);
|
|
|
|
for (int k=0; k<2; ++k) {
|
2007-07-29 10:21:22 +00:00
|
|
|
assign( end[k], _end[k] );
|
|
|
|
assign( vel[k], _vel[k] );
|
2006-10-29 19:30:21 +00:00
|
|
|
}
|
|
|
|
return dist;
|
2004-11-22 10:10:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
double
|
|
|
|
FGInterface::get_cat_ft(double t, const double pt[3],
|
|
|
|
double end[2][3], double vel[2][3])
|
|
|
|
{
|
|
|
|
// Convert units and do the real work.
|
2006-10-29 19:30:21 +00:00
|
|
|
SGVec3d pt_m = SG_FEET_TO_METER*SGVec3d(pt);
|
|
|
|
SGVec3d _end[2], _vel[2];
|
|
|
|
double dist = ground_cache.get_cat(t, pt_m, _end, _vel);
|
2004-11-22 10:10:33 +00:00
|
|
|
for (int k=0; k<2; ++k) {
|
2007-07-29 10:21:22 +00:00
|
|
|
assign( end[k], SG_METER_TO_FEET*_end[k] );
|
|
|
|
assign( vel[k], SG_METER_TO_FEET*_vel[k] );
|
2004-11-22 10:10:33 +00:00
|
|
|
}
|
|
|
|
return dist*SG_METER_TO_FEET;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2009-03-06 16:37:12 +00:00
|
|
|
FGInterface::get_body_m(double t, simgear::BVHNode::Id id,
|
|
|
|
double bodyToWorld[16], double linearVel[3],
|
|
|
|
double angularVel[3])
|
2004-11-22 10:10:33 +00:00
|
|
|
{
|
2009-03-06 16:37:12 +00:00
|
|
|
SGMatrixd _bodyToWorld;
|
|
|
|
SGVec3d _linearVel, _angularVel;
|
|
|
|
if (!ground_cache.get_body(t, _bodyToWorld, _linearVel, _angularVel, id))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
assign(linearVel, _linearVel);
|
|
|
|
assign(angularVel, _angularVel);
|
|
|
|
for (unsigned i = 0; i < 16; ++i)
|
|
|
|
bodyToWorld[i] = _bodyToWorld.data()[i];
|
|
|
|
|
|
|
|
return true;
|
2004-11-22 10:10:33 +00:00
|
|
|
}
|
|
|
|
|
2006-12-27 10:47:10 +00:00
|
|
|
bool
|
2009-03-06 16:37:12 +00:00
|
|
|
FGInterface::get_agl_m(double t, const double pt[3], double max_altoff,
|
|
|
|
double contact[3], double normal[3],
|
|
|
|
double linearVel[3], double angularVel[3],
|
|
|
|
SGMaterial const*& material, simgear::BVHNode::Id& id)
|
2006-12-27 10:47:10 +00:00
|
|
|
{
|
2009-03-06 16:37:12 +00:00
|
|
|
SGVec3d pt_m = SGVec3d(pt) - max_altoff*ground_cache.get_down();
|
|
|
|
SGVec3d _contact, _normal, _linearVel, _angularVel;
|
|
|
|
material = 0;
|
2009-03-12 06:18:53 +00:00
|
|
|
bool ret = ground_cache.get_agl(t, pt_m, _contact, _normal, _linearVel,
|
|
|
|
_angularVel, id, material);
|
2009-03-06 16:37:12 +00:00
|
|
|
// correct the linear velocity, since the line intersector delivers
|
|
|
|
// values for the start point and the get_agl function should
|
|
|
|
// traditionally deliver for the contact point
|
|
|
|
_linearVel += cross(_angularVel, _contact - pt_m);
|
|
|
|
|
2007-07-29 10:21:22 +00:00
|
|
|
assign(contact, _contact);
|
|
|
|
assign(normal, _normal);
|
2009-03-06 16:37:12 +00:00
|
|
|
assign(linearVel, _linearVel);
|
|
|
|
assign(angularVel, _angularVel);
|
2009-03-12 06:18:53 +00:00
|
|
|
return ret;
|
2006-12-27 10:47:10 +00:00
|
|
|
}
|
|
|
|
|
2004-11-22 10:10:33 +00:00
|
|
|
bool
|
2009-03-06 16:37:12 +00:00
|
|
|
FGInterface::get_agl_ft(double t, const double pt[3], double max_altoff,
|
|
|
|
double contact[3], double normal[3],
|
|
|
|
double linearVel[3], double angularVel[3],
|
|
|
|
SGMaterial const*& material, simgear::BVHNode::Id& id)
|
2004-11-22 10:10:33 +00:00
|
|
|
{
|
|
|
|
// Convert units and do the real work.
|
2009-03-06 16:37:12 +00:00
|
|
|
SGVec3d pt_m = SGVec3d(pt) - max_altoff*ground_cache.get_down();
|
|
|
|
pt_m *= SG_FEET_TO_METER;
|
|
|
|
SGVec3d _contact, _normal, _linearVel, _angularVel;
|
|
|
|
material = 0;
|
2009-03-12 06:18:53 +00:00
|
|
|
bool ret = ground_cache.get_agl(t, pt_m, _contact, _normal, _linearVel,
|
|
|
|
_angularVel, id, material);
|
2009-03-06 16:37:12 +00:00
|
|
|
// correct the linear velocity, since the line intersector delivers
|
|
|
|
// values for the start point and the get_agl function should
|
|
|
|
// traditionally deliver for the contact point
|
|
|
|
_linearVel += cross(_angularVel, _contact - pt_m);
|
2006-06-11 13:34:18 +00:00
|
|
|
|
2004-11-22 10:10:33 +00:00
|
|
|
// Convert units back ...
|
2007-07-29 10:21:22 +00:00
|
|
|
assign( contact, SG_METER_TO_FEET*_contact );
|
|
|
|
assign( normal, _normal );
|
2009-03-06 16:37:12 +00:00
|
|
|
assign( linearVel, SG_METER_TO_FEET*_linearVel );
|
|
|
|
assign( angularVel, _angularVel );
|
2009-03-12 06:18:53 +00:00
|
|
|
return ret;
|
2004-11-22 10:10:33 +00:00
|
|
|
}
|
|
|
|
|
Mathias Fröhlich:
I have introduced the posibility to start directly on the carrier.
With that patch you will have a --carrrier=id argument where id can either be
the pennant number configured in the nimitz scenario or the carriers name
also configured in the carriers scenario.
Additionaly you can use --parkpos=id to select different positions on the
carrier. They are also configured in the scenario file.
That includes the switch of the whole FGInterface class to make use of the
groundcache.
That means that an aircraft no longer uses the current elevation value from
the scenery class. It rather has its own local cache of the aircrafts
environment which is setup in the common_init method of FGInterface and
updated either manually by calling
FGInterface::get_groundlevel_m(lat, lon, alt_m);
or implicitly by calling the above method in the
FGInterface::_updateGeo*Position(lat, lon, alt);
methods.
A call get_groundlevel_m rebuilds the groundcache if the request is outside
the range of the cache.
Note that for the real usage of the groundcache including the correct
information about the movement of objects and the velocity information, you
still need to set up the groundcache in the usual way like YASim and JSBSim
currently does.
If you use the native interface, you will get only static objects correctly.
But for FDM's only using one single ground level for a whole step this is IMO
sufficient.
The AIManager gets a way to return the location of a object which is placed
wrt an AI Object. At the moment it only honours AICarriers for that.
That method is a static one, which loads the scenario file for that reason and
throws it away afterwards. This looked like the aprioriate way, because the
AIManager is initialized much later in flightgears bootstrap, and I did not
find an easy way to reorder that for my needs. Since this additional load is
very small and does only happen if such a relative location is required, I
think that this is ok.
Note that moving on the carrier will only work correctly for JSBSim and YASim,
but you should now be able to start and move on every not itself moving
object with any FDM.
2005-07-03 09:39:14 +00:00
|
|
|
bool
|
2009-03-06 16:37:12 +00:00
|
|
|
FGInterface::get_nearest_m(double t, const double pt[3], double maxDist,
|
|
|
|
double contact[3], double normal[3],
|
|
|
|
double linearVel[3], double angularVel[3],
|
|
|
|
SGMaterial const*& material,
|
|
|
|
simgear::BVHNode::Id& id)
|
Mathias Fröhlich:
I have introduced the posibility to start directly on the carrier.
With that patch you will have a --carrrier=id argument where id can either be
the pennant number configured in the nimitz scenario or the carriers name
also configured in the carriers scenario.
Additionaly you can use --parkpos=id to select different positions on the
carrier. They are also configured in the scenario file.
That includes the switch of the whole FGInterface class to make use of the
groundcache.
That means that an aircraft no longer uses the current elevation value from
the scenery class. It rather has its own local cache of the aircrafts
environment which is setup in the common_init method of FGInterface and
updated either manually by calling
FGInterface::get_groundlevel_m(lat, lon, alt_m);
or implicitly by calling the above method in the
FGInterface::_updateGeo*Position(lat, lon, alt);
methods.
A call get_groundlevel_m rebuilds the groundcache if the request is outside
the range of the cache.
Note that for the real usage of the groundcache including the correct
information about the movement of objects and the velocity information, you
still need to set up the groundcache in the usual way like YASim and JSBSim
currently does.
If you use the native interface, you will get only static objects correctly.
But for FDM's only using one single ground level for a whole step this is IMO
sufficient.
The AIManager gets a way to return the location of a object which is placed
wrt an AI Object. At the moment it only honours AICarriers for that.
That method is a static one, which loads the scenario file for that reason and
throws it away afterwards. This looked like the aprioriate way, because the
AIManager is initialized much later in flightgears bootstrap, and I did not
find an easy way to reorder that for my needs. Since this additional load is
very small and does only happen if such a relative location is required, I
think that this is ok.
Note that moving on the carrier will only work correctly for JSBSim and YASim,
but you should now be able to start and move on every not itself moving
object with any FDM.
2005-07-03 09:39:14 +00:00
|
|
|
{
|
2009-03-06 16:37:12 +00:00
|
|
|
SGVec3d _contact, _linearVel, _angularVel;
|
|
|
|
if (!ground_cache.get_nearest(t, SGVec3d(pt), maxDist, _contact, _linearVel,
|
|
|
|
_angularVel, id, material))
|
|
|
|
return false;
|
|
|
|
|
2007-07-29 10:21:22 +00:00
|
|
|
assign(contact, _contact);
|
2009-03-06 16:37:12 +00:00
|
|
|
assign(linearVel, _linearVel);
|
|
|
|
assign(angularVel, _angularVel);
|
|
|
|
return true;
|
Mathias Fröhlich:
I have introduced the posibility to start directly on the carrier.
With that patch you will have a --carrrier=id argument where id can either be
the pennant number configured in the nimitz scenario or the carriers name
also configured in the carriers scenario.
Additionaly you can use --parkpos=id to select different positions on the
carrier. They are also configured in the scenario file.
That includes the switch of the whole FGInterface class to make use of the
groundcache.
That means that an aircraft no longer uses the current elevation value from
the scenery class. It rather has its own local cache of the aircrafts
environment which is setup in the common_init method of FGInterface and
updated either manually by calling
FGInterface::get_groundlevel_m(lat, lon, alt_m);
or implicitly by calling the above method in the
FGInterface::_updateGeo*Position(lat, lon, alt);
methods.
A call get_groundlevel_m rebuilds the groundcache if the request is outside
the range of the cache.
Note that for the real usage of the groundcache including the correct
information about the movement of objects and the velocity information, you
still need to set up the groundcache in the usual way like YASim and JSBSim
currently does.
If you use the native interface, you will get only static objects correctly.
But for FDM's only using one single ground level for a whole step this is IMO
sufficient.
The AIManager gets a way to return the location of a object which is placed
wrt an AI Object. At the moment it only honours AICarriers for that.
That method is a static one, which loads the scenario file for that reason and
throws it away afterwards. This looked like the aprioriate way, because the
AIManager is initialized much later in flightgears bootstrap, and I did not
find an easy way to reorder that for my needs. Since this additional load is
very small and does only happen if such a relative location is required, I
think that this is ok.
Note that moving on the carrier will only work correctly for JSBSim and YASim,
but you should now be able to start and move on every not itself moving
object with any FDM.
2005-07-03 09:39:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2009-03-06 16:37:12 +00:00
|
|
|
FGInterface::get_nearest_ft(double t, const double pt[3], double maxDist,
|
|
|
|
double contact[3], double normal[3],
|
|
|
|
double linearVel[3], double angularVel[3],
|
|
|
|
SGMaterial const*& material,
|
|
|
|
simgear::BVHNode::Id& id)
|
Mathias Fröhlich:
I have introduced the posibility to start directly on the carrier.
With that patch you will have a --carrrier=id argument where id can either be
the pennant number configured in the nimitz scenario or the carriers name
also configured in the carriers scenario.
Additionaly you can use --parkpos=id to select different positions on the
carrier. They are also configured in the scenario file.
That includes the switch of the whole FGInterface class to make use of the
groundcache.
That means that an aircraft no longer uses the current elevation value from
the scenery class. It rather has its own local cache of the aircrafts
environment which is setup in the common_init method of FGInterface and
updated either manually by calling
FGInterface::get_groundlevel_m(lat, lon, alt_m);
or implicitly by calling the above method in the
FGInterface::_updateGeo*Position(lat, lon, alt);
methods.
A call get_groundlevel_m rebuilds the groundcache if the request is outside
the range of the cache.
Note that for the real usage of the groundcache including the correct
information about the movement of objects and the velocity information, you
still need to set up the groundcache in the usual way like YASim and JSBSim
currently does.
If you use the native interface, you will get only static objects correctly.
But for FDM's only using one single ground level for a whole step this is IMO
sufficient.
The AIManager gets a way to return the location of a object which is placed
wrt an AI Object. At the moment it only honours AICarriers for that.
That method is a static one, which loads the scenario file for that reason and
throws it away afterwards. This looked like the aprioriate way, because the
AIManager is initialized much later in flightgears bootstrap, and I did not
find an easy way to reorder that for my needs. Since this additional load is
very small and does only happen if such a relative location is required, I
think that this is ok.
Note that moving on the carrier will only work correctly for JSBSim and YASim,
but you should now be able to start and move on every not itself moving
object with any FDM.
2005-07-03 09:39:14 +00:00
|
|
|
{
|
2009-03-06 16:37:12 +00:00
|
|
|
SGVec3d _contact, _linearVel, _angularVel;
|
|
|
|
if (!ground_cache.get_nearest(t, SG_FEET_TO_METER*SGVec3d(pt),
|
|
|
|
SG_FEET_TO_METER*maxDist, _contact, _linearVel,
|
|
|
|
_angularVel, id, material))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
assign(contact, SG_METER_TO_FEET*_contact);
|
|
|
|
assign(linearVel, SG_METER_TO_FEET*_linearVel);
|
|
|
|
assign(angularVel, _angularVel);
|
|
|
|
return true;
|
Mathias Fröhlich:
I have introduced the posibility to start directly on the carrier.
With that patch you will have a --carrrier=id argument where id can either be
the pennant number configured in the nimitz scenario or the carriers name
also configured in the carriers scenario.
Additionaly you can use --parkpos=id to select different positions on the
carrier. They are also configured in the scenario file.
That includes the switch of the whole FGInterface class to make use of the
groundcache.
That means that an aircraft no longer uses the current elevation value from
the scenery class. It rather has its own local cache of the aircrafts
environment which is setup in the common_init method of FGInterface and
updated either manually by calling
FGInterface::get_groundlevel_m(lat, lon, alt_m);
or implicitly by calling the above method in the
FGInterface::_updateGeo*Position(lat, lon, alt);
methods.
A call get_groundlevel_m rebuilds the groundcache if the request is outside
the range of the cache.
Note that for the real usage of the groundcache including the correct
information about the movement of objects and the velocity information, you
still need to set up the groundcache in the usual way like YASim and JSBSim
currently does.
If you use the native interface, you will get only static objects correctly.
But for FDM's only using one single ground level for a whole step this is IMO
sufficient.
The AIManager gets a way to return the location of a object which is placed
wrt an AI Object. At the moment it only honours AICarriers for that.
That method is a static one, which loads the scenario file for that reason and
throws it away afterwards. This looked like the aprioriate way, because the
AIManager is initialized much later in flightgears bootstrap, and I did not
find an easy way to reorder that for my needs. Since this additional load is
very small and does only happen if such a relative location is required, I
think that this is ok.
Note that moving on the carrier will only work correctly for JSBSim and YASim,
but you should now be able to start and move on every not itself moving
object with any FDM.
2005-07-03 09:39:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
double
|
|
|
|
FGInterface::get_groundlevel_m(double lat, double lon, double alt)
|
2007-07-29 10:21:22 +00:00
|
|
|
{
|
|
|
|
return get_groundlevel_m(SGGeod::fromRadM(lon, lat, alt));
|
|
|
|
}
|
|
|
|
|
|
|
|
double
|
|
|
|
FGInterface::get_groundlevel_m(const SGGeod& geod)
|
Mathias Fröhlich:
I have introduced the posibility to start directly on the carrier.
With that patch you will have a --carrrier=id argument where id can either be
the pennant number configured in the nimitz scenario or the carriers name
also configured in the carriers scenario.
Additionaly you can use --parkpos=id to select different positions on the
carrier. They are also configured in the scenario file.
That includes the switch of the whole FGInterface class to make use of the
groundcache.
That means that an aircraft no longer uses the current elevation value from
the scenery class. It rather has its own local cache of the aircrafts
environment which is setup in the common_init method of FGInterface and
updated either manually by calling
FGInterface::get_groundlevel_m(lat, lon, alt_m);
or implicitly by calling the above method in the
FGInterface::_updateGeo*Position(lat, lon, alt);
methods.
A call get_groundlevel_m rebuilds the groundcache if the request is outside
the range of the cache.
Note that for the real usage of the groundcache including the correct
information about the movement of objects and the velocity information, you
still need to set up the groundcache in the usual way like YASim and JSBSim
currently does.
If you use the native interface, you will get only static objects correctly.
But for FDM's only using one single ground level for a whole step this is IMO
sufficient.
The AIManager gets a way to return the location of a object which is placed
wrt an AI Object. At the moment it only honours AICarriers for that.
That method is a static one, which loads the scenario file for that reason and
throws it away afterwards. This looked like the aprioriate way, because the
AIManager is initialized much later in flightgears bootstrap, and I did not
find an easy way to reorder that for my needs. Since this additional load is
very small and does only happen if such a relative location is required, I
think that this is ok.
Note that moving on the carrier will only work correctly for JSBSim and YASim,
but you should now be able to start and move on every not itself moving
object with any FDM.
2005-07-03 09:39:14 +00:00
|
|
|
{
|
2005-12-04 10:43:49 +00:00
|
|
|
// Compute the cartesian position of the given lat/lon/alt.
|
2007-07-29 10:21:22 +00:00
|
|
|
SGVec3d pos = SGVec3d::fromGeod(geod);
|
Mathias Fröhlich:
I have introduced the posibility to start directly on the carrier.
With that patch you will have a --carrrier=id argument where id can either be
the pennant number configured in the nimitz scenario or the carriers name
also configured in the carriers scenario.
Additionaly you can use --parkpos=id to select different positions on the
carrier. They are also configured in the scenario file.
That includes the switch of the whole FGInterface class to make use of the
groundcache.
That means that an aircraft no longer uses the current elevation value from
the scenery class. It rather has its own local cache of the aircrafts
environment which is setup in the common_init method of FGInterface and
updated either manually by calling
FGInterface::get_groundlevel_m(lat, lon, alt_m);
or implicitly by calling the above method in the
FGInterface::_updateGeo*Position(lat, lon, alt);
methods.
A call get_groundlevel_m rebuilds the groundcache if the request is outside
the range of the cache.
Note that for the real usage of the groundcache including the correct
information about the movement of objects and the velocity information, you
still need to set up the groundcache in the usual way like YASim and JSBSim
currently does.
If you use the native interface, you will get only static objects correctly.
But for FDM's only using one single ground level for a whole step this is IMO
sufficient.
The AIManager gets a way to return the location of a object which is placed
wrt an AI Object. At the moment it only honours AICarriers for that.
That method is a static one, which loads the scenario file for that reason and
throws it away afterwards. This looked like the aprioriate way, because the
AIManager is initialized much later in flightgears bootstrap, and I did not
find an easy way to reorder that for my needs. Since this additional load is
very small and does only happen if such a relative location is required, I
think that this is ok.
Note that moving on the carrier will only work correctly for JSBSim and YASim,
but you should now be able to start and move on every not itself moving
object with any FDM.
2005-07-03 09:39:14 +00:00
|
|
|
|
|
|
|
// FIXME: how to handle t - ref_time differences ???
|
2006-10-29 19:30:21 +00:00
|
|
|
SGVec3d cpos;
|
2009-03-15 18:18:21 +00:00
|
|
|
double ref_time = 0, radius;
|
Mathias Fröhlich:
I have introduced the posibility to start directly on the carrier.
With that patch you will have a --carrrier=id argument where id can either be
the pennant number configured in the nimitz scenario or the carriers name
also configured in the carriers scenario.
Additionaly you can use --parkpos=id to select different positions on the
carrier. They are also configured in the scenario file.
That includes the switch of the whole FGInterface class to make use of the
groundcache.
That means that an aircraft no longer uses the current elevation value from
the scenery class. It rather has its own local cache of the aircrafts
environment which is setup in the common_init method of FGInterface and
updated either manually by calling
FGInterface::get_groundlevel_m(lat, lon, alt_m);
or implicitly by calling the above method in the
FGInterface::_updateGeo*Position(lat, lon, alt);
methods.
A call get_groundlevel_m rebuilds the groundcache if the request is outside
the range of the cache.
Note that for the real usage of the groundcache including the correct
information about the movement of objects and the velocity information, you
still need to set up the groundcache in the usual way like YASim and JSBSim
currently does.
If you use the native interface, you will get only static objects correctly.
But for FDM's only using one single ground level for a whole step this is IMO
sufficient.
The AIManager gets a way to return the location of a object which is placed
wrt an AI Object. At the moment it only honours AICarriers for that.
That method is a static one, which loads the scenario file for that reason and
throws it away afterwards. This looked like the aprioriate way, because the
AIManager is initialized much later in flightgears bootstrap, and I did not
find an easy way to reorder that for my needs. Since this additional load is
very small and does only happen if such a relative location is required, I
think that this is ok.
Note that moving on the carrier will only work correctly for JSBSim and YASim,
but you should now be able to start and move on every not itself moving
object with any FDM.
2005-07-03 09:39:14 +00:00
|
|
|
// Prepare the ground cache for that position.
|
2006-10-29 19:30:21 +00:00
|
|
|
if (!is_valid_m(&ref_time, cpos.data(), &radius)) {
|
2009-03-15 18:18:21 +00:00
|
|
|
double startTime = ref_time;
|
2009-03-15 11:26:31 +00:00
|
|
|
double endTime = startTime + 1;
|
|
|
|
bool ok = prepare_ground_cache_m(startTime, endTime, pos.data(), 10);
|
2005-12-04 10:43:49 +00:00
|
|
|
/// This is most likely the case when the given altitude is
|
|
|
|
/// too low, try with a new altitude of 10000m, that should be
|
|
|
|
/// sufficient to find a ground level below everywhere on our planet
|
|
|
|
if (!ok) {
|
2009-03-15 11:26:31 +00:00
|
|
|
pos = SGVec3d::fromGeod(SGGeod::fromGeodM(geod, 10000));
|
2005-12-04 10:43:49 +00:00
|
|
|
/// If there is still no ground, return sea level radius
|
2009-03-15 11:26:31 +00:00
|
|
|
if (!prepare_ground_cache_m(startTime, endTime, pos.data(), 10))
|
2005-12-04 10:43:49 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2006-10-29 19:30:21 +00:00
|
|
|
} else if (radius*radius <= distSqr(pos, cpos)) {
|
2009-03-15 18:18:21 +00:00
|
|
|
double startTime = ref_time;
|
2009-03-15 11:26:31 +00:00
|
|
|
double endTime = startTime + 1;
|
|
|
|
|
2005-12-04 10:43:49 +00:00
|
|
|
/// We reuse the old radius value, but only if it is at least 10 Meters ..
|
|
|
|
if (!(10 < radius)) // Well this strange compare is nan safe
|
|
|
|
radius = 10;
|
|
|
|
|
2009-03-15 11:26:31 +00:00
|
|
|
bool ok = prepare_ground_cache_m(startTime, endTime, pos.data(), radius);
|
2005-12-04 10:43:49 +00:00
|
|
|
/// This is most likely the case when the given altitude is
|
|
|
|
/// too low, try with a new altitude of 10000m, that should be
|
|
|
|
/// sufficient to find a ground level below everywhere on our planet
|
|
|
|
if (!ok) {
|
2009-03-15 11:26:31 +00:00
|
|
|
pos = SGVec3d::fromGeod(SGGeod::fromGeodM(geod, 10000));
|
2005-12-04 10:43:49 +00:00
|
|
|
/// If there is still no ground, return sea level radius
|
2009-03-15 11:26:31 +00:00
|
|
|
if (!prepare_ground_cache_m(startTime, endTime, pos.data(), radius))
|
2005-12-04 10:43:49 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
Mathias Fröhlich:
I have introduced the posibility to start directly on the carrier.
With that patch you will have a --carrrier=id argument where id can either be
the pennant number configured in the nimitz scenario or the carriers name
also configured in the carriers scenario.
Additionaly you can use --parkpos=id to select different positions on the
carrier. They are also configured in the scenario file.
That includes the switch of the whole FGInterface class to make use of the
groundcache.
That means that an aircraft no longer uses the current elevation value from
the scenery class. It rather has its own local cache of the aircrafts
environment which is setup in the common_init method of FGInterface and
updated either manually by calling
FGInterface::get_groundlevel_m(lat, lon, alt_m);
or implicitly by calling the above method in the
FGInterface::_updateGeo*Position(lat, lon, alt);
methods.
A call get_groundlevel_m rebuilds the groundcache if the request is outside
the range of the cache.
Note that for the real usage of the groundcache including the correct
information about the movement of objects and the velocity information, you
still need to set up the groundcache in the usual way like YASim and JSBSim
currently does.
If you use the native interface, you will get only static objects correctly.
But for FDM's only using one single ground level for a whole step this is IMO
sufficient.
The AIManager gets a way to return the location of a object which is placed
wrt an AI Object. At the moment it only honours AICarriers for that.
That method is a static one, which loads the scenario file for that reason and
throws it away afterwards. This looked like the aprioriate way, because the
AIManager is initialized much later in flightgears bootstrap, and I did not
find an easy way to reorder that for my needs. Since this additional load is
very small and does only happen if such a relative location is required, I
think that this is ok.
Note that moving on the carrier will only work correctly for JSBSim and YASim,
but you should now be able to start and move on every not itself moving
object with any FDM.
2005-07-03 09:39:14 +00:00
|
|
|
|
2009-03-06 16:37:12 +00:00
|
|
|
double contact[3], normal[3], vel[3], angvel[3];
|
|
|
|
const SGMaterial* material;
|
|
|
|
simgear::BVHNode::Id id;
|
2005-12-04 10:43:49 +00:00
|
|
|
// Ignore the return value here, since it just tells us if
|
|
|
|
// the returns stem from the groundcache or from the coarse
|
|
|
|
// computations below the groundcache. The contact point is still something
|
|
|
|
// valid, the normals and the other returns just contain some defaults.
|
2009-03-06 16:37:12 +00:00
|
|
|
get_agl_m(ref_time, pos.data(), 2.0, contact, normal, vel, angvel,
|
|
|
|
material, id);
|
2007-07-29 10:21:22 +00:00
|
|
|
return SGGeod::fromCart(SGVec3d(contact)).getElevationM();
|
Mathias Fröhlich:
I have introduced the posibility to start directly on the carrier.
With that patch you will have a --carrrier=id argument where id can either be
the pennant number configured in the nimitz scenario or the carriers name
also configured in the carriers scenario.
Additionaly you can use --parkpos=id to select different positions on the
carrier. They are also configured in the scenario file.
That includes the switch of the whole FGInterface class to make use of the
groundcache.
That means that an aircraft no longer uses the current elevation value from
the scenery class. It rather has its own local cache of the aircrafts
environment which is setup in the common_init method of FGInterface and
updated either manually by calling
FGInterface::get_groundlevel_m(lat, lon, alt_m);
or implicitly by calling the above method in the
FGInterface::_updateGeo*Position(lat, lon, alt);
methods.
A call get_groundlevel_m rebuilds the groundcache if the request is outside
the range of the cache.
Note that for the real usage of the groundcache including the correct
information about the movement of objects and the velocity information, you
still need to set up the groundcache in the usual way like YASim and JSBSim
currently does.
If you use the native interface, you will get only static objects correctly.
But for FDM's only using one single ground level for a whole step this is IMO
sufficient.
The AIManager gets a way to return the location of a object which is placed
wrt an AI Object. At the moment it only honours AICarriers for that.
That method is a static one, which loads the scenario file for that reason and
throws it away afterwards. This looked like the aprioriate way, because the
AIManager is initialized much later in flightgears bootstrap, and I did not
find an easy way to reorder that for my needs. Since this additional load is
very small and does only happen if such a relative location is required, I
think that this is ok.
Note that moving on the carrier will only work correctly for JSBSim and YASim,
but you should now be able to start and move on every not itself moving
object with any FDM.
2005-07-03 09:39:14 +00:00
|
|
|
}
|
|
|
|
|
2004-11-22 10:10:33 +00:00
|
|
|
bool
|
|
|
|
FGInterface::caught_wire_m(double t, const double pt[4][3])
|
|
|
|
{
|
2006-10-29 19:30:21 +00:00
|
|
|
SGVec3d pt_m[4];
|
|
|
|
for (int i=0; i<4; ++i)
|
2007-07-29 10:21:22 +00:00
|
|
|
pt_m[i] = SGVec3d(pt[i]);
|
2006-10-29 19:30:21 +00:00
|
|
|
|
|
|
|
return ground_cache.caught_wire(t, pt_m);
|
2004-11-22 10:10:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
FGInterface::caught_wire_ft(double t, const double pt[4][3])
|
|
|
|
{
|
|
|
|
// Convert units and do the real work.
|
2006-10-29 19:30:21 +00:00
|
|
|
SGVec3d pt_m[4];
|
2004-11-22 10:10:33 +00:00
|
|
|
for (int i=0; i<4; ++i)
|
2007-07-29 10:21:22 +00:00
|
|
|
pt_m[i] = SG_FEET_TO_METER*SGVec3d(pt[i]);
|
2004-11-22 10:10:33 +00:00
|
|
|
|
|
|
|
return ground_cache.caught_wire(t, pt_m);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
FGInterface::get_wire_ends_m(double t, double end[2][3], double vel[2][3])
|
|
|
|
{
|
2006-10-29 19:30:21 +00:00
|
|
|
SGVec3d _end[2], _vel[2];
|
|
|
|
bool ret = ground_cache.get_wire_ends(t, _end, _vel);
|
|
|
|
for (int k=0; k<2; ++k) {
|
2007-07-29 10:21:22 +00:00
|
|
|
assign( end[k], _end[k] );
|
|
|
|
assign( vel[k], _vel[k] );
|
2006-10-29 19:30:21 +00:00
|
|
|
}
|
|
|
|
return ret;
|
2004-11-22 10:10:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
FGInterface::get_wire_ends_ft(double t, double end[2][3], double vel[2][3])
|
|
|
|
{
|
|
|
|
// Convert units and do the real work.
|
2006-10-29 19:30:21 +00:00
|
|
|
SGVec3d _end[2], _vel[2];
|
|
|
|
bool ret = ground_cache.get_wire_ends(t, _end, _vel);
|
2004-11-22 10:10:33 +00:00
|
|
|
for (int k=0; k<2; ++k) {
|
2007-07-29 10:21:22 +00:00
|
|
|
assign( end[k], SG_METER_TO_FEET*_end[k] );
|
|
|
|
assign( vel[k], SG_METER_TO_FEET*_vel[k] );
|
2004-11-22 10:10:33 +00:00
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
FGInterface::release_wire(void)
|
|
|
|
{
|
|
|
|
ground_cache.release_wire();
|
|
|
|
}
|
2001-04-05 15:39:37 +00:00
|
|
|
|