1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-30 08:24:11 +01:00

GCS/Plugins/HiTL: Updated Xplane to provide correct measurements for all Stabilization and Guidance relevant data. Based on Export format for Xplane 9!

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@3107 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
corvus 2011-03-30 15:59:53 +00:00 committed by corvus
parent 282661734e
commit a4cbbfd016
4 changed files with 25 additions and 11 deletions

View File

@ -289,7 +289,7 @@ void IL2Simulator::processUpdate(const QByteArray& inp)
for (int t=0;t<3;t++) {
rawData.accels[t]=current.ddX*Rbe[t][0]
+current.ddY*Rbe[t][1]
+(current.ddZ+9.81)*Rbe[t][2];
+(current.ddZ+GEE)*Rbe[t][2];
}
rawData.accels[2]=-rawData.accels[2];

View File

@ -34,6 +34,7 @@
volatile bool Simulator::isStarted = false;
const float Simulator::GEE = 9.81;
const float Simulator::FT2M = 0.3048;
const float Simulator::KT2MPS = 0.514444444;
const float Simulator::INHG2KPA = 3.386;

View File

@ -156,6 +156,7 @@ private slots:
virtual void processUpdate(const QByteArray& data) = 0;
protected:
static const float GEE;
static const float FT2M;
static const float KT2MPS;
static const float INHG2KPA;

View File

@ -207,6 +207,9 @@ void XplaneSimulator::processUpdate(const QByteArray& dataBuf)
float dstX = 0;
float dstY = 0;
float dstZ = 0;
float accX = 0;
float accY = 0;
float accZ = 0;
float rollRate=0;
float pitchRate=0;
float yawRate=0;
@ -259,11 +262,11 @@ void XplaneSimulator::processUpdate(const QByteArray& dataBuf)
case XplaneSimulator::LocVelDistTraveled:
dstX = *((float*)(buf.data()+4*1));
dstY = *((float*)(buf.data()+4*2));
dstZ = *((float*)(buf.data()+4*3));
dstY = - *((float*)(buf.data()+4*3));
dstZ = *((float*)(buf.data()+4*2));
velX = *((float*)(buf.data()+4*4));
velY = *((float*)(buf.data()+4*5));
velZ = *((float*)(buf.data()+4*6));
velY = - *((float*)(buf.data()+4*6));
velZ = *((float*)(buf.data()+4*5));
break;
case XplaneSimulator::AngularVelocities:
@ -272,6 +275,12 @@ void XplaneSimulator::processUpdate(const QByteArray& dataBuf)
yawRate = *((float*)(buf.data()+4*3));
break;
case XplaneSimulator::Gload:
accX = *((float*)(buf.data()+4*6)) * GEE;
accY = *((float*)(buf.data()+4*7)) * GEE;
accZ = *((float*)(buf.data()+4*5)) * GEE;
break;
default:
break;
}
@ -353,17 +362,17 @@ void XplaneSimulator::processUpdate(const QByteArray& dataBuf)
// Update VelocityActual.{Nort,East,Down}
VelocityActual::DataFields velocityActualData;
memset(&velocityActualData, 0, sizeof(VelocityActual::DataFields));
velocityActualData.North = velX*100;
velocityActualData.East = velY*100;
velocityActualData.Down = velZ*100;
velocityActualData.North = velY*100;
velocityActualData.East = velX*100;
velocityActualData.Down = -velZ*100;
velActual->setData(velocityActualData);
// Update PositionActual.{Nort,East,Down}
PositionActual::DataFields positionActualData;
memset(&positionActualData, 0, sizeof(PositionActual::DataFields));
positionActualData.North = (dstX-initX)*100;
positionActualData.East = (dstY-initY)*100;
positionActualData.Down = (dstZ-initZ)*100;
positionActualData.North = (dstY-initY)*100;
positionActualData.East = (dstX-initX)*100;
positionActualData.Down = -(dstZ-initZ)*100;
posActual->setData(positionActualData);
// Update AttitudeRaw object (filtered gyros only for now)
@ -375,6 +384,9 @@ void XplaneSimulator::processUpdate(const QByteArray& dataBuf)
//rawData.gyros_filtered[2] = cos(DEG2RAD * roll) * yawRate - sin(DEG2RAD * roll) * pitchRate;
rawData.gyros[1] = pitchRate;
rawData.gyros[2] = yawRate;
rawData.accels[0] = accX;
rawData.accels[1] = accY;
rawData.accels[2] = -accZ;
attRaw->setData(rawData);