Fixed the initial location so that geodetic latitude and ASL are kept in sync.
This commit is contained in:
parent
3c4542fba6
commit
c226e08293
3 changed files with 28 additions and 15 deletions
|
@ -1023,16 +1023,17 @@ void FGJSBsim::set_Latitude(double lat)
|
||||||
SG_LOG(SG_FLIGHT,SG_INFO,"FGJSBsim::set_Latitude: " << lat );
|
SG_LOG(SG_FLIGHT,SG_INFO,"FGJSBsim::set_Latitude: " << lat );
|
||||||
SG_LOG(SG_FLIGHT,SG_INFO," cur alt (ft) = " << alt );
|
SG_LOG(SG_FLIGHT,SG_INFO," cur alt (ft) = " << alt );
|
||||||
|
|
||||||
sgGeodToGeoc( lat, alt * SG_FEET_TO_METER,
|
|
||||||
&sea_level_radius_meters, &lat_geoc );
|
|
||||||
|
|
||||||
double sea_level_radius_ft = sea_level_radius_meters * SG_METER_TO_FEET;
|
|
||||||
_set_Sea_level_radius( sea_level_radius_ft );
|
|
||||||
|
|
||||||
if (needTrim)
|
if (needTrim)
|
||||||
fgic->SetLatitudeRadIC( lat_geoc );
|
fgic->SetGeodLatitudeRadIC( lat );
|
||||||
else
|
else {
|
||||||
|
sgGeodToGeoc( lat, alt * SG_FEET_TO_METER,
|
||||||
|
&sea_level_radius_meters, &lat_geoc );
|
||||||
|
|
||||||
|
double sea_level_radius_ft = sea_level_radius_meters * SG_METER_TO_FEET;
|
||||||
|
_set_Sea_level_radius( sea_level_radius_ft );
|
||||||
|
|
||||||
Propagate->SetLatitude(lat_geoc);
|
Propagate->SetLatitude(lat_geoc);
|
||||||
|
}
|
||||||
|
|
||||||
FGInterface::set_Latitude(lat);
|
FGInterface::set_Latitude(lat);
|
||||||
}
|
}
|
||||||
|
@ -1055,13 +1056,8 @@ void FGJSBsim::set_Altitude(double alt)
|
||||||
{
|
{
|
||||||
SG_LOG(SG_FLIGHT,SG_INFO, "FGJSBsim::set_Altitude: " << alt );
|
SG_LOG(SG_FLIGHT,SG_INFO, "FGJSBsim::set_Altitude: " << alt );
|
||||||
|
|
||||||
if (needTrim) {
|
if (needTrim)
|
||||||
FGLocation position = fgic->GetPosition();
|
fgic->SetAltitudeASLFtIC(alt);
|
||||||
|
|
||||||
position.SetPositionGeodetic(0.0, position.GetGeodLatitudeRad(), alt);
|
|
||||||
fgic->SetAltitudeASLFtIC(position.GetAltitudeASL());
|
|
||||||
// fgic->SetLatitudeRadIC(position.GetLatitude());
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
Propagate->SetAltitudeASL(alt);
|
Propagate->SetAltitudeASL(alt);
|
||||||
|
|
||||||
|
|
|
@ -739,6 +739,17 @@ void FGInitialCondition::SetAltitudeASLFtIC(double alt)
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
|
void FGInitialCondition::SetGeodLatitudeRadIC(double geodLatitude)
|
||||||
|
{
|
||||||
|
double h = ComputeGeodAltitude(geodLatitude);
|
||||||
|
double lon = position.GetLongitude();
|
||||||
|
|
||||||
|
position.SetPositionGeodetic(lon, geodLatitude, h);
|
||||||
|
lastLatitudeSet = setgeod;
|
||||||
|
}
|
||||||
|
|
||||||
|
//******************************************************************************
|
||||||
|
|
||||||
void FGInitialCondition::SetLatitudeRadIC(double lat)
|
void FGInitialCondition::SetLatitudeRadIC(double lat)
|
||||||
{
|
{
|
||||||
double altitude;
|
double altitude;
|
||||||
|
|
|
@ -592,6 +592,12 @@ public:
|
||||||
@param lat Initial latitude in radians */
|
@param lat Initial latitude in radians */
|
||||||
void SetLatitudeRadIC(double lat);
|
void SetLatitudeRadIC(double lat);
|
||||||
|
|
||||||
|
/** Sets the initial geodetic latitude.
|
||||||
|
This method modifies the geodetic altitude in order to keep the altitude
|
||||||
|
above sea level unchanged.
|
||||||
|
@param glat Initial geodetic latitude in radians */
|
||||||
|
void SetGeodLatitudeRadIC(double glat);
|
||||||
|
|
||||||
/** Sets the initial longitude.
|
/** Sets the initial longitude.
|
||||||
@param lon Initial longitude in radians */
|
@param lon Initial longitude in radians */
|
||||||
void SetLongitudeRadIC(double lon);
|
void SetLongitudeRadIC(double lon);
|
||||||
|
|
Loading…
Reference in a new issue