1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-17 02:52:12 +01:00

Ground: Updated Hitl plugin and FlightGear to provide PositionActual.

Currently the only value that works is PositionActual.Down wich is mapped to the altitude.
PositionActual.North and PositionActual.East are hardcoded to zero.
Also defined M_PI as it said it was no defined.


git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1924 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
darkz 2010-10-09 08:52:19 +00:00 committed by darkz
parent 6e34b78b85
commit 9a90a124fd
3 changed files with 15 additions and 0 deletions

View File

@ -30,6 +30,10 @@
#include "coreplugin/icore.h"
#include "coreplugin/threadmanager.h"
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
const float FGSimulator::FT2M = 0.3048;
const float FGSimulator::KT2MPS = 0.514444444;
const float FGSimulator::INHG2KPA = 3.386;
@ -215,6 +219,14 @@ void FGSimulator::processUpdate(const QByteArray& inp)
velocityActualData.Down = velocityActualDown;
velActual->setData(velocityActualData);
// Update PositionActual.{Nort,East,Down}
PositionActual::DataFields positionActualData;
memset(&positionActualData, 0, sizeof(PositionActual::DataFields));
positionActualData.North = 0; //Currently hardcoded as there is no way of setting up a reference point to calculate distance
positionActualData.East = 0; //Currently hardcoded as there is no way of setting up a reference point to calculate distance
positionActualData.Down = (altitude * 100); //Multiply by 100 because positionActual expects input in Centimeters.
posActual->setData(positionActualData);
// Update AltitudeActual object
BaroAltitude::DataFields altActualData;
memset(&altActualData, 0, sizeof(BaroAltitude::DataFields));

View File

@ -117,6 +117,7 @@ void Simulator::onStart()
UAVObjectManager* objManager = pm->getObject<UAVObjectManager>();
actDesired = ActuatorDesired::GetInstance(objManager);
velActual = VelocityActual::GetInstance(objManager);
posActual = PositionActual::GetInstance(objManager);
altActual = BaroAltitude::GetInstance(objManager);
attActual = AttitudeActual::GetInstance(objManager);
gpsPos = GPSPosition::GetInstance(objManager);

View File

@ -37,6 +37,7 @@
#include "uavobjects/uavobjectmanager.h"
#include "uavobjects/actuatordesired.h"
// #include "uavobjects/altitudeactual.h"
#include "uavobjects/positionactual.h"
#include "uavobjects/velocityactual.h"
#include "uavobjects/baroaltitude.h"
#include "uavobjects/attitudeactual.h"
@ -147,6 +148,7 @@ protected:
BaroAltitude* altActual;
AttitudeActual* attActual;
VelocityActual* velActual;
PositionActual* posActual;
GPSPosition* gpsPos;
GCSTelemetryStats* telStats;