1
0
Fork 0

Rename FGInterface::_updatePosition() ->

FGInterface::_updateGeocentricPosition() for clarity.  Also added an
  FGInterface::_updateGeodeticPosition() since it is useful.
A few clean ups to native_fdm.cxx and raw_fdm.hxx.
This commit is contained in:
curt 2001-12-12 05:18:46 +00:00
parent 4f5d70144a
commit 37c2b6002c
6 changed files with 72 additions and 16 deletions

View file

@ -192,7 +192,7 @@ bool FGBalloonSim::copy_from_BalloonSim() {
//temp[1]: longitude
//temp[2]: altitude (meters)
_updatePosition( temp[0], temp[1], temp[2] * SG_METER_TO_FEET );
_updateGeocentricPosition( temp[0], temp[1], temp[2] * SG_METER_TO_FEET );
current_balloon.getHPR( temp );
set_Euler_Angles( temp[0], temp[1], temp[2] );

View file

@ -425,9 +425,9 @@ bool FGJSBsim::copy_from_JSBsim() {
_set_Mach_number( Translation->GetMach() );
// Positions
_updatePosition( Position->GetLatitude(),
Position->GetLongitude(),
Position->Geth() );
_updateGeocentricPosition( Position->GetLatitude(),
Position->GetLongitude(),
Position->Geth() );
_set_Altitude_AGL( Position->GetDistanceAGL() );

View file

@ -507,7 +507,60 @@ bool FGInterface::update( int multi_loop ) {
}
void FGInterface::_updatePosition( double lat_geoc, double lon, double alt ) {
void FGInterface::_updateGeodeticPosition( double lat, double lon, double alt )
{
double lat_geoc, sl_radius;
// cout << "starting sea level rad = " << get_Sea_level_radius() << endl;
sgGeodToGeoc( lat, alt * SG_FEET_TO_METER, &sl_radius, &lat_geoc );
SG_LOG( SG_FLIGHT, SG_DEBUG, "lon = " << lon
<< " lat_geod = " << lat
<< " lat_geoc = " << lat_geoc
<< " alt = " << alt
<< " sl_radius = " << sl_radius * SG_METER_TO_FEET
<< " Equator = " << SG_EQUATORIAL_RADIUS_FT );
_set_Geocentric_Position( lat_geoc, lon,
sl_radius * SG_METER_TO_FEET + alt );
_set_Geodetic_Position( lat, lon, alt );
_set_Sea_level_radius( sl_radius * SG_METER_TO_FEET );
_set_Runway_altitude( scenery.get_cur_elev() * SG_METER_TO_FEET );
_set_sin_lat_geocentric( lat_geoc );
_set_cos_lat_geocentric( lat_geoc );
_set_sin_cos_longitude( lon );
_set_sin_cos_latitude( lat );
/* Norman's code for slope of the terrain */
/* needs to be tested -- get it on the HUD and taxi around */
/* double *tnorm = scenery.cur_normal;
double sy = sin ( -get_Psi() ) ;
double cy = cos ( -get_Psi() ) ;
double phitb, thetatb, psitb;
if ( tnorm[1] != 0.0 ) {
psitb = -atan2 ( tnorm[0], tnorm[1] );
}
if ( tnorm[2] != 0.0 ) {
thetatb = atan2 ( tnorm[0] * cy - tnorm[1] * sy, tnorm[2] );
phitb = -atan2 ( tnorm[1] * cy + tnorm[0] * sy, tnorm[2] );
}
_set_terrain_slope(phitb, thetatb, psitb)
*/
}
void FGInterface::_updateGeocentricPosition( double lat_geoc, double lon,
double alt )
{
double lat_geod, tmp_alt, sl_radius1, sl_radius2, tmp_lat_geoc;
// cout << "starting sea level rad = " << get_Sea_level_radius() << endl;

View file

@ -355,7 +355,8 @@ public:
void _setup();
void _busdump(void);
void _updatePosition( double lat_geoc, double lon, double alt );
void _updateGeodeticPosition( double lat, double lon, double alt );
void _updateGeocentricPosition( double lat_geoc, double lon, double alt );
void _updateWeather( void );
inline void _set_Inertias( double m, double xx, double yy,

View file

@ -64,7 +64,7 @@ static void global2raw( const FGInterface *global, FGRawFDM *raw ) {
// positions
raw->longitude = cur_fdm_state->get_Longitude();
raw->latitude = cur_fdm_state->get_Latitude();
raw->altitude = cur_fdm_state->get_Altitude();
raw->altitude = cur_fdm_state->get_Altitude() * SG_FEET_TO_METER;
raw->phi = cur_fdm_state->get_Phi();
raw->theta = cur_fdm_state->get_Theta();
raw->psi = cur_fdm_state->get_Psi();
@ -79,8 +79,10 @@ static void raw2global( const FGRawFDM *raw, FGInterface *global ) {
if ( raw->version == FG_RAW_FDM_VERSION ) {
// cout << "pos = " << raw->longitude << " " << raw->latitude << endl;
// cout << "sea level rad = " << cur_fdm_state->get_Sea_level_radius() << endl;
cur_fdm_state->_updatePosition( raw->latitude, raw->longitude,
raw->altitude * SG_METER_TO_FEET );
cur_fdm_state->_updateGeodeticPosition( raw->latitude,
raw->longitude,
raw->altitude
* SG_METER_TO_FEET );
cur_fdm_state->_set_Euler_Angles( raw->phi,
raw->theta,
raw->psi );

View file

@ -42,13 +42,13 @@ public:
int version; // increment when data values change
// Positions
double longitude; // radians
double latitude; // radians
double altitude; // meters (above sea level)
double agl; // meters (altitude above ground level)
double phi; // radians
double theta; // radians
double psi; // radians
double longitude; // geodetic (radians)
double latitude; // geodetic (radians)
double altitude; // above sea level (meters)
double agl; // above ground level (meters)
double phi; // roll (radians)
double theta; // pitch (radians)
double psi; // yaw or true heading (radians)
// Velocities
double vcas; // calibrated airspeed