Warn in case pitch value from simulator is out of limits

refs #790
This commit is contained in:
Roland Winklmeier
2016-11-04 01:41:03 +01:00
committed by Klaus Basan
parent eb58450e8c
commit ea561cf723
3 changed files with 14 additions and 4 deletions

View File

@@ -79,6 +79,7 @@ namespace BlackSimPlugin
FS_PBH pbhstrct;
pbhstrct.pbh = positionVelocity.pbh;
int pitch = pbhstrct.pitch / CFs9Sdk::pitchMultiplier();
if (pitch < -90 || pitch > 89) { CLogMessage(nullptr).warning("FS9: Pitch value out of limits: %1") << pitch; }
int bank = pbhstrct.bank / CFs9Sdk::bankMultiplier();
// MSFS has inverted pitch and bank angles

View File

@@ -357,13 +357,18 @@ namespace BlackSimPlugin
position.setGeodeticHeight(groundAltitude);
situation.setPosition(position);
// speeds, situation
const double angleCorrectionFactor = 360.0 / 65536.0 / 65536.0; // see FSUIPC docu
pitchRaw *= angleCorrectionFactor;
bankRaw *= angleCorrectionFactor;
// MSFS has inverted pitch and bank angles
pitchRaw = ~pitchRaw;
bankRaw = ~bankRaw;
const double angleCorrectionFactor = 360.0 / 65536.0 / 65536.0; // see FSUIPC docu
CAngle pitch = CAngle(pitchRaw * angleCorrectionFactor, CAngleUnit::deg());
CAngle bank = CAngle(bankRaw * angleCorrectionFactor, CAngleUnit::deg());
if (pitchRaw < -90 || pitchRaw > 89) { CLogMessage(this).warning("FSUIPC: Pitch value out of limits: %1") << pitchRaw; }
// speeds, situation
CAngle pitch = CAngle(pitchRaw, CAngleUnit::deg());
CAngle bank = CAngle(bankRaw, CAngleUnit::deg());
CHeading heading = CHeading(headingRaw * angleCorrectionFactor, CHeading::True, CAngleUnit::deg());
CSpeed groundspeed(groundspeedRaw / 65536.0, CSpeedUnit::m_s());
CAltitude altitude(altitudeRaw / (65536.0 * 65536.0), CAltitude::MeanSeaLevel, CLengthUnit::m());

View File

@@ -381,6 +381,10 @@ namespace BlackSimPlugin
position.setLatitude(CLatitude(simulatorOwnAircraft.latitude, CAngleUnit::deg()));
position.setLongitude(CLongitude(simulatorOwnAircraft.longitude, CAngleUnit::deg()));
if (simulatorOwnAircraft.pitch < -90.0 || simulatorOwnAircraft.pitch >= 90.0)
{
CLogMessage(this).warning("FSX: Pitch value out of limits: %1") << simulatorOwnAircraft.pitch;
}
BlackMisc::Aviation::CAircraftSituation aircraftSituation;
aircraftSituation.setPosition(position);
// MSFS has inverted pitch and bank angles