1
0
Fork 0

UFO and MagicCarpet FDM: avoid negative headings

Both FDM set the heading to negative values when turning left
through north. This should be fixed by this commit.
This commit is contained in:
Torsten Dreyer 2015-07-08 11:14:46 +02:00
parent b61904a7a1
commit 9c637e6b2a
2 changed files with 2 additions and 2 deletions

View file

@ -81,7 +81,7 @@ void FGMagicCarpet::update( double dt ) {
// update euler angles // update euler angles
_set_Euler_Angles( get_Phi(), get_Theta(), _set_Euler_Angles( get_Phi(), get_Theta(),
fmod(get_Psi() + turn, SGD_2PI) ); SGMiscd::normalizePeriodic(0, SGD_2PI, get_Psi() + turn) );
_set_Euler_Rates(0,0,0); _set_Euler_Rates(0,0,0);
// update (lon/lat) position // update (lon/lat) position

View file

@ -173,7 +173,7 @@ void FGUFO::update( double dt ) {
sgGeodToGeoc( get_Latitude(), get_Altitude(), &sl_radius, &lat_geoc ); sgGeodToGeoc( get_Latitude(), get_Altitude(), &sl_radius, &lat_geoc );
// update euler angles // update euler angles
double heading = fmod(get_Psi() + turn + yaw, SGD_2PI); double heading = SGMiscd::normalizePeriodic(0, SGD_2PI, get_Psi() + turn + yaw );
_set_Euler_Angles(roll, pitch, heading); _set_Euler_Angles(roll, pitch, heading);
_set_Euler_Rates(0,0,0); _set_Euler_Rates(0,0,0);