1
0
Fork 0

Updates by Tony working on the FDM interface bus.

This commit is contained in:
curt 2000-10-28 16:30:30 +00:00
parent 81bb2f00d1
commit 11a68e55d4
15 changed files with 488 additions and 322 deletions

View file

@ -2280,6 +2280,51 @@ SOURCE=.\src\Main\viewer.cxx
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\src\Main\viewer_lookat.cxx
!IF "$(CFG)" == "FlightGear - Win32 Release"
# PROP Intermediate_Dir "Release\main"
!ELSEIF "$(CFG)" == "FlightGear - Win32 Debug"
# PROP Intermediate_Dir "Debug\main"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\src\Main\viewer_rph.cxx
!IF "$(CFG)" == "FlightGear - Win32 Release"
# PROP Intermediate_Dir "Release\main"
!ELSEIF "$(CFG)" == "FlightGear - Win32 Debug"
# PROP Intermediate_Dir "Debug\main"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\src\Main\viewmgr.cxx
!IF "$(CFG)" == "FlightGear - Win32 Release"
# PROP Intermediate_Dir "Release\main"
!ELSEIF "$(CFG)" == "FlightGear - Win32 Debug"
# PROP Intermediate_Dir "Debug\main"
!ENDIF
# End Source File
# End Group
# Begin Group "Lib_Navaids"

View file

@ -176,37 +176,14 @@ bool FGBalloonSim::copy_from_BalloonSim() {
// Positions
current_balloon.getPosition( temp );
double lat_geoc = temp[0];
double lon = temp[1];
double alt = temp[2] * METER_TO_FEET;
double lat_geod, tmp_alt, sl_radius1, sl_radius2, tmp_lat_geoc;
sgGeocToGeod( lat_geoc, EQUATORIAL_RADIUS_M + alt * FEET_TO_METER,
&lat_geod, &tmp_alt, &sl_radius1 );
sgGeodToGeoc( lat_geod, alt * FEET_TO_METER, &sl_radius2, &tmp_lat_geoc );
FG_LOG( FG_FLIGHT, FG_DEBUG, "lon = " << lon << " lat_geod = " << lat_geod
<< " lat_geoc = " << lat_geoc
<< " alt = " << alt << " tmp_alt = " << tmp_alt * METER_TO_FEET
<< " sl_radius1 = " << sl_radius1 * METER_TO_FEET
<< " sl_radius2 = " << sl_radius2 * METER_TO_FEET
<< " Equator = " << EQUATORIAL_RADIUS_FT );
_set_Geocentric_Position( lat_geoc, lon,
sl_radius2 * METER_TO_FEET + alt );
_set_Geodetic_Position( lat_geod, lon, alt );
//temp[0]: geocentric latitude
//temp[1]: longitude
//temp[2]: altitude (meters)
_updatePosition( temp[0], temp[1], temp[2] * METER_TO_FEET );
current_balloon.getHPR( temp );
/* **FIXME*** */ _set_Sea_level_radius( sl_radius2 * METER_TO_FEET );
/* **FIXME*** */ _set_Earth_position_angle( 0.0 );
/* ***FIXME*** */ _set_Runway_altitude( 0.0 );
_set_sin_lat_geocentric( lat_geoc );
_set_cos_lat_geocentric( lat_geoc );
_set_sin_cos_longitude( lon );
_set_sin_cos_latitude( lat_geod );
set_Euler_Angles( temp[0], temp[1], temp[2] );
return true;
}

View file

@ -343,7 +343,9 @@ bool FGJSBsim::copy_from_JSBsim() {
_set_Velocities_Wind_Body( fdmex->GetTranslation()->GetUVW()(1),
fdmex->GetTranslation()->GetUVW()(2),
fdmex->GetTranslation()->GetUVW()(3) );
_set_V_rel_wind( fdmex->GetTranslation()->GetVt() );
_set_V_equiv_kts( fdmex->GetAuxiliary()->GetVequivalentKTS() );
// _set_V_calibrated( fdmex->GetAuxiliary()->GetVcalibratedFPS() );
@ -367,27 +369,10 @@ bool FGJSBsim::copy_from_JSBsim() {
_set_Mach_number( fdmex->GetTranslation()->GetMach() );
// Positions
double lat_geoc = fdmex->GetPosition()->GetLatitude();
double lon = fdmex->GetPosition()->GetLongitude();
double alt = fdmex->GetPosition()->Geth();
double lat_geod, tmp_alt, sl_radius1, sl_radius2, tmp_lat_geoc;
sgGeocToGeod( lat_geoc, EQUATORIAL_RADIUS_M + alt * FEET_TO_METER,
&lat_geod, &tmp_alt, &sl_radius1 );
sgGeodToGeoc( lat_geod, alt * FEET_TO_METER, &sl_radius2, &tmp_lat_geoc );
FG_LOG( FG_FLIGHT, FG_DEBUG, "lon = " << lon << " lat_geod = " << lat_geod
<< " lat_geoc = " << lat_geoc
<< " alt = " << alt << " tmp_alt = " << tmp_alt * METER_TO_FEET
<< " sl_radius1 = " << sl_radius1 * METER_TO_FEET
<< " sl_radius2 = " << sl_radius2 * METER_TO_FEET
<< " Equator = " << EQUATORIAL_RADIUS_FT );
_set_Geocentric_Position( lat_geoc, lon, sl_radius2 * METER_TO_FEET + alt );
_set_Geodetic_Position( lat_geod, lon, alt );
_updatePosition( fdmex->GetPosition()->GetLatitude(),
fdmex->GetPosition()->GetLongitude(),
fdmex->GetPosition()->Geth() );
_set_Euler_Angles( fdmex->GetRotation()->Getphi(),
fdmex->GetRotation()->Gettht(),
fdmex->GetRotation()->Getpsi() );
@ -398,41 +383,51 @@ bool FGJSBsim::copy_from_JSBsim() {
_set_Gamma_vert_rad( fdmex->GetPosition()->GetGamma() );
// set_Gamma_horiz_rad( Gamma_horiz_rad );
/* **FIXME*** */ _set_Sea_level_radius( sl_radius2 * METER_TO_FEET );
/* **FIXME*** */ _set_Earth_position_angle( fdmex->GetAuxiliary()->
GetEarthPositionAngle() );
_set_Earth_position_angle( fdmex->GetAuxiliary()->GetEarthPositionAngle() );
/* ***FIXME*** */ _set_Runway_altitude( scenery.cur_radius * METERS_TO_FEET -
get_Sea_level_radius() );
_set_sin_lat_geocentric( lat_geoc );
_set_cos_lat_geocentric( lat_geoc );
_set_sin_cos_longitude( lon );
_set_sin_cos_latitude( lat_geod );
_set_Climb_Rate( fdmex->GetPosition()->Gethdot() );
for ( i = 0; i < 3; i++ ) {
for ( j = 0; j < 3; j++ ) {
for ( i = 1; i <= 3; i++ ) {
for ( j = 1; j <= 3; j++ ) {
_set_T_Local_to_Body( i, j, fdmex->GetState()->GetTl2b()(i,j) );
}
}
return true;
}
void FGJSBsim::snap_shot(void) {
fgic->SetLatitudeRadIC(get_Lat_geocentric() );
fgic->SetLongitudeRadIC( get_Longitude() );
fgic->SetAltitudeFtIC( get_Altitude() );
fgic->SetTerrainAltitudeFtIC( get_Runway_altitude() );
fgic->SetVtrueFpsIC( get_V_rel_wind() );
fgic->SetPitchAngleRadIC( get_Theta() );
fgic->SetRollAngleRadIC( get_Phi() );
fgic->SetTrueHeadingRadIC( get_Psi() );
fgic->SetClimbRateFpsIC( get_Climb_Rate() );
}
//Positions
void FGJSBsim::set_Latitude(double lat) {
FG_LOG(FG_FLIGHT,FG_INFO,"FGJSBsim::set_Latitude: " << lat);
fgic->SetLatitudeRadIC(lat);
double sea_level_radius_meters,lat_geoc;
FG_LOG(FG_FLIGHT,FG_INFO,"FGJSBsim::set_Latitude: " << lat );
snap_shot();
sgGeodToGeoc( lat, get_Altitude() , &sea_level_radius_meters, &lat_geoc);
fgic->SetSeaLevelRadiusFtIC( sea_level_radius_meters * METER_TO_FEET );
fgic->SetLatitudeRadIC( lat_geoc );
fdmex->RunIC(fgic); //loop JSBSim once
copy_from_JSBsim(); //update the bus
needTrim=true;
}
void FGJSBsim::set_Longitude(double lon) {
FG_LOG(FG_FLIGHT,FG_INFO,"FGJSBsim::set_Longitude: " << lon);
FG_LOG(FG_FLIGHT,FG_INFO,"FGJSBsim::set_Longitude: " << lon );
snap_shot();
fgic->SetLongitudeRadIC(lon);
fdmex->RunIC(fgic); //loop JSBSim once
copy_from_JSBsim(); //update the bus
@ -440,7 +435,14 @@ void FGJSBsim::set_Longitude(double lon) {
}
void FGJSBsim::set_Altitude(double alt) {
FG_LOG(FG_FLIGHT,FG_INFO, "FGJSBsim::set_Altitude: " << alt );
double sea_level_radius_meters,lat_geoc;
FG_LOG(FG_FLIGHT,FG_INFO, "FGJSBsim::set_Altitude: " << alt );
snap_shot();
sgGeodToGeoc( get_Latitude(), alt , &sea_level_radius_meters, &lat_geoc);
fgic->SetSeaLevelRadiusFtIC( sea_level_radius_meters * METER_TO_FEET );
fgic->SetLatitudeRadIC( lat_geoc );
fgic->SetAltitudeFtIC(alt);
fdmex->RunIC(fgic); //loop JSBSim once
copy_from_JSBsim(); //update the bus
@ -449,6 +451,8 @@ void FGJSBsim::set_Altitude(double alt) {
void FGJSBsim::set_V_calibrated_kts(double vc) {
FG_LOG(FG_FLIGHT,FG_INFO, "FGJSBsim::set_V_calibrated_kts: " << vc );
snap_shot();
fgic->SetVcalibratedKtsIC(vc);
fdmex->RunIC(fgic); //loop JSBSim once
copy_from_JSBsim(); //update the bus
@ -457,6 +461,8 @@ void FGJSBsim::set_V_calibrated_kts(double vc) {
void FGJSBsim::set_Mach_number(double mach) {
FG_LOG(FG_FLIGHT,FG_INFO, "FGJSBsim::set_Mach_number: " << mach );
snap_shot();
fgic->SetMachIC(mach);
fdmex->RunIC(fgic); //loop JSBSim once
copy_from_JSBsim(); //update the bus
@ -466,22 +472,21 @@ void FGJSBsim::set_Mach_number(double mach) {
void FGJSBsim::set_Velocities_Local( double north, double east, double down ){
FG_LOG(FG_FLIGHT,FG_INFO, "FGJSBsim::set_Velocities_Local: "
<< north << ", " << east << ", " << down );
snap_shot();
fgic->SetVnorthFpsIC(north);
fgic->SetVeastFpsIC(east);
fgic->SetVdownFpsIC(down);
fdmex->RunIC(fgic); //loop JSBSim once
cout << "fdmex->GetTranslation()->GetVt(): " << fdmex->GetTranslation()->GetVt() << endl;
cout << "fdmex->GetPosition()->GetVn(): " << fdmex->GetPosition()->GetVn() << endl;
copy_from_JSBsim(); //update the bus
busdump();
needTrim=true;
}
void FGJSBsim::set_Velocities_Wind_Body( double u, double v, double w){
FG_LOG(FG_FLIGHT,FG_INFO, "FGJSBsim::set_Velocities_Wind_Body: "
<< u << ", " << v << ", " << w );
snap_shot();
fgic->SetUBodyFpsIC(u);
fgic->SetVBodyFpsIC(v);
fgic->SetWBodyFpsIC(w);
@ -494,6 +499,8 @@ void FGJSBsim::set_Velocities_Wind_Body( double u, double v, double w){
void FGJSBsim::set_Euler_Angles( double phi, double theta, double psi ) {
FG_LOG(FG_FLIGHT,FG_INFO, "FGJSBsim::set_Euler_Angles: "
<< phi << ", " << theta << ", " << psi );
snap_shot();
fgic->SetPitchAngleRadIC(theta);
fgic->SetRollAngleRadIC(phi);
fgic->SetTrueHeadingRadIC(psi);
@ -505,6 +512,8 @@ void FGJSBsim::set_Euler_Angles( double phi, double theta, double psi ) {
//Flight Path
void FGJSBsim::set_Climb_Rate( double roc) {
FG_LOG(FG_FLIGHT,FG_INFO, "FGJSBsim::set_Climb_Rate: " << roc );
snap_shot();
fgic->SetClimbRateFpsIC(roc);
fdmex->RunIC(fgic); //loop JSBSim once
copy_from_JSBsim(); //update the bus
@ -513,6 +522,8 @@ void FGJSBsim::set_Climb_Rate( double roc) {
void FGJSBsim::set_Gamma_vert_rad( double gamma) {
FG_LOG(FG_FLIGHT,FG_INFO, "FGJSBsim::set_Gamma_vert_rad: " << gamma );
snap_shot();
fgic->SetFlightPathAngleRadIC(gamma);
fdmex->RunIC(fgic); //loop JSBSim once
copy_from_JSBsim(); //update the bus
@ -522,6 +533,8 @@ void FGJSBsim::set_Gamma_vert_rad( double gamma) {
//Earth
void FGJSBsim::set_Sea_level_radius(double slr) {
FG_LOG(FG_FLIGHT,FG_INFO, "FGJSBsim::set_Sea_level_radius: " << slr );
snap_shot();
fgic->SetSeaLevelRadiusFtIC(slr);
fdmex->RunIC(fgic); //loop JSBSim once
copy_from_JSBsim(); //update the bus
@ -530,6 +543,8 @@ void FGJSBsim::set_Sea_level_radius(double slr) {
void FGJSBsim::set_Runway_altitude(double ralt) {
FG_LOG(FG_FLIGHT,FG_INFO, "FGJSBsim::set_Runway_altitude: " << ralt );
snap_shot();
_set_Runway_altitude( ralt );
fdmex->RunIC(fgic); //loop JSBSim once
copy_from_JSBsim(); //update the bus
@ -538,6 +553,8 @@ void FGJSBsim::set_Runway_altitude(double ralt) {
void FGJSBsim::set_Static_pressure(double p) {
FG_LOG(FG_FLIGHT,FG_INFO, "FGJSBsim::set_Static_pressure: " << p );
snap_shot();
fdmex->GetAtmosphere()->SetExPressure(p);
if(fdmex->GetAtmosphere()->External() == true)
needTrim=true;
@ -545,6 +562,8 @@ void FGJSBsim::set_Static_pressure(double p) {
void FGJSBsim::set_Static_temperature(double T) {
FG_LOG(FG_FLIGHT,FG_INFO, "FGJSBsim::set_Static_temperature: " << T );
snap_shot();
fdmex->GetAtmosphere()->SetExTemperature(T);
if(fdmex->GetAtmosphere()->External() == true)
needTrim=true;
@ -553,6 +572,8 @@ void FGJSBsim::set_Static_temperature(double T) {
void FGJSBsim::set_Density(double rho) {
FG_LOG(FG_FLIGHT,FG_INFO, "FGJSBsim::set_Density: " << rho );
snap_shot();
fdmex->GetAtmosphere()->SetExDensity(rho);
if(fdmex->GetAtmosphere()->External() == true)
needTrim=true;
@ -564,6 +585,8 @@ void FGJSBsim::set_Velocities_Local_Airmass (double wnorth,
double wdown ) {
FG_LOG(FG_FLIGHT,FG_INFO, "FGJSBsim::set_Velocities_Local_Airmass: "
<< wnorth << ", " << weast << ", " << wdown );
snap_shot();
fdmex->GetAtmosphere()->SetWindNED(wnorth, weast, wdown );
if(fdmex->GetAtmosphere()->External() == true)
needTrim=true;

View file

@ -21,6 +21,9 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Further information about the GNU General Public License can also be found on
the world wide web at http://www.gnu.org.
HISTORY
--------------------------------------------------------------------------------
02/01/1999 CLO Created
@ -77,15 +80,6 @@ CLASS DECLARATION
class FGJSBsim: public FGInterface {
// The aircraft for this instance
FGFDMExec *fdmex;
FGInitialCondition *fgic;
bool needTrim;
bool trimmed;
float trim_elev;
float trim_throttle;
public:
/// Constructor
FGJSBsim::FGJSBsim(void);
@ -100,40 +94,120 @@ public:
/// Reset flight params to a specific position
bool init( double dt );
// Positions
void set_Latitude(double lat); // geocentric
void set_Longitude(double lon);
void set_Altitude(double alt); // triggers re-calc of AGL altitude
//void set_AltitudeAGL(double altagl); // and vice-versa
// Speeds -- setting any of these will trigger a re-calc of the rest
void set_V_calibrated_kts(double vc);
void set_Mach_number(double mach);
void set_Velocities_Local( double north, double east, double down );
void set_Velocities_Wind_Body( double u, double v, double w);
// Euler angles
void set_Euler_Angles( double phi, double theta, double psi );
// Flight Path
void set_Climb_Rate( double roc);
void set_Gamma_vert_rad( double gamma);
// Earth
void set_Sea_level_radius(double slr);
void set_Runway_altitude(double ralt);
// Atmosphere
void set_Static_pressure(double p);
void set_Static_temperature(double T);
void set_Density(double rho);
void set_Velocities_Local_Airmass (double wnorth,
double weast,
double wdown );
// update position based on inputs, positions, velocities, etc.
/// Position Parameters
//@{
/** Set geocentric latitude
@param lat latitude in radians measured from the 0 meridian where
the westerly direction is positive and east is negative */
void set_Latitude(double lat); // geocentric
/** Set longitude
@param lon longitude in radians measured from the equator where
the northerly direction is positive and south is negative */
void set_Longitude(double lon);
/** Set altitude
Note: this triggers a recalculation of AGL altitude
@param alt altitude in feet */
void set_Altitude(double alt); // triggers re-calc of AGL altitude
//@}
//void set_AltitudeAGL(double altagl); // and vice-versa
/// Velocity Parameters
//@{
/** Sets calibrated airspeed
Setting this will trigger a recalc of the other velocity terms.
@param vc Calibrated airspeed in ft/sec */
void set_V_calibrated_kts(double vc);
/** Sets Mach number.
Setting this will trigger a recalc of the other velocity terms.
@param mach Mach number */
void set_Mach_number(double mach);
/** Sets velocity in N-E-D coordinates.
Setting this will trigger a recalc of the other velocity terms.
@param north velocity northward in ft/sec
@param east velocity eastward in ft/sec
@param down velocity downward in ft/sec */
void set_Velocities_Local( double north, double east, double down );
/** Sets aircraft velocity in stability frame.
Setting this will trigger a recalc of the other velocity terms.
@param u X velocity in ft/sec
@param v Y velocity in ft/sec
@param w Z velocity in ft/sec */
void set_Velocities_Wind_Body( double u, double v, double w);
//@}
/** Euler angle parameters
@param phi roll angle in radians
@param theta pitch angle in radians
@param psi heading angle in radians */
void set_Euler_Angles( double phi, double theta, double psi );
/// Flight Path Parameters
//@{
/** Sets rate of climb
@param roc Rate of climb in ft/sec */
void set_Climb_Rate( double roc);
/** Sets the flight path angle in radians
@param gamma flight path angle in radians. */
void set_Gamma_vert_rad( double gamma);
//@}
/// Earth Parameters
//@{
/** Sets the sea level radius in feet.
@param slr Sea Level Radius in feet */
void set_Sea_level_radius(double slr);
/** Sets the runway altitude in feet above sea level.
@param ralt Runway altitude in feet above sea level. */
void set_Runway_altitude(double ralt);
//@}
/// Atmospheric Parameters
//@{
/** Sets the atmospheric static pressure
@param p pressure in psf */
void set_Static_pressure(double p);
/** Sets the atmospheric temperature
@param T temperature in degrees rankine */
void set_Static_temperature(double T);
/** Sets the atmospheric density.
@param rho air density slugs/cubic foot */
void set_Density(double rho);
/** Sets the velocity of the local airmass for wind modeling.
@param wnorth velocity north in fps
@param weast velocity east in fps
@param wdown velocity down in fps*/
void set_Velocities_Local_Airmass (double wnorth,
double weast,
double wdown );
//@}
/** Update the position based on inputs, positions, velocities, etc.
@param multiloop number of times to loop through the FDM
@return true if successful */
bool update( int multiloop );
private:
FGFDMExec *fdmex;
FGInitialCondition *fgic;
bool needTrim;
bool trimmed;
float trim_elev;
float trim_throttle;
void snap_shot(void);
};

View file

@ -110,8 +110,8 @@ void FGInitialCondition::SetVequivalentKtsIC(float tt) {
vc=calcVcas(mach);
}
void FGInitialCondition::SetVtrueKtsIC(float tt) {
vt=tt*jsbKTSTOFPS;
void FGInitialCondition::SetVtrueFpsIC(float tt) {
vt=tt;
lastSpeedSet=setvt;
mach=vt/fdmex->GetAtmosphere()->GetSoundSpeed();
vc=calcVcas(mach);

View file

@ -118,7 +118,8 @@ public:
void SetVcalibratedKtsIC(float tt);
void SetVequivalentKtsIC(float tt);
void SetVtrueKtsIC(float tt);
inline void SetVtrueKtsIC(float tt) { SetVtrueFpsIC(tt*jsbKTSTOFPS); }
void SetVtrueFpsIC(float tt);
void SetMachIC(float tt);
void SetUBodyFpsIC(float tt);
@ -206,6 +207,9 @@ public:
inline float GetThetaRadIC(void) { return theta; }
inline float GetPhiRadIC(void) { return phi; }
inline float GetPsiRadIC(void) { return psi; }
inline float GetSeaLevelRadiusFtIC(void) { return sea_level_radius; }
inline float GetTerrainAltitudeFtIC(void) { return terrain_altitude; }

View file

@ -360,6 +360,10 @@ void FGState::Initialize(FGInitialCondition *FGIC) {
psi = FGIC->GetPsiRadIC();
Initialize(U, V, W, phi, tht, psi, latitude, longitude, h);
FDMExec->GetPosition()->SetSeaLevelRadius( FGIC->GetSeaLevelRadiusFtIC() );
FDMExec->GetPosition()->SetRunwayRadius( FGIC->GetSeaLevelRadiusFtIC() +
FGIC->GetTerrainAltitudeFtIC() );
}
/******************************************************************************/

View file

@ -38,24 +38,22 @@
#include "LaRCsim.hxx"
FGLaRCsim::FGLaRCsim(void) {
ls_toplevel_init( 0.0, (char *)globals->get_options()->get_aircraft().c_str() );
lsic=new LaRCsimIC; //this needs to be brought up after LaRCsim is
copy_to_LaRCsim(); // initialize all of LaRCsim's vars
//this should go away someday -- formerly done in fg_init.cxx
Mass = 8.547270E+01;
I_xx = 1.048000E+03;
I_yy = 3.000000E+03;
I_zz = 3.530000E+03;
I_xz = 0.000000E+00;
ls_toplevel_init( 0.0,
(char *)globals->get_options()->get_aircraft().c_str() );
lsic=new LaRCsimIC; //this needs to be brought up after LaRCsim is
copy_to_LaRCsim(); // initialize all of LaRCsim's vars
//this should go away someday -- formerly done in fg_init.cxx
Mass = 8.547270E+01;
I_xx = 1.048000E+03;
I_yy = 3.000000E+03;
I_zz = 3.530000E+03;
I_xz = 0.000000E+00;
}
FGLaRCsim::~FGLaRCsim(void) {
if(lsic != NULL) {
delete lsic;
}
if(lsic != NULL) {
delete lsic;
}
}
// Initialize the LaRCsim flight model, dt is the time increment for
@ -71,7 +69,7 @@ bool FGLaRCsim::init( double dt ) {
// update the engines interface
FGEngInterface e;
add_engine( e );
// FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::init()" );
@ -87,7 +85,6 @@ bool FGLaRCsim::init( double dt ) {
// actual LaRCsim top level init
// ls_toplevel_init( dt, (char *)globals->get_options()->get_aircraft().c_str() );
FG_LOG( FG_FLIGHT, FG_INFO, "FG pos = " <<
get_Latitude() );
@ -116,9 +113,9 @@ bool FGLaRCsim::update( int multiloop ) {
eng.set_Throttle_Lever_Pos( controls.get_throttle( 0 ) * 100.0 );
eng.set_Propeller_Lever_Pos( 100 );
if ( controls.get_mixture( 0 ) > 0.60 ) {
eng.set_Mixture_Lever_Pos( controls.get_mixture( 0 ) * 100.0 );
eng.set_Mixture_Lever_Pos( controls.get_mixture( 0 ) * 100.0 );
} else {
eng.set_Mixture_Lever_Pos( 60.0 );
eng.set_Mixture_Lever_Pos( 60.0 );
}
// update engine model
@ -138,13 +135,16 @@ bool FGLaRCsim::update( int multiloop ) {
e->set_prop_thrust( eng.get_prop_thrust_SI() );
#if 0
FG_LOG( FG_FLIGHT, FG_INFO, "Throttle = " << controls.get_throttle( 0 ) * 100.0);
FG_LOG( FG_FLIGHT, FG_INFO, "Throttle = "
<< controls.get_throttle( 0 ) * 100.0);
FG_LOG( FG_FLIGHT, FG_INFO, " Mixture = " << 80);
FG_LOG( FG_FLIGHT, FG_INFO, " RPM = " << eng.get_RPM());
FG_LOG( FG_FLIGHT, FG_INFO, " MP = " << eng.get_Manifold_Pressure());
FG_LOG( FG_FLIGHT, FG_INFO, " HP = " << ( eng.get_MaxHP() * eng.get_Percentage_Power()/ 100.0) );
FG_LOG( FG_FLIGHT, FG_INFO, " HP = "
<< ( eng.get_MaxHP() * eng.get_Percentage_Power()/ 100.0) );
FG_LOG( FG_FLIGHT, FG_INFO, " EGT = " << eng.get_EGT());
FG_LOG( FG_FLIGHT, FG_INFO, " Thrust (N) " << eng.get_prop_thrust_SI()); // Thrust in Newtons
FG_LOG( FG_FLIGHT, FG_INFO, " Thrust (N) "
<< eng.get_prop_thrust_SI()); // Thrust in Newtons
FG_LOG( FG_FLIGHT, FG_INFO, '\n');
#endif
// Hmm .. Newtons to lbs is 0.2248 ...
@ -185,8 +185,8 @@ bool FGLaRCsim::update( int multiloop ) {
// Weather
/* V_north_airmass = get_V_north_airmass();
V_east_airmass = get_V_east_airmass();
V_down_airmass = get_V_down_airmass(); */
V_east_airmass = get_V_east_airmass();
V_down_airmass = get_V_down_airmass(); */
// old -- FGInterface_2_LaRCsim() not needed except for Init()
@ -198,14 +198,9 @@ bool FGLaRCsim::update( int multiloop ) {
ls_update(multiloop);
if(isnan(Phi)) {
busdump();
exit(1);
}
// printf("%d FG_Altitude = %.2f\n", i, FG_Altitude * 0.3048);
// printf("%d Altitude = %.2f\n", i, Altitude * 0.3048);
// translate LaRCsim back to FG structure so that the
// autopilot (and the rest of the sim can use the updated
// values
@ -438,7 +433,7 @@ bool FGLaRCsim::copy_from_LaRCsim() {
// set_Velocities_Gust( U_gust, V_gust, W_gust );
_set_Velocities_Wind_Body( U_body, V_body, W_body );
// set_V_rel_wind( V_rel_wind );
_set_V_rel_wind( V_rel_wind );
// set_V_true_kts( V_true_kts );
// set_V_rel_ground( V_rel_ground );
// set_V_inertial( V_inertial );
@ -451,7 +446,7 @@ bool FGLaRCsim::copy_from_LaRCsim() {
_set_Omega_Body( P_body, Q_body, R_body );
// set_Omega_Local( P_local, Q_local, R_local );
// set_Omega_Total( P_total, Q_total, R_total );
_set_Euler_Rates( Phi_dot, Theta_dot, Psi_dot );
_set_Geocentric_Rates( Latitude_dot, Longitude_dot, Radius_dot );
@ -472,7 +467,7 @@ bool FGLaRCsim::copy_from_LaRCsim() {
// Positions
_set_Geocentric_Position( Lat_geocentric, tmp_lon_geoc,
Radius_to_vehicle );
Radius_to_vehicle );
_set_Geodetic_Position( Latitude, tmp_lon, Altitude );
_set_Euler_Angles( Phi, Theta, Psi );
@ -549,159 +544,188 @@ bool FGLaRCsim::copy_from_LaRCsim() {
void FGLaRCsim::set_ls(void) {
Phi=lsic->GetRollAngleRadIC();
Theta=lsic->GetPitchAngleRadIC();
Psi=lsic->GetHeadingRadIC();
V_north=lsic->GetVnorthFpsIC();
V_east=lsic->GetVeastFpsIC();
V_down=lsic->GetVdownFpsIC();
Altitude=lsic->GetAltitudeFtIC();
Latitude=lsic->GetLatitudeGDRadIC();
Longitude=lsic->GetLongitudeRadIC();
Runway_altitude=lsic->GetRunwayAltitudeFtIC();
V_north_airmass = lsic->GetVnorthAirmassFpsIC();
V_east_airmass = lsic->GetVeastAirmassFpsIC();
V_down_airmass = lsic->GetVdownAirmassFpsIC();
ls_loop(0.0,-1);
copy_from_LaRCsim();
FG_LOG( FG_FLIGHT, FG_INFO, " FGLaRCsim::set_ls(): " );
FG_LOG( FG_FLIGHT, FG_INFO, " Phi: " << Phi );
FG_LOG( FG_FLIGHT, FG_INFO, " Theta: " << Theta );
FG_LOG( FG_FLIGHT, FG_INFO, " Psi: " << Psi );
FG_LOG( FG_FLIGHT, FG_INFO, " V_north: " << V_north );
FG_LOG( FG_FLIGHT, FG_INFO, " V_east: " << V_east );
FG_LOG( FG_FLIGHT, FG_INFO, " V_down: " << V_down );
FG_LOG( FG_FLIGHT, FG_INFO, " Altitude: " << Altitude );
FG_LOG( FG_FLIGHT, FG_INFO, " Latitude: " << Latitude );
FG_LOG( FG_FLIGHT, FG_INFO, " Longitude: " << Longitude );
FG_LOG( FG_FLIGHT, FG_INFO, " Runway_altitude: " << Runway_altitude );
FG_LOG( FG_FLIGHT, FG_INFO, " V_north_airmass: " << V_north_airmass );
FG_LOG( FG_FLIGHT, FG_INFO, " V_east_airmass: " << V_east_airmass );
FG_LOG( FG_FLIGHT, FG_INFO, " V_down_airmass: " << V_down_airmass );
Phi=lsic->GetRollAngleRadIC();
Theta=lsic->GetPitchAngleRadIC();
Psi=lsic->GetHeadingRadIC();
V_north=lsic->GetVnorthFpsIC();
V_east=lsic->GetVeastFpsIC();
V_down=lsic->GetVdownFpsIC();
Altitude=lsic->GetAltitudeFtIC();
Latitude=lsic->GetLatitudeGDRadIC();
Longitude=lsic->GetLongitudeRadIC();
Runway_altitude=lsic->GetRunwayAltitudeFtIC();
V_north_airmass = lsic->GetVnorthAirmassFpsIC();
V_east_airmass = lsic->GetVeastAirmassFpsIC();
V_down_airmass = lsic->GetVdownAirmassFpsIC();
ls_loop(0.0,-1);
copy_from_LaRCsim();
FG_LOG( FG_FLIGHT, FG_INFO, " FGLaRCsim::set_ls(): " );
FG_LOG( FG_FLIGHT, FG_INFO, " Phi: " << Phi );
FG_LOG( FG_FLIGHT, FG_INFO, " Theta: " << Theta );
FG_LOG( FG_FLIGHT, FG_INFO, " Psi: " << Psi );
FG_LOG( FG_FLIGHT, FG_INFO, " V_north: " << V_north );
FG_LOG( FG_FLIGHT, FG_INFO, " V_east: " << V_east );
FG_LOG( FG_FLIGHT, FG_INFO, " V_down: " << V_down );
FG_LOG( FG_FLIGHT, FG_INFO, " Altitude: " << Altitude );
FG_LOG( FG_FLIGHT, FG_INFO, " Latitude: " << Latitude );
FG_LOG( FG_FLIGHT, FG_INFO, " Longitude: " << Longitude );
FG_LOG( FG_FLIGHT, FG_INFO, " Runway_altitude: " << Runway_altitude );
FG_LOG( FG_FLIGHT, FG_INFO, " V_north_airmass: " << V_north_airmass );
FG_LOG( FG_FLIGHT, FG_INFO, " V_east_airmass: " << V_east_airmass );
FG_LOG( FG_FLIGHT, FG_INFO, " V_down_airmass: " << V_down_airmass );
}
//Positions
void FGLaRCsim::snap_shot(void) {
lsic->SetLatitudeGDRadIC( get_Latitude() );
lsic->SetLongitudeRadIC( get_Longitude() );
lsic->SetAltitudeFtIC( get_Altitude() );
lsic->SetRunwayAltitudeFtIC( get_Runway_altitude() );
lsic->SetVtrueFpsIC( get_V_rel_wind() );
lsic->SetPitchAngleRadIC( get_Theta() );
lsic->SetRollAngleRadIC( get_Phi() );
lsic->SetHeadingRadIC( get_Psi() );
lsic->SetClimbRateFpsIC( get_Climb_Rate() );
lsic->SetVNEDAirmassFpsIC( get_V_north_airmass(),
get_V_east_airmass(),
get_V_down_airmass() );
}
//Positions
void FGLaRCsim::set_Latitude(double lat) {
FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_Latitude: " << lat );
lsic->SetLatitudeGDRadIC(lat);
set_ls();
copy_from_LaRCsim(); //update the bus
FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_Latitude: " << lat );
snap_shot();
lsic->SetLatitudeGDRadIC(lat);
set_ls();
copy_from_LaRCsim(); //update the bus
}
void FGLaRCsim::set_Longitude(double lon) {
FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_Longitude: " << lon );
lsic->SetLongitudeRadIC(lon);
set_ls();
copy_from_LaRCsim(); //update the bus
FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_Longitude: " << lon );
snap_shot();
lsic->SetLongitudeRadIC(lon);
set_ls();
copy_from_LaRCsim(); //update the bus
}
void FGLaRCsim::set_Altitude(double alt) {
FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_Altitude: " << alt );
lsic->SetAltitudeFtIC(alt);
set_ls();
copy_from_LaRCsim(); //update the bus
FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_Altitude: " << alt );
snap_shot();
lsic->SetAltitudeFtIC(alt);
set_ls();
copy_from_LaRCsim(); //update the bus
}
void FGLaRCsim::set_V_calibrated_kts(double vc) {
FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_V_calibrated_kts: " << vc );
lsic->SetVcalibratedKtsIC(vc);
set_ls();
copy_from_LaRCsim(); //update the bus
FG_LOG( FG_FLIGHT, FG_INFO,
"FGLaRCsim::set_V_calibrated_kts: " << vc );
snap_shot();
lsic->SetVcalibratedKtsIC(vc);
set_ls();
copy_from_LaRCsim(); //update the bus
}
void FGLaRCsim::set_Mach_number(double mach) {
FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_Mach_number: " << mach );
lsic->SetMachIC(mach);
set_ls();
copy_from_LaRCsim(); //update the bus
FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_Mach_number: " << mach );
snap_shot();
lsic->SetMachIC(mach);
set_ls();
copy_from_LaRCsim(); //update the bus
}
void FGLaRCsim::set_Velocities_Local( double north, double east, double down ){
FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_Velocities_local: "
<< north << " " << east << " " << down );
lsic->SetVnorthFpsIC(north);
lsic->SetVeastFpsIC(east);
lsic->SetVdownFpsIC(down);
set_ls();
copy_from_LaRCsim(); //update the bus
FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_Velocities_local: "
<< north << " " << east << " " << down );
snap_shot();
lsic->SetVNEDFpsIC(north, east, down);
set_ls();
copy_from_LaRCsim(); //update the bus
}
void FGLaRCsim::set_Velocities_Wind_Body( double u, double v, double w){
FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_Velocities_Wind_Body: "
<< u << " " << v << " " << w );
lsic->SetUBodyFpsIC(u);
lsic->SetVBodyFpsIC(v);
lsic->SetWBodyFpsIC(w);
set_ls();
copy_from_LaRCsim(); //update the bus
FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_Velocities_Wind_Body: "
<< u << " " << v << " " << w );
snap_shot();
lsic->SetUVWFpsIC(u,v,w);
set_ls();
copy_from_LaRCsim(); //update the bus
}
//Euler angles
void FGLaRCsim::set_Euler_Angles( double phi, double theta, double psi ) {
FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_Euler_angles: "
<< phi << " " << theta << " " << psi );
FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_Euler_angles: "
<< phi << " " << theta << " " << psi );
lsic->SetPitchAngleRadIC(theta);
lsic->SetRollAngleRadIC(phi);
lsic->SetHeadingRadIC(psi);
set_ls();
copy_from_LaRCsim(); //update the bus
snap_shot();
lsic->SetPitchAngleRadIC(theta);
lsic->SetRollAngleRadIC(phi);
lsic->SetHeadingRadIC(psi);
set_ls();
copy_from_LaRCsim(); //update the bus
}
//Flight Path
void FGLaRCsim::set_Climb_Rate( double roc) {
FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_Climb_rate: " << roc );
lsic->SetClimbRateFpsIC(roc);
set_ls();
copy_from_LaRCsim(); //update the bus
FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_Climb_rate: " << roc );
snap_shot();
lsic->SetClimbRateFpsIC(roc);
set_ls();
copy_from_LaRCsim(); //update the bus
}
void FGLaRCsim::set_Gamma_vert_rad( double gamma) {
FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_Gamma_vert_rad: " << gamma );
lsic->SetFlightPathAngleRadIC(gamma);
set_ls();
copy_from_LaRCsim(); //update the bus
FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_Gamma_vert_rad: " << gamma );
snap_shot();
lsic->SetFlightPathAngleRadIC(gamma);
set_ls();
copy_from_LaRCsim(); //update the bus
}
void FGLaRCsim::set_Runway_altitude(double ralt) {
FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_Runway_altitude: " << ralt );
lsic->SetRunwayAltitudeFtIC(ralt);
set_ls();
copy_from_LaRCsim(); //update the bus
FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_Runway_altitude: " << ralt );
snap_shot();
lsic->SetRunwayAltitudeFtIC(ralt);
set_ls();
copy_from_LaRCsim(); //update the bus
}
void FGLaRCsim::set_AltitudeAGL(double altagl) {
FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_AltitudeAGL: " << altagl );
lsic->SetAltitudeAGLFtIC(altagl);
set_ls();
copy_from_LaRCsim();
FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_AltitudeAGL: " << altagl );
snap_shot();
lsic->SetAltitudeAGLFtIC(altagl);
set_ls();
copy_from_LaRCsim();
}
void FGLaRCsim::set_Velocities_Local_Airmass (double wnorth,
double weast,
double wdown ) {
FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_Velocities_Local_Airmass: "
<< wnorth << " " << weast << " " << wdown );
_set_Velocities_Local_Airmass( wnorth, weast, wdown );
set_ls();
copy_from_LaRCsim();
double weast,
double wdown ) {
FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_Velocities_Local_Airmass: "
<< wnorth << " " << weast << " " << wdown );
snap_shot();
lsic->SetVNEDAirmassFpsIC( wnorth, weast, wdown );
set_ls();
copy_from_LaRCsim();
}
void FGLaRCsim::set_Static_pressure(double p) {
FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_Static_pressure: " << p );
FG_LOG( FG_FLIGHT, FG_INFO, "LaRCsim does not support externally supplied atmospheric data" );
FG_LOG( FG_FLIGHT, FG_INFO,
"FGLaRCsim::set_Static_pressure: " << p );
FG_LOG( FG_FLIGHT, FG_INFO,
"LaRCsim does not support externally supplied atmospheric data" );
}
void FGLaRCsim::set_Static_temperature(double T) {
FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_Static_temperature: " << T );
FG_LOG( FG_FLIGHT, FG_INFO, "LaRCsim does not support externally supplied atmospheric data" );
FG_LOG( FG_FLIGHT, FG_INFO,
"FGLaRCsim::set_Static_temperature: " << T );
FG_LOG( FG_FLIGHT, FG_INFO,
"LaRCsim does not support externally supplied atmospheric data" );
}
void FGLaRCsim::set_Density(double rho) {
FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_Density: " << rho );
FG_LOG( FG_FLIGHT, FG_INFO, "LaRCsim does not support externally supplied atmospheric data" );
FG_LOG( FG_FLIGHT, FG_INFO,
"LaRCsim does not support externally supplied atmospheric data" );
}

View file

@ -36,6 +36,7 @@ class FGLaRCsim: public FGInterface {
FGNewEngine eng;
LaRCsimIC* lsic;
void set_ls(void);
void snap_shot(void);
double time_step;
public:

View file

@ -37,6 +37,9 @@
CURRENT RCS HEADER INFO:
$Header$
$Log$
Revision 1.3 2000/10/28 14:30:33 curt
Updates by Tony working on the FDM interface bus.
Revision 1.2 2000/04/10 18:09:41 curt
David Megginson made a few (mostly minor) mods to the LaRCsim files, and
it's now possible to choose the LaRCsim model at runtime, as in
@ -119,6 +122,7 @@ void ls_model( SCALAR dt, int Initialize ) {
navion_gear( dt, Initialize );
break;
case C172:
if(Initialize < 0) c172_init();
inertias( dt, Initialize );
subsystems( dt, Initialize );
c172_aero( dt, Initialize );

View file

@ -119,40 +119,18 @@ void LaRCsimIC::SetPitchAngleRadIC(SCALAR tt) {
getAlpha();
}
void LaRCsimIC::SetUBodyFpsIC( SCALAR tt) {
u=tt;
void LaRCsimIC::SetUVWFpsIC(SCALAR vu, SCALAR vv, SCALAR vw) {
u=vu; v=vv; w=vw;
vt=sqrt(u*u+v*v+w*w);
lastSpeedSet=lssetuvw;
}
void LaRCsimIC::SetVBodyFpsIC( SCALAR tt) {
v=tt;
vt=sqrt(u*u+v*v+w*w);
lastSpeedSet=lssetuvw;
}
void LaRCsimIC::SetWBodyFpsIC( SCALAR tt) {
w=tt;
vt=sqrt(u*u+v*v+w*w);
lastSpeedSet=lssetuvw;
}
void LaRCsimIC::SetVNorthAirmassFpsIC(SCALAR tt) {
vnorthwind=tt;
vw=sqrt(vnorthwind*vnorthwind + veastwind*veastwind + vdownwind*vdownwind);
}
void LaRCsimIC::SetVEastAirmassFpsIC(SCALAR tt) {
veastwind=tt;
vw=sqrt(vnorthwind*vnorthwind + veastwind*veastwind + vdownwind*vdownwind);
}
void LaRCsimIC::SetVDownAirmassFpsIC(SCALAR tt){
vdownwind=tt;
void LaRCsimIC::SetVNEDAirmassFpsIC(SCALAR north, SCALAR east, SCALAR down ) {
vnorthwind=north; veastwind=east; vdownwind=down;
vw=sqrt(vnorthwind*vnorthwind + veastwind*veastwind + vdownwind*vdownwind);
vtg=vt+vw;
hdot=-vtg*sin(gamma);
SetClimbRateFpsIC(-1*(vdown+vdownwind));
}
void LaRCsimIC::SetAltitudeFtIC( SCALAR tt) {
@ -243,25 +221,15 @@ void LaRCsimIC::calcNEDfromVt(void) {
vdownwind;
}
void LaRCsimIC::SetVnorthFpsIC( SCALAR tt) {
vnorth=tt;
void LaRCsimIC::SetVNEDFpsIC( SCALAR north, SCALAR east, SCALAR down) {
vnorth=north;
veast=east;
vdown=down;
SetClimbRateFpsIC(-1*vdown);
lastSpeedSet=lssetned;
calcVtfromNED();
}
void LaRCsimIC::SetVeastFpsIC( SCALAR tt) {
veast=tt;
lastSpeedSet=lssetned;
calcVtfromNED();
}
void LaRCsimIC::SetVdownFpsIC( SCALAR tt) {
vdown=tt;
calcVtfromNED();
SetClimbRateFpsIC(-1*vdown);
lastSpeedSet=lssetned;
}
void LaRCsimIC::SetLatitudeGDRadIC(SCALAR tt) {
latitude_gd=tt;
ls_geod_to_geoc(latitude_gd,altitude,&sea_level_radius, &latitude_gc);

View file

@ -59,17 +59,11 @@ public:
void SetVequivalentKtsIC(SCALAR tt);
void SetUBodyFpsIC(SCALAR tt);
void SetVBodyFpsIC(SCALAR tt);
void SetWBodyFpsIC(SCALAR tt);
void SetUVWFpsIC(SCALAR vu, SCALAR vv, SCALAR vw);
void SetVNEDFpsIC(SCALAR north, SCALAR east, SCALAR down);
void SetVnorthFpsIC(SCALAR tt);
void SetVeastFpsIC(SCALAR tt);
void SetVdownFpsIC(SCALAR tt);
void SetVNorthAirmassFpsIC(SCALAR tt);
void SetVEastAirmassFpsIC(SCALAR tt);
void SetVDownAirmassFpsIC(SCALAR tt);
void SetVNEDAirmassFpsIC(SCALAR north, SCALAR east, SCALAR down );
void SetAltitudeFtIC(SCALAR tt);
void SetAltitudeAGLFtIC(SCALAR tt);

View file

@ -27,6 +27,7 @@
#include <simgear/debug/logstream.hxx>
#include <simgear/math/sg_geodesy.hxx>
#include <Scenery/scenery.hxx>
#include <FDM/LaRCsim/ls_interface.h>
#include <Main/globals.hxx>
#include <Time/timestamp.hxx>
@ -137,8 +138,6 @@ FGInterface::FGInterface(void) {
sin_latitude=cos_latitude=0;
sin_longitude=cos_longitude=0;
altitude_agl=0;
resetNeeded=false;
}
@ -158,6 +157,58 @@ bool FGInterface::update( int multi_loop ) {
return false;
}
void FGInterface::_updatePosition( double lat_geoc, double lon, double alt ) {
double lat_geod, tmp_alt, sl_radius1, sl_radius2, tmp_lat_geoc;
sgGeocToGeod( lat_geoc, EQUATORIAL_RADIUS_M + alt * FEET_TO_METER,
&lat_geod, &tmp_alt, &sl_radius1 );
sgGeodToGeoc( lat_geod, alt * FEET_TO_METER, &sl_radius2, &tmp_lat_geoc );
FG_LOG( FG_FLIGHT, FG_DEBUG, "lon = " << lon
<< " lat_geod = " << lat_geod
<< " lat_geoc = " << lat_geoc
<< " alt = " << alt
<< " tmp_alt = " << tmp_alt * METER_TO_FEET
<< " sl_radius1 = " << sl_radius1 * METER_TO_FEET
<< " sl_radius2 = " << sl_radius2 * METER_TO_FEET
<< " Equator = " << EQUATORIAL_RADIUS_FT );
_set_Geocentric_Position( lat_geoc, lon,
sl_radius2 * METER_TO_FEET + alt );
_set_Geodetic_Position( lat_geod, lon, alt );
_set_Sea_level_radius( sl_radius2 * METER_TO_FEET );
_set_Runway_altitude( scenery.cur_elev*METERS_TO_FEET );
_set_sin_lat_geocentric( lat_geoc );
_set_cos_lat_geocentric( lat_geoc );
_set_sin_cos_longitude( lon );
_set_sin_cos_latitude( lat_geod );
/* 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)
*/
}
// Extrapolate fdm based on time_offset (in usec)
void FGInterface::extrapolate( int time_offset ) {
@ -301,7 +352,7 @@ void FGInterface::set_Velocities_Local_Airmass (double wnorth,
}
void FGInterface::busdump(void) {
void FGInterface::_busdump(void) {
FG_LOG(FG_FLIGHT,FG_INFO,"d_pilot_rp_body_v[3]: " << d_pilot_rp_body_v[0] << ", " << d_pilot_rp_body_v[1] << ", " << d_pilot_rp_body_v[2]);
FG_LOG(FG_FLIGHT,FG_INFO,"d_cg_rp_body_v[3]: " << d_cg_rp_body_v[0] << ", " << d_cg_rp_body_v[1] << ", " << d_cg_rp_body_v[2]);

View file

@ -160,10 +160,6 @@ typedef vector < FGEngInterface > engine_list;
// This is based heavily on LaRCsim/ls_generic.h
class FGInterface {
protected:
void busdump(void);
private:
// Pilot location rel to ref pt
@ -253,9 +249,6 @@ private:
double sin_latitude, cos_latitude;
double altitude_agl;
//change flag
bool resetNeeded;
// Engine list
engine_list engines;
@ -263,6 +256,9 @@ private:
FGTimeStamp next_stamp; // time this record is valid
protected:
void _busdump(void);
void _updatePosition( double lat_geoc, double lon, double alt );
void _updateWeather( void );
inline void _set_Inertias( double m, double xx, double yy,
double zz, double xz)
@ -326,6 +322,7 @@ protected:
v_wind_body_v[1] = v;
v_wind_body_v[2] = w;
}
inline void _set_V_rel_wind(double vt) { v_rel_wind = vt; }
inline void _set_V_ground_speed( double v) { v_ground_speed = v; }
inline void _set_V_equiv_kts( double kts ) { v_equiv_kts = kts; }
inline void _set_V_calibrated_kts( double kts ) { v_calibrated_kts = kts; }
@ -726,7 +723,7 @@ public:
inline double get_V_body() const { return v_wind_body_v[1]; }
inline double get_W_body() const { return v_wind_body_v[2]; }
// inline double get_V_rel_wind() const { return v_rel_wind; }
inline double get_V_rel_wind() const { return v_rel_wind; }
// inline void set_V_rel_wind(double wind) { v_rel_wind = wind; }
// inline double get_V_true_kts() const { return v_true_kts; }

View file

@ -407,21 +407,21 @@ bool fgInitGeneral( void ) {
// set initial aircraft speed
bool fgVelocityInit( void ) {
switch(globals->get_options()->get_speedset()) {
case 1: //FG_VC
case FGOptions::FG_VC:
current_aircraft.fdm_state->set_V_calibrated_kts(
globals->get_options()->get_vc() );
break;
case 2: //FG_MACH
case FGOptions::FG_MACH:
current_aircraft.fdm_state->set_Mach_number(
globals->get_options()->get_mach() );
break;
case 3: //FG_VTUVW
case FGOptions::FG_VTUVW:
current_aircraft.fdm_state->set_Velocities_Wind_Body(
globals->get_options()->get_uBody(),
globals->get_options()->get_vBody(),
globals->get_options()->get_wBody() );
break;
case 4: //FG_VTNED
case FGOptions::FG_VTNED:
current_aircraft.fdm_state->set_Velocities_Local(
globals->get_options()->get_vNorth(),
globals->get_options()->get_vEast(),