fdm['ic/gamma-deg'] sign switches #544
Replies: 2 comments 2 replies
-
So setting Now note that the climb rate is stored in a NED velocity vector, where the Down axis is positive down, so note the minus sign in:
/** Sets the flight path angle initial condition in degrees.
@param gamma Flight path angle in degrees */
void SetFlightPathAngleDegIC(double gamma)
{ SetClimbRateFpsIC(vt*sin(gamma*degtorad)); }
void FGInitialCondition::SetClimbRateFpsIC(double hdot)
{
if (fabs(hdot) > vt) {
cerr << "The climb rate cannot be higher than the true speed." << endl;
return;
}
const FGMatrix33& Tb2l = orientation.GetTInv();
FGColumnVector3 _vt_NED = Tb2l * Tw2b * FGColumnVector3(vt, 0., 0.);
FGColumnVector3 _WIND_NED = _vt_NED - vUVW_NED;
double hdot0 = -_vt_NED(eW);
if (fabs(hdot0) < vt) { // Is this check really needed ?
double scale = sqrt((vt*vt-hdot*hdot)/(vt*vt-hdot0*hdot0));
_vt_NED(eU) *= scale;
_vt_NED(eV) *= scale;
}
_vt_NED(eW) = -hdot;
vUVW_NED = _vt_NED - _WIND_NED;
// Updating the angles theta and beta to keep the true airspeed amplitude
calcThetaBeta(alpha, _vt_NED);
} Now the issue is that when retrieving gamma the sign convention with positive down in the NED frame isn't reversed, we should be passing:
Or actually /** Gets the initial flight path angle.
@return Initial flight path angle in degrees */
double GetFlightPathAngleDegIC(void) const
{ return GetFlightPathAngleRadIC()*radtodeg; }
/** Gets the initial flight path angle.
If total velocity is zero, this function returns zero.
@return Initial flight path angle in radians */
double GetFlightPathAngleRadIC(void) const
{ return (vt == 0.0)?0.0:asin(GetClimbRateFpsIC() / vt); }
/** Gets the initial climb rate.
@return Initial rate of climb in feet/second */
double GetClimbRateFpsIC(void) const
{
const FGMatrix33& Tb2l = orientation.GetTInv();
FGColumnVector3 _vt_NED = Tb2l * Tw2b * FGColumnVector3(vt, 0., 0.);
return _vt_NED(eW);
} |
Beta Was this translation helpful? Give feedback.
-
I've just submitted a pull request to fix But yes, if you take a look at how gamma is computed for gamma = atan2(-in.vVel(eDown), Vground); |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello everyone,
When I try to re-asign a value for fdm['ic/gamma-deg'], it stores the value with the opposite sign.
Assigning:
fdm['ic/gamma-deg'] = 4
Reading:
Print(fdm['ic/gamma-deg'])
fdm['ic/gamma-deg'] = -4
Does anyone know anything about it?
Beta Was this translation helpful? Give feedback.
All reactions