1
0
Fork 0

Fixed [simple] terrain following altitude hold mode to work again.

This commit is contained in:
curt 2001-08-31 18:07:23 +00:00
parent 0f68fb3633
commit 019b6d29fe
4 changed files with 15 additions and 3 deletions

View file

@ -176,6 +176,8 @@ public:
inline void set_TargetDistance( double val ) { TargetDistance = val; }
inline double get_TargetAltitude() const { return TargetAltitude; }
inline void set_TargetAltitude( double val ) { TargetAltitude = val; }
inline double get_TargetAGL() const { return TargetAGL; }
inline void set_TargetAGL( double val ) { TargetAGL = val; }
inline double get_TargetClimbRate() const { return TargetClimbRate; }
inline void set_TargetClimbRate( double val ) { TargetClimbRate = val; }

View file

@ -381,6 +381,8 @@ bool FGJSBsim::copy_from_JSBsim() {
Position->GetLongitude(),
Position->Geth() );
_set_Altitude_AGL( Position->GetDistanceAGL() );
_set_Euler_Angles( Rotation->Getphi(),
Rotation->Gettht(),
Rotation->Getpsi() );

View file

@ -469,7 +469,7 @@ bool FGLaRCsim::copy_from_LaRCsim() {
_set_Geodetic_Position( Latitude, tmp_lon, Altitude );
_set_Euler_Angles( Phi, Theta, Psi );
_set_Altitude_AGL( Altitude-Runway_altitude );
_set_Altitude_AGL( Altitude - Runway_altitude );
// Miscellaneous quantities
_set_T_Local_to_Body(T_local_to_body_m);

View file

@ -571,6 +571,12 @@ setAPTerrainLock (bool lock)
{
current_autopilot->set_AltitudeMode(FGAutopilot::FG_ALTITUDE_TERRAIN);
current_autopilot->set_AltitudeEnabled(lock);
current_autopilot->set_TargetAGL(
current_aircraft.fdm_state->get_Altitude_AGL() * SG_FEET_TO_METER
);
cout << "Target AGL = "
<< current_aircraft.fdm_state->get_Altitude_AGL() * SG_FEET_TO_METER
<< endl;
}
@ -1030,6 +1036,8 @@ fgInitProps ()
fgSetArchivable("/autopilot/locks/glide-slope");
fgTie("/autopilot/locks/terrain", getAPTerrainLock, setAPTerrainLock);
fgSetArchivable("/autopilot/locks/terrain");
fgTie("/autopilot/settings/agl-ft", getAPAltitude, setAPAltitude);
fgSetArchivable("/autopilot/settings/agl-ft");
fgTie("/autopilot/settings/climb-rate-fpm", getAPClimb, setAPClimb, false);
fgSetArchivable("/autopilot/settings/climb-rate-fpm");
fgTie("/autopilot/locks/heading", getAPHeadingLock, setAPHeadingLock);
@ -1195,7 +1203,7 @@ FGAndCondition::FGAndCondition ()
FGAndCondition::~FGAndCondition ()
{
for (int i = 0; i < _conditions.size(); i++)
for (unsigned int i = 0; i < _conditions.size(); i++)
delete _conditions[i];
}
@ -1228,7 +1236,7 @@ FGOrCondition::FGOrCondition ()
FGOrCondition::~FGOrCondition ()
{
for (int i = 0; i < _conditions.size(); i++)
for (unsigned int i = 0; i < _conditions.size(); i++)
delete _conditions[i];
}