mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-20 04:25:42 +08:00
Issue #97 Read aircraft velocity and rotation from FSUIPC
This commit is contained in:
committed by
Mat Sutcliffe
parent
bdacb59b61
commit
bb70bcc79d
@@ -370,6 +370,8 @@ namespace BlackSimPlugin::FsCommon
|
|||||||
qint32 flapsControlRaw = 0, gearControlRaw = 0, spoilersControlRaw = 0;
|
qint32 flapsControlRaw = 0, gearControlRaw = 0, spoilersControlRaw = 0;
|
||||||
qint16 numberOfEngines = 0;
|
qint16 numberOfEngines = 0;
|
||||||
qint16 engine1CombustionFlag = 0, engine2CombustionFlag = 0, engine3CombustionFlag = 0, engine4CombustionFlag = 0;
|
qint16 engine1CombustionFlag = 0, engine2CombustionFlag = 0, engine3CombustionFlag = 0, engine4CombustionFlag = 0;
|
||||||
|
double velocityWorld[3];
|
||||||
|
double rotationVelocityBody[3];
|
||||||
|
|
||||||
// http://www.projectmagenta.com/all-fsuipc-offsets/
|
// http://www.projectmagenta.com/all-fsuipc-offsets/
|
||||||
// https://www.ivao.aero/softdev/ivap/fsuipc_sdk.asp
|
// https://www.ivao.aero/softdev/ivap/fsuipc_sdk.asp
|
||||||
@@ -423,6 +425,14 @@ namespace BlackSimPlugin::FsCommon
|
|||||||
(situationN || FSUIPC_Read(0x0580, 4, &headingRaw, &dwResult)) &&
|
(situationN || FSUIPC_Read(0x0580, 4, &headingRaw, &dwResult)) &&
|
||||||
(situationN || FSUIPC_Read(0x0570, 8, &altitudeRaw, &dwResult)) &&
|
(situationN || FSUIPC_Read(0x0570, 8, &altitudeRaw, &dwResult)) &&
|
||||||
|
|
||||||
|
(situationN || FSUIPC_Read(0x3198, 8, &velocityWorld[0], &dwResult)) &&
|
||||||
|
(situationN || FSUIPC_Read(0x31a0, 8, &velocityWorld[1], &dwResult)) &&
|
||||||
|
(situationN || FSUIPC_Read(0x3190, 8, &velocityWorld[2], &dwResult)) &&
|
||||||
|
|
||||||
|
(situationN || FSUIPC_Read(0x30A8, 8, &rotationVelocityBody[0], &dwResult)) &&
|
||||||
|
(situationN || FSUIPC_Read(0x30B0, 8, &rotationVelocityBody[1], &dwResult)) &&
|
||||||
|
(situationN || FSUIPC_Read(0x30B8, 8, &rotationVelocityBody[2], &dwResult)) &&
|
||||||
|
|
||||||
// Position
|
// Position
|
||||||
(situationN || FSUIPC_Read(0x0560, 8, &latitudeRaw, &dwResult)) &&
|
(situationN || FSUIPC_Read(0x0560, 8, &latitudeRaw, &dwResult)) &&
|
||||||
(situationN || FSUIPC_Read(0x0568, 8, &longitudeRaw, &dwResult)) &&
|
(situationN || FSUIPC_Read(0x0568, 8, &longitudeRaw, &dwResult)) &&
|
||||||
@@ -519,6 +529,8 @@ namespace BlackSimPlugin::FsCommon
|
|||||||
situation.setGroundSpeed(groundspeed);
|
situation.setGroundSpeed(groundspeed);
|
||||||
situation.setAltitude(altitude);
|
situation.setAltitude(altitude);
|
||||||
situation.setPressureAltitude(pressureAltitude);
|
situation.setPressureAltitude(pressureAltitude);
|
||||||
|
situation.setVelocity({velocityWorld[0], velocityWorld[1], velocityWorld[2], CSpeedUnit::ft_s(), rotationVelocityBody[0],
|
||||||
|
rotationVelocityBody[1], rotationVelocityBody[2], CAngleUnit::rad(), CTimeUnit::s()});
|
||||||
aircraft.setSituation(situation);
|
aircraft.setSituation(situation);
|
||||||
aircraft.setCG(altitude - groundAltitude); // calculate the CG
|
aircraft.setCG(altitude - groundAltitude); // calculate the CG
|
||||||
} // situation
|
} // situation
|
||||||
|
|||||||
Reference in New Issue
Block a user