mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-20 10:54:14 +01:00
Remove old HITLs,
and replace with new HITL plugin git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1479 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
4f246c64ca
commit
94ee367d21
@ -1,12 +0,0 @@
|
||||
<plugin name="HITL" version="1.0.0" compatVersion="1.0.0">
|
||||
<vendor>The OpenPilot Project</vendor>
|
||||
<copyright>(C) 2010 OpenPilot Project</copyright>
|
||||
<license>The GNU Public License (GPL) Version 3</license>
|
||||
<description>Hardware In The Loop Simulation</description>
|
||||
<url>http://www.openpilot.org</url>
|
||||
<dependencyList>
|
||||
<dependency name="Core" version="1.0.0"/>
|
||||
<dependency name="UAVObjects" version="1.0.0"/>
|
||||
<dependency name="UAVTalk" version="1.0.0"/>
|
||||
</dependencyList>
|
||||
</plugin>
|
@ -1,311 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file flightgearbridge.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
* @addtogroup HITLPlugin HITL Plugin
|
||||
* @{
|
||||
* @brief The Hardware In The Loop plugin
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "flightgearbridge.h"
|
||||
#include "extensionsystem/pluginmanager.h"
|
||||
#include "coreplugin/icore.h"
|
||||
#include "coreplugin/threadmanager.h"
|
||||
|
||||
const float FlightGearBridge::FT2M = 0.3048;
|
||||
const float FlightGearBridge::KT2MPS = 0.514444444;
|
||||
const float FlightGearBridge::INHG2KPA = 3.386;
|
||||
|
||||
FlightGearBridge::FlightGearBridge()
|
||||
{
|
||||
// move to thread
|
||||
moveToThread(Core::ICore::instance()->threadManager()->getRealTimeThread());
|
||||
|
||||
connect(this, SIGNAL(myStart()), this, SLOT(onStart()),Qt::QueuedConnection);
|
||||
emit myStart();
|
||||
|
||||
}
|
||||
|
||||
void FlightGearBridge::onStart()
|
||||
{
|
||||
|
||||
// Init fields
|
||||
fgHost = QHostAddress("127.0.0.1");
|
||||
inPort = 5500;
|
||||
outPort = 5501;
|
||||
updatePeriod = 50;
|
||||
fgTimeout = 2000;
|
||||
autopilotConnectionStatus = false;
|
||||
fgConnectionStatus = false;
|
||||
|
||||
// Get required UAVObjects
|
||||
ExtensionSystem::PluginManager* pm = ExtensionSystem::PluginManager::instance();
|
||||
UAVObjectManager* objManager = pm->getObject<UAVObjectManager>();
|
||||
actDesired = ActuatorDesired::GetInstance(objManager);
|
||||
baroAltitude = BaroAltitude::GetInstance(objManager);
|
||||
attActual = AttitudeActual::GetInstance(objManager);
|
||||
posActual = PositionActual::GetInstance(objManager);
|
||||
telStats = GCSTelemetryStats::GetInstance(objManager);
|
||||
|
||||
// Listen to autopilot connection events
|
||||
TelemetryManager* telMngr = pm->getObject<TelemetryManager>();
|
||||
connect(telMngr, SIGNAL(connected()), this, SLOT(onAutopilotConnect()));
|
||||
connect(telMngr, SIGNAL(disconnected()), this, SLOT(onAutopilotDisconnect()));
|
||||
//connect(telStats, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(telStatsUpdated(UAVObject*)));
|
||||
|
||||
// If already connect setup autopilot
|
||||
GCSTelemetryStats::DataFields stats = telStats->getData();
|
||||
if ( stats.Status == GCSTelemetryStats::STATUS_CONNECTED )
|
||||
{
|
||||
onAutopilotConnect();
|
||||
}
|
||||
|
||||
// Setup local ports
|
||||
inSocket = new QUdpSocket();
|
||||
outSocket = new QUdpSocket();
|
||||
inSocket->bind(QHostAddress::Any, inPort);
|
||||
connect(inSocket, SIGNAL(readyRead()), this, SLOT(receiveUpdate()),Qt::DirectConnection);
|
||||
|
||||
// Setup transmit timer
|
||||
txTimer = new QTimer();
|
||||
connect(txTimer, SIGNAL(timeout()), this, SLOT(transmitUpdate()),Qt::DirectConnection);
|
||||
txTimer->setInterval(updatePeriod);
|
||||
txTimer->start();
|
||||
|
||||
// Setup FG connection timer
|
||||
fgTimer = new QTimer();
|
||||
connect(fgTimer, SIGNAL(timeout()), this, SLOT(onFGConnectionTimeout()),Qt::DirectConnection);
|
||||
fgTimer->setInterval(fgTimeout);
|
||||
fgTimer->start();
|
||||
|
||||
}
|
||||
|
||||
FlightGearBridge::~FlightGearBridge()
|
||||
{
|
||||
delete inSocket;
|
||||
delete outSocket;
|
||||
delete txTimer;
|
||||
delete fgTimer;
|
||||
}
|
||||
|
||||
bool FlightGearBridge::isAutopilotConnected()
|
||||
{
|
||||
return autopilotConnectionStatus;
|
||||
}
|
||||
|
||||
bool FlightGearBridge::isFGConnected()
|
||||
{
|
||||
return fgConnectionStatus;
|
||||
}
|
||||
|
||||
void FlightGearBridge::transmitUpdate()
|
||||
{
|
||||
// Read ActuatorDesired from autopilot
|
||||
ActuatorDesired::DataFields actData = actDesired->getData();
|
||||
float ailerons = actData.Roll;
|
||||
float elevator = -actData.Pitch;
|
||||
float rudder = actData.Yaw;
|
||||
float throttle = actData.Throttle;
|
||||
|
||||
// Send update to FlightGear
|
||||
QString cmd;
|
||||
cmd = QString("%1,%2,%3,%4\n")
|
||||
.arg(ailerons)
|
||||
.arg(elevator)
|
||||
.arg(rudder)
|
||||
.arg(throttle);
|
||||
QByteArray data = cmd.toAscii();
|
||||
outSocket->writeDatagram(data, fgHost, outPort);
|
||||
}
|
||||
|
||||
void FlightGearBridge::receiveUpdate()
|
||||
{
|
||||
// Update connection timer and status
|
||||
fgTimer->setInterval(fgTimeout);
|
||||
fgTimer->stop();
|
||||
fgTimer->start();
|
||||
if ( !fgConnectionStatus )
|
||||
{
|
||||
fgConnectionStatus = true;
|
||||
emit fgConnected();
|
||||
}
|
||||
|
||||
// Process data
|
||||
while ( inSocket->bytesAvailable() > 0 )
|
||||
{
|
||||
// Receive datagram
|
||||
QByteArray datagram;
|
||||
datagram.resize(inSocket->pendingDatagramSize());
|
||||
QHostAddress sender;
|
||||
quint16 senderPort;
|
||||
inSocket->readDatagram(datagram.data(), datagram.size(),
|
||||
&sender, &senderPort);
|
||||
QString datastr(datagram);
|
||||
// Process incomming data
|
||||
processUpdate(datastr);
|
||||
}
|
||||
}
|
||||
|
||||
void FlightGearBridge::setupObjects()
|
||||
{
|
||||
setupInputObject(actDesired, 75);
|
||||
setupOutputObject(baroAltitude, 250);
|
||||
setupOutputObject(attActual, 75);
|
||||
setupOutputObject(posActual, 250);
|
||||
}
|
||||
|
||||
void FlightGearBridge::setupInputObject(UAVObject* obj, int updatePeriod)
|
||||
{
|
||||
UAVObject::Metadata mdata;
|
||||
mdata = obj->getDefaultMetadata();
|
||||
mdata.flightAccess = UAVObject::ACCESS_READWRITE;
|
||||
mdata.gcsAccess = UAVObject::ACCESS_READWRITE;
|
||||
mdata.flightTelemetryAcked = false;
|
||||
mdata.flightTelemetryUpdateMode = UAVObject::UPDATEMODE_PERIODIC;
|
||||
mdata.flightTelemetryUpdatePeriod = updatePeriod;
|
||||
mdata.gcsTelemetryUpdateMode = UAVObject::UPDATEMODE_MANUAL;
|
||||
obj->setMetadata(mdata);
|
||||
}
|
||||
|
||||
void FlightGearBridge::setupOutputObject(UAVObject* obj, int updatePeriod)
|
||||
{
|
||||
UAVObject::Metadata mdata;
|
||||
mdata = obj->getDefaultMetadata();
|
||||
mdata.flightAccess = UAVObject::ACCESS_READONLY;
|
||||
mdata.gcsAccess = UAVObject::ACCESS_READWRITE;
|
||||
mdata.flightTelemetryUpdateMode = UAVObject::UPDATEMODE_NEVER;
|
||||
mdata.gcsTelemetryAcked = false;
|
||||
mdata.gcsTelemetryUpdateMode = UAVObject::UPDATEMODE_PERIODIC;
|
||||
mdata.gcsTelemetryUpdatePeriod = updatePeriod;
|
||||
obj->setMetadata(mdata);
|
||||
}
|
||||
|
||||
void FlightGearBridge::onAutopilotConnect()
|
||||
{
|
||||
autopilotConnectionStatus = true;
|
||||
setupObjects();
|
||||
emit autopilotConnected();
|
||||
}
|
||||
|
||||
void FlightGearBridge::onAutopilotDisconnect()
|
||||
{
|
||||
autopilotConnectionStatus = false;
|
||||
emit autopilotDisconnected();
|
||||
}
|
||||
|
||||
void FlightGearBridge::onFGConnectionTimeout()
|
||||
{
|
||||
if ( fgConnectionStatus )
|
||||
{
|
||||
fgConnectionStatus = false;
|
||||
emit fgDisconnected();
|
||||
}
|
||||
}
|
||||
|
||||
void FlightGearBridge::processUpdate(QString& data)
|
||||
{
|
||||
// Split
|
||||
QStringList fields = data.split(",");
|
||||
// Get xRate (deg/s)
|
||||
float xRate = fields[0].toFloat() * 180.0/M_PI;
|
||||
// Get yRate (deg/s)
|
||||
float yRate = fields[1].toFloat() * 180.0/M_PI;
|
||||
// Get zRate (deg/s)
|
||||
float zRate = fields[2].toFloat() * 180.0/M_PI;
|
||||
// Get xAccel (m/s^2)
|
||||
float xAccel = fields[3].toFloat() * FT2M;
|
||||
// Get yAccel (m/s^2)
|
||||
float yAccel = fields[4].toFloat() * FT2M;
|
||||
// Get xAccel (m/s^2)
|
||||
float zAccel = fields[5].toFloat() * FT2M;
|
||||
// Get pitch (deg)
|
||||
float pitch = fields[6].toFloat();
|
||||
// Get pitchRate (deg/s)
|
||||
float pitchRate = fields[7].toFloat();
|
||||
// Get roll (deg)
|
||||
float roll = fields[8].toFloat();
|
||||
// Get rollRate (deg/s)
|
||||
float rollRate = fields[9].toFloat();
|
||||
// Get yaw (deg)
|
||||
float yaw = fields[10].toFloat();
|
||||
// Get yawRate (deg/s)
|
||||
float yawRate = fields[11].toFloat();
|
||||
// Get latitude (deg)
|
||||
float latitude = fields[12].toFloat();
|
||||
// Get longitude (deg)
|
||||
float longitude = fields[13].toFloat();
|
||||
// Get heading (deg)
|
||||
float heading = fields[14].toFloat();
|
||||
// Get altitude (m)
|
||||
float altitude = fields[15].toFloat() * FT2M;
|
||||
// Get altitudeAGL (m)
|
||||
float altitudeAGL = fields[16].toFloat() * FT2M;
|
||||
// Get groundspeed (m/s)
|
||||
float groundspeed = fields[17].toFloat() * KT2MPS;
|
||||
// Get airspeed (m/s)
|
||||
float airspeed = fields[18].toFloat() * KT2MPS;
|
||||
// Get temperature (degC)
|
||||
float temperature = fields[19].toFloat();
|
||||
// Get pressure (kpa)
|
||||
float pressure = fields[20].toFloat() * INHG2KPA;
|
||||
|
||||
// Update BaroAltitude object
|
||||
BaroAltitude::DataFields baroAltitudeData;
|
||||
baroAltitudeData.Altitude = altitudeAGL;
|
||||
baroAltitudeData.Temperature = temperature;
|
||||
baroAltitudeData.Pressure = pressure;
|
||||
baroAltitude->setData(baroAltitudeData);
|
||||
|
||||
// Update attActual object
|
||||
AttitudeActual::DataFields attActualData;
|
||||
attActualData.Roll = roll;
|
||||
attActualData.Pitch = pitch;
|
||||
attActualData.Yaw = yaw;
|
||||
attActualData.q1 = 0;
|
||||
attActualData.q2 = 0;
|
||||
attActualData.q3 = 0;
|
||||
attActualData.q4 = 0;
|
||||
attActual->setData(attActualData);
|
||||
|
||||
// Update gps objects
|
||||
PositionActual::DataFields gpsData;
|
||||
gpsData.Altitude = altitude;
|
||||
gpsData.Heading = heading;
|
||||
gpsData.Groundspeed = groundspeed;
|
||||
gpsData.Latitude = latitude;
|
||||
gpsData.Longitude = longitude;
|
||||
gpsData.Satellites = 10;
|
||||
gpsData.Status = PositionActual::STATUS_FIX3D;
|
||||
posActual->setData(gpsData);
|
||||
}
|
||||
|
||||
void FlightGearBridge::telStatsUpdated(UAVObject* obj)
|
||||
{
|
||||
GCSTelemetryStats::DataFields stats = telStats->getData();
|
||||
if ( !autopilotConnectionStatus && stats.Status == GCSTelemetryStats::STATUS_CONNECTED )
|
||||
{
|
||||
onAutopilotConnect();
|
||||
}
|
||||
else if ( autopilotConnectionStatus && stats.Status != GCSTelemetryStats::STATUS_CONNECTED )
|
||||
{
|
||||
onAutopilotDisconnect();
|
||||
}
|
||||
}
|
@ -1,98 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file flightgearbridge.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
* @addtogroup HITLPlugin HITL Plugin
|
||||
* @{
|
||||
* @brief The Hardware In The Loop plugin
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef FLIGHTGEARBRIDGE_H
|
||||
#define FLIGHTGEARBRIDGE_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QUdpSocket>
|
||||
#include <QTimer>
|
||||
#include <math.h>
|
||||
#include "uavtalk/telemetrymanager.h"
|
||||
#include "uavobjects/uavobjectmanager.h"
|
||||
#include "uavobjects/actuatordesired.h"
|
||||
#include "uavobjects/baroaltitude.h"
|
||||
#include "uavobjects/attitudeactual.h"
|
||||
#include "uavobjects/positionactual.h"
|
||||
#include "uavobjects/gcstelemetrystats.h"
|
||||
|
||||
class FlightGearBridge: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FlightGearBridge();
|
||||
~FlightGearBridge();
|
||||
|
||||
bool isAutopilotConnected();
|
||||
bool isFGConnected();
|
||||
|
||||
signals:
|
||||
void myStart();
|
||||
void autopilotConnected();
|
||||
void autopilotDisconnected();
|
||||
void fgConnected();
|
||||
void fgDisconnected();
|
||||
|
||||
private slots:
|
||||
void onStart();
|
||||
void transmitUpdate();
|
||||
void receiveUpdate();
|
||||
void onAutopilotConnect();
|
||||
void onAutopilotDisconnect();
|
||||
void onFGConnectionTimeout();
|
||||
void telStatsUpdated(UAVObject* obj);
|
||||
|
||||
private:
|
||||
static const float FT2M;
|
||||
static const float KT2MPS;
|
||||
static const float INHG2KPA;
|
||||
|
||||
QUdpSocket* inSocket;
|
||||
QUdpSocket* outSocket;
|
||||
ActuatorDesired* actDesired;
|
||||
BaroAltitude* baroAltitude;
|
||||
AttitudeActual* attActual;
|
||||
PositionActual* posActual;
|
||||
GCSTelemetryStats* telStats;
|
||||
QHostAddress fgHost;
|
||||
int inPort;
|
||||
int outPort;
|
||||
int updatePeriod;
|
||||
QTimer* txTimer;
|
||||
QTimer* fgTimer;
|
||||
bool autopilotConnectionStatus;
|
||||
bool fgConnectionStatus;
|
||||
int fgTimeout;
|
||||
|
||||
void processUpdate(QString& data);
|
||||
void setupOutputObject(UAVObject* obj, int updatePeriod);
|
||||
void setupInputObject(UAVObject* obj, int updatePeriod);
|
||||
void setupObjects();
|
||||
};
|
||||
|
||||
#endif // FLIGHTGEARBRIDGE_H
|
@ -1,49 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file hitl.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
* @addtogroup HITLPlugin HITL Plugin
|
||||
* @{
|
||||
* @brief The Hardware In The Loop plugin
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include "hitl.h"
|
||||
#include "hitlwidget.h"
|
||||
#include "hitlconfiguration.h"
|
||||
|
||||
HITL::HITL(QString classId, HITLWidget *widget, QWidget *parent) :
|
||||
IUAVGadget(classId, parent),
|
||||
m_widget(widget)
|
||||
{
|
||||
}
|
||||
|
||||
HITL::~HITL()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void HITL::loadConfiguration(IUAVGadgetConfiguration* config)
|
||||
{
|
||||
HITLConfiguration *m = qobject_cast<HITLConfiguration*>(config);
|
||||
m_widget->setFGPathBin( m->fgPathBin() );
|
||||
m_widget->setFGPathData( m->fgPathData() );
|
||||
m_widget->setFGManualControl( m->fgManualControl() );
|
||||
}
|
||||
|
@ -1,56 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file hitl.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
* @addtogroup HITLPlugin HITL Plugin
|
||||
* @{
|
||||
* @brief The Hardware In The Loop plugin
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef HITL_H
|
||||
#define HITL_H
|
||||
|
||||
#include <coreplugin/iuavgadget.h>
|
||||
#include "hitlwidget.h"
|
||||
|
||||
class IUAVGadget;
|
||||
class QWidget;
|
||||
class QString;
|
||||
class HITLWidget;
|
||||
|
||||
using namespace Core;
|
||||
|
||||
class HITL : public Core::IUAVGadget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
HITL(QString classId, HITLWidget *widget, QWidget *parent = 0);
|
||||
~HITL();
|
||||
|
||||
QWidget *widget() { return m_widget; }
|
||||
void loadConfiguration(IUAVGadgetConfiguration* config);
|
||||
|
||||
private:
|
||||
HITLWidget *m_widget;
|
||||
};
|
||||
|
||||
|
||||
#endif // HITL_H
|
@ -1,23 +0,0 @@
|
||||
TEMPLATE = lib
|
||||
TARGET = HITL
|
||||
QT += network
|
||||
include(../../openpilotgcsplugin.pri)
|
||||
include(hitl_dependencies.pri)
|
||||
HEADERS += hitlplugin.h \
|
||||
hitlwidget.h \
|
||||
hitloptionspage.h \
|
||||
hitlfactory.h \
|
||||
hitlconfiguration.h \
|
||||
hitl.h \
|
||||
flightgearbridge.h
|
||||
SOURCES += hitlplugin.cpp \
|
||||
hitlwidget.cpp \
|
||||
hitloptionspage.cpp \
|
||||
hitlfactory.cpp \
|
||||
hitlconfiguration.cpp \
|
||||
hitl.cpp \
|
||||
flightgearbridge.cpp
|
||||
OTHER_FILES += HITL.pluginspec
|
||||
FORMS += hitloptionspage.ui \
|
||||
hitlwidget.ui
|
||||
RESOURCES += hitlresources.qrc
|
@ -1,4 +0,0 @@
|
||||
include(../../plugins/uavobjects/uavobjects.pri)
|
||||
include(../../plugins/uavtalk/uavtalk.pri)
|
||||
include(../../plugins/coreplugin/coreplugin.pri)
|
||||
include(../../libs/utils/utils.pri)
|
@ -1,67 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file hitlconfiguration.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
* @addtogroup HITLPlugin HITL Plugin
|
||||
* @{
|
||||
* @brief The Hardware In The Loop plugin
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "hitlconfiguration.h"
|
||||
#include <QtCore/QDataStream>
|
||||
|
||||
HITLConfiguration::HITLConfiguration(QString classId, const QByteArray &state, QObject *parent) :
|
||||
IUAVGadgetConfiguration(classId, parent),
|
||||
m_fgPathBin(""), m_fgPathData(""), m_fgManualControl(false)
|
||||
{
|
||||
if (state.count() > 0) {
|
||||
QDataStream stream(state);
|
||||
QString fgPathBin;
|
||||
QString fgPathData;
|
||||
bool fgManualControl;
|
||||
stream >> fgPathBin;
|
||||
m_fgPathBin = fgPathBin;
|
||||
stream >> fgPathData;
|
||||
m_fgPathData = fgPathData;
|
||||
stream >> fgManualControl;
|
||||
m_fgManualControl = fgManualControl;
|
||||
}
|
||||
}
|
||||
|
||||
IUAVGadgetConfiguration *HITLConfiguration::clone()
|
||||
{
|
||||
HITLConfiguration *m = new HITLConfiguration(this->classId());
|
||||
m->m_fgPathBin = m_fgPathBin;
|
||||
m->m_fgPathData = m_fgPathData;
|
||||
m->m_fgManualControl = m_fgManualControl;
|
||||
return m;
|
||||
}
|
||||
|
||||
QByteArray HITLConfiguration::saveState() const
|
||||
{
|
||||
QByteArray bytes;
|
||||
QDataStream stream(&bytes, QIODevice::WriteOnly);
|
||||
stream << m_fgPathBin;
|
||||
stream << m_fgPathData;
|
||||
stream << m_fgManualControl;
|
||||
return bytes;
|
||||
}
|
||||
|
@ -1,68 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file hitlconfiguration.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
* @addtogroup HITLPlugin HITL Plugin
|
||||
* @{
|
||||
* @brief The Hardware In The Loop plugin
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef HITLCONFIGURATION_H
|
||||
#define HITLCONFIGURATION_H
|
||||
|
||||
#include <coreplugin/iuavgadgetconfiguration.h>
|
||||
#include <QtGui/QColor>
|
||||
#include <QString>
|
||||
|
||||
using namespace Core;
|
||||
|
||||
class HITLConfiguration : public IUAVGadgetConfiguration
|
||||
{
|
||||
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString m_fgPathBin READ fgPathBin WRITE setFGPathBin)
|
||||
Q_PROPERTY(QString m_fgPathData READ fgPathData WRITE setFGPathData)
|
||||
Q_PROPERTY(bool m_fgManualControl READ fgManualControl WRITE setFGManualControl)
|
||||
|
||||
public:
|
||||
explicit HITLConfiguration(QString classId, const QByteArray &state = 0, QObject *parent = 0);
|
||||
QByteArray saveState() const;
|
||||
IUAVGadgetConfiguration *clone();
|
||||
|
||||
QString fgPathBin() const { return m_fgPathBin; }
|
||||
QString fgPathData() const { return m_fgPathData; }
|
||||
bool fgManualControl() const { return m_fgManualControl; }
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
void setFGPathBin(QString fgPath) { m_fgPathBin = fgPath; }
|
||||
void setFGPathData(QString fgPath) { m_fgPathData = fgPath; }
|
||||
void setFGManualControl(bool val) { m_fgManualControl = val; }
|
||||
|
||||
private:
|
||||
QString m_fgPathBin;
|
||||
QString m_fgPathData;
|
||||
bool m_fgManualControl;
|
||||
|
||||
};
|
||||
|
||||
#endif // HITLCONFIGURATION_H
|
@ -1,58 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file hitlfactory.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
* @addtogroup HITLPlugin HITL Plugin
|
||||
* @{
|
||||
* @brief The Hardware In The Loop plugin
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include "hitlfactory.h"
|
||||
#include "hitlwidget.h"
|
||||
#include "hitl.h"
|
||||
#include "hitlconfiguration.h"
|
||||
#include "hitloptionspage.h"
|
||||
#include <coreplugin/iuavgadget.h>
|
||||
|
||||
HITLFactory::HITLFactory(QObject *parent) :
|
||||
IUAVGadgetFactory(QString("HITL"), tr("HITL Simulation"), parent)
|
||||
{
|
||||
}
|
||||
|
||||
HITLFactory::~HITLFactory()
|
||||
{
|
||||
}
|
||||
|
||||
Core::IUAVGadget* HITLFactory::createGadget(QWidget *parent)
|
||||
{
|
||||
HITLWidget* gadgetWidget = new HITLWidget(parent);
|
||||
return new HITL(QString("HITL"), gadgetWidget, parent);
|
||||
}
|
||||
|
||||
IUAVGadgetConfiguration *HITLFactory::createConfiguration(const QByteArray &state)
|
||||
{
|
||||
return new HITLConfiguration(QString("HITL"), state);
|
||||
}
|
||||
|
||||
IOptionsPage *HITLFactory::createOptionsPage(IUAVGadgetConfiguration *config)
|
||||
{
|
||||
return new HITLOptionsPage(qobject_cast<HITLConfiguration*>(config));
|
||||
}
|
||||
|
@ -1,52 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file hitlfactory.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
* @addtogroup HITLPlugin HITL Plugin
|
||||
* @{
|
||||
* @brief The Hardware In The Loop plugin
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef HITLFACTORY_H
|
||||
#define HITLFACTORY_H
|
||||
|
||||
#include <coreplugin/iuavgadgetfactory.h>
|
||||
|
||||
namespace Core {
|
||||
class IUAVGadget;
|
||||
class IUAVGadgetFactory;
|
||||
}
|
||||
|
||||
using namespace Core;
|
||||
|
||||
class HITLFactory : public Core::IUAVGadgetFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
HITLFactory(QObject *parent = 0);
|
||||
~HITLFactory();
|
||||
|
||||
Core::IUAVGadget *createGadget(QWidget *parent);
|
||||
IUAVGadgetConfiguration *createConfiguration(const QByteArray &state);
|
||||
IOptionsPage *createOptionsPage(IUAVGadgetConfiguration *config);
|
||||
};
|
||||
|
||||
#endif // HITLFACTORY_H
|
@ -1,73 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file hitloptionspage.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
* @addtogroup HITLPlugin HITL Plugin
|
||||
* @{
|
||||
* @brief The Hardware In The Loop plugin
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "hitloptionspage.h"
|
||||
#include "hitlconfiguration.h"
|
||||
#include "ui_hitloptionspage.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QtAlgorithms>
|
||||
#include <QStringList>
|
||||
|
||||
HITLOptionsPage::HITLOptionsPage(HITLConfiguration *config, QObject *parent) :
|
||||
IOptionsPage(parent),
|
||||
m_config(config)
|
||||
{
|
||||
}
|
||||
|
||||
QWidget *HITLOptionsPage::createPage(QWidget *parent)
|
||||
{
|
||||
// Create page
|
||||
m_optionsPage = new Ui::HITLOptionsPage();
|
||||
QWidget* optionsPageWidget = new QWidget;
|
||||
m_optionsPage->setupUi(optionsPageWidget);
|
||||
|
||||
m_optionsPage->executablePathChooser->setExpectedKind(Utils::PathChooser::File);
|
||||
m_optionsPage->executablePathChooser->setPromptDialogTitle(tr("Choose FlightGear executable"));
|
||||
m_optionsPage->dataDirectoryPathChooser->setExpectedKind(Utils::PathChooser::Directory);
|
||||
m_optionsPage->dataDirectoryPathChooser->setPromptDialogTitle(tr("Choose FlightGear data directory"));
|
||||
|
||||
// Restore the contents from the settings:
|
||||
m_optionsPage->executablePathChooser->setPath(m_config->fgPathBin());
|
||||
m_optionsPage->dataDirectoryPathChooser->setPath(m_config->fgPathData());
|
||||
m_optionsPage->fgManualControl->setChecked(m_config->fgManualControl());
|
||||
|
||||
|
||||
return optionsPageWidget;
|
||||
}
|
||||
|
||||
void HITLOptionsPage::apply()
|
||||
{
|
||||
m_config->setFGPathBin( m_optionsPage->executablePathChooser->path());
|
||||
m_config->setFGPathData( m_optionsPage->dataDirectoryPathChooser->path());
|
||||
m_config->setFGManualControl( m_optionsPage->fgManualControl->isChecked());
|
||||
}
|
||||
|
||||
void HITLOptionsPage::finish()
|
||||
{
|
||||
delete m_optionsPage;
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file hitloptionspage.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
* @addtogroup HITLPlugin HITL Plugin
|
||||
* @{
|
||||
* @brief The Hardware In The Loop plugin
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef HITLOPTIONSPAGE_H
|
||||
#define HITLOPTIONSPAGE_H
|
||||
|
||||
#include "coreplugin/dialogs/ioptionspage.h"
|
||||
|
||||
namespace Core {
|
||||
class IUAVGadgetConfiguration;
|
||||
}
|
||||
|
||||
class HITLConfiguration;
|
||||
|
||||
using namespace Core;
|
||||
|
||||
namespace Ui {
|
||||
class HITLOptionsPage;
|
||||
}
|
||||
|
||||
class HITLOptionsPage : public IOptionsPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit HITLOptionsPage(HITLConfiguration *config, QObject *parent = 0);
|
||||
|
||||
QWidget *createPage(QWidget *parent);
|
||||
void apply();
|
||||
void finish();
|
||||
|
||||
signals:
|
||||
|
||||
private slots:
|
||||
|
||||
private:
|
||||
HITLConfiguration* m_config;
|
||||
Ui::HITLOptionsPage* m_optionsPage;
|
||||
|
||||
};
|
||||
|
||||
#endif // HITLOPTIONSPAGE_H
|
@ -1,106 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>HITLOptionsPage</class>
|
||||
<widget class="QWidget" name="HITLOptionsPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>320</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>FlightGear executable:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>FlightGear data directory:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="Utils::PathChooser" name="executablePathChooser" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="Utils::PathChooser" name="dataDirectoryPathChooser" native="true"/>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QCheckBox" name="fgManualControl">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Manual aircraft control (can be used when hardware is not available)</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Manual aircraft control (can be used when hardware is not available)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>182</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>Utils::PathChooser</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>utils/pathchooser.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -1,63 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file mapplugin.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
* @addtogroup HITLPlugin HITL Plugin
|
||||
* @{
|
||||
* @brief The Hardware In The Loop plugin
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include "hitlplugin.h"
|
||||
#include "hitlfactory.h"
|
||||
#include <QtPlugin>
|
||||
#include <QStringList>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
|
||||
HITLPlugin::HITLPlugin()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
HITLPlugin::~HITLPlugin()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
bool HITLPlugin::initialize(const QStringList& args, QString *errMsg)
|
||||
{
|
||||
Q_UNUSED(args);
|
||||
Q_UNUSED(errMsg);
|
||||
mf = new HITLFactory(this);
|
||||
addAutoReleasedObject(mf);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void HITLPlugin::extensionsInitialized()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
void HITLPlugin::shutdown()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
Q_EXPORT_PLUGIN(HITLPlugin)
|
||||
|
@ -1,47 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file browserplugin.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
* @addtogroup HITLPlugin HITL Plugin
|
||||
* @{
|
||||
* @brief The Hardware In The Loop plugin
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef HITLPLUGIN_H
|
||||
#define HITLPLUGIN_H
|
||||
|
||||
#include <extensionsystem/iplugin.h>
|
||||
|
||||
class HITLFactory;
|
||||
|
||||
class HITLPlugin : public ExtensionSystem::IPlugin
|
||||
{
|
||||
public:
|
||||
HITLPlugin();
|
||||
~HITLPlugin();
|
||||
|
||||
void extensionsInitialized();
|
||||
bool initialize(const QStringList & arguments, QString * errorString);
|
||||
void shutdown();
|
||||
private:
|
||||
HITLFactory *mf;
|
||||
};
|
||||
#endif /* HITLPLUGIN_H */
|
@ -1,5 +0,0 @@
|
||||
<RCC>
|
||||
<qresource prefix="/flightgear/genericprotocol">
|
||||
<file>opfgprotocol.xml</file>
|
||||
</qresource>
|
||||
</RCC>
|
@ -1,209 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file hitlwidget.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
* @addtogroup HITLPlugin HITL Plugin
|
||||
* @{
|
||||
* @brief The Hardware In The Loop plugin
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include "hitlwidget.h"
|
||||
#include "ui_hitlwidget.h"
|
||||
#include "qxtlogger.h"
|
||||
#include <QDebug>
|
||||
#include "uavobjects/uavobjectmanager.h"
|
||||
#include <QFile>
|
||||
#include <QDir>
|
||||
|
||||
HITLWidget::HITLWidget(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
// Note: Only tested on windows 7
|
||||
#if defined(Q_WS_WIN)
|
||||
cmdShell = QString("c:/windows/system32/cmd.exe");
|
||||
#else
|
||||
cmdShell = QString("bash");
|
||||
#endif
|
||||
fgProcess = NULL;
|
||||
widget = new Ui_HITLWidget();
|
||||
widget->setupUi(this);
|
||||
connect(widget->startButton, SIGNAL(clicked()), this, SLOT(startButtonClicked()));
|
||||
connect(widget->stopButton, SIGNAL(clicked()), this, SLOT(stopButtonClicked()));
|
||||
}
|
||||
|
||||
HITLWidget::~HITLWidget()
|
||||
{
|
||||
delete widget;
|
||||
}
|
||||
|
||||
void HITLWidget::startButtonClicked()
|
||||
{
|
||||
// Stop running process if one is active
|
||||
if (fgProcess != NULL)
|
||||
{
|
||||
stopButtonClicked();
|
||||
}
|
||||
|
||||
// Copy FlightGear generic protocol configuration file to the FG protocol directory
|
||||
// NOTE: Not working on Windows 7, if FG is installed in the "Program Files",
|
||||
// likelly due to permissions. The file should be manually copied to data/Protocol/opfgprotocol.xml
|
||||
QFile xmlFile(":/flightgear/genericprotocol/opfgprotocol.xml");
|
||||
xmlFile.open(QIODevice::ReadOnly | QIODevice::Text);
|
||||
QString xml = xmlFile.readAll();
|
||||
xmlFile.close();
|
||||
QFile xmlFileOut(fgPathData + "/Protocol/opfgprotocol.xml");
|
||||
xmlFileOut.open(QIODevice::WriteOnly | QIODevice::Text);
|
||||
xmlFileOut.write(xml.toAscii());
|
||||
xmlFileOut.close();
|
||||
|
||||
// Setup process
|
||||
widget->textBrowser->append(QString("Starting FlightGear ...\n"));
|
||||
qxtLog->info("HITL: Starting FlightGear");
|
||||
fgProcess = new QProcess();
|
||||
fgProcess->setReadChannelMode(QProcess::MergedChannels);
|
||||
connect(fgProcess, SIGNAL(readyReadStandardOutput()), this, SLOT(processReadyRead()));
|
||||
|
||||
// Start shell (Note: Could not start FG directly on Windows, only through terminal!)
|
||||
fgProcess->start(cmdShell);
|
||||
if (fgProcess->waitForStarted() == false)
|
||||
{
|
||||
widget->textBrowser->append("Error:" + fgProcess->errorString());
|
||||
}
|
||||
|
||||
// Setup arguments
|
||||
// Note: The input generic protocol is set to update at a much higher rate than the actual updates are sent by the GCS.
|
||||
// If this is not done then a lag will be introduced by FlightGear, likelly because the receive socket buffer builds up during startup.
|
||||
QString args("--fg-root=\"" + fgPathData + "\" --timeofday=dusk --httpd=5400 --enable-hud --in-air --altitude=2000 --vc=100 --generic=socket,out,50,localhost,5500,udp,opfgprotocol");
|
||||
if ( !fgManualControl )
|
||||
{
|
||||
args.append(" --generic=socket,in,400,localhost,5501,udp,opfgprotocol");
|
||||
}
|
||||
|
||||
// Start FlightGear
|
||||
QString cmd;
|
||||
cmd = "\"" + fgPathBin + "\" " + args + "\n";
|
||||
fgProcess->write(cmd.toAscii());
|
||||
|
||||
// Start bridge
|
||||
qxtLog->info("HITL: Starting bridge, initializing FlighGear and Autopilot connections");
|
||||
fgBridge = new FlightGearBridge();
|
||||
connect(fgBridge, SIGNAL(autopilotConnected()), this, SLOT(onAutopilotConnect()));
|
||||
connect(fgBridge, SIGNAL(autopilotDisconnected()), this, SLOT(onAutopilotDisconnect()));
|
||||
connect(fgBridge, SIGNAL(fgConnected()), this, SLOT(onFGConnect()));
|
||||
connect(fgBridge, SIGNAL(fgDisconnected()), this, SLOT(onFGDisconnect()));
|
||||
|
||||
// Initialize connection status
|
||||
if ( fgBridge->isAutopilotConnected() )
|
||||
{
|
||||
onAutopilotConnect();
|
||||
}
|
||||
else
|
||||
{
|
||||
onAutopilotDisconnect();
|
||||
}
|
||||
if ( fgBridge->isFGConnected() )
|
||||
{
|
||||
onFGConnect();
|
||||
}
|
||||
else
|
||||
{
|
||||
onFGDisconnect();
|
||||
}
|
||||
}
|
||||
|
||||
void HITLWidget::stopButtonClicked()
|
||||
{
|
||||
// NOTE: Does not currently work, may need to send control+c to through the terminal
|
||||
if (fgProcess != NULL)
|
||||
{
|
||||
fgProcess->disconnect(this);
|
||||
fgProcess->kill();
|
||||
delete fgProcess;
|
||||
fgBridge->disconnect(this);
|
||||
delete fgBridge;
|
||||
fgProcess = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void HITLWidget::setFGPathBin(QString fgPath)
|
||||
{
|
||||
this->fgPathBin = fgPath;
|
||||
}
|
||||
|
||||
void HITLWidget::setFGPathData(QString fgPath)
|
||||
{
|
||||
this->fgPathData = fgPath;
|
||||
}
|
||||
|
||||
void HITLWidget::setFGManualControl(bool val)
|
||||
{
|
||||
this->fgManualControl = val;
|
||||
}
|
||||
|
||||
void HITLWidget::processReadyRead()
|
||||
{
|
||||
QByteArray bytes = fgProcess->readAllStandardOutput();
|
||||
QString str(bytes);
|
||||
if ( !str.contains("Error reading data") ) // ignore error
|
||||
{
|
||||
widget->textBrowser->append(str);
|
||||
}
|
||||
}
|
||||
|
||||
void HITLWidget::onAutopilotConnect()
|
||||
{
|
||||
QPalette pal(widget->apLabel->palette());
|
||||
pal.setColor(QPalette::Window, Qt::green);
|
||||
widget->apLabel->setPalette(pal);
|
||||
widget->apLabel->setAutoFillBackground(true);
|
||||
widget->apLabel->setText("AutoPilot Connected");
|
||||
qxtLog->info("HITL: Autopilot connected, initializing for HITL simulation");
|
||||
}
|
||||
|
||||
void HITLWidget::onAutopilotDisconnect()
|
||||
{
|
||||
QPalette pal(widget->apLabel->palette());
|
||||
pal.setColor(QPalette::Window, Qt::red);
|
||||
widget->apLabel->setPalette(pal);
|
||||
widget->apLabel->setAutoFillBackground(true);
|
||||
widget->apLabel->setText("AutoPilot Disconnected");
|
||||
qxtLog->info("HITL: Autopilot disconnected");
|
||||
}
|
||||
|
||||
void HITLWidget::onFGConnect()
|
||||
{
|
||||
QPalette pal(widget->fgLabel->palette());
|
||||
pal.setColor(QPalette::Window, Qt::green);
|
||||
widget->fgLabel->setPalette(pal);
|
||||
widget->fgLabel->setAutoFillBackground(true);
|
||||
widget->fgLabel->setText("FlightGear Connected");
|
||||
qxtLog->info("HITL: FlighGear connected");
|
||||
}
|
||||
|
||||
void HITLWidget::onFGDisconnect()
|
||||
{
|
||||
QPalette pal(widget->fgLabel->palette());
|
||||
pal.setColor(QPalette::Window, Qt::red);
|
||||
widget->fgLabel->setPalette(pal);
|
||||
widget->fgLabel->setAutoFillBackground(true);
|
||||
widget->fgLabel->setText("FlightGear Disconnected");
|
||||
qxtLog->info("HITL: FlighGear disconnected");
|
||||
}
|
||||
|
||||
|
@ -1,70 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file hitlwidget.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
* @addtogroup HITLPlugin HITL Plugin
|
||||
* @{
|
||||
* @brief The Hardware In The Loop plugin
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef HITLWIDGET_H
|
||||
#define HITLWIDGET_H
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
#include <QProcess>
|
||||
#include "flightgearbridge.h"
|
||||
|
||||
class Ui_HITLWidget;
|
||||
|
||||
class HITLWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
HITLWidget(QWidget *parent = 0);
|
||||
~HITLWidget();
|
||||
|
||||
void setFGPathBin(QString fgPath);
|
||||
void setFGPathData(QString fgPath);
|
||||
void setFGManualControl(bool val);
|
||||
|
||||
public slots:
|
||||
|
||||
private slots:
|
||||
void startButtonClicked();
|
||||
void stopButtonClicked();
|
||||
void processReadyRead();
|
||||
void onAutopilotConnect();
|
||||
void onAutopilotDisconnect();
|
||||
void onFGConnect();
|
||||
void onFGDisconnect();
|
||||
|
||||
private:
|
||||
Ui_HITLWidget* widget;
|
||||
FlightGearBridge* fgBridge;
|
||||
QProcess* fgProcess;
|
||||
QString fgPathBin;
|
||||
QString fgPathData;
|
||||
bool fgManualControl;
|
||||
QString cmdShell;
|
||||
};
|
||||
|
||||
#endif /* HITLWIDGET_H */
|
@ -1,210 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>HITLWidget</class>
|
||||
<widget class="QWidget" name="HITLWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>786</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="startButton">
|
||||
<property name="toolTip">
|
||||
<string>Request update</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Start</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="stopButton">
|
||||
<property name="toolTip">
|
||||
<string>Send update</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Stop</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_7">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>5</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>5</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="apLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>AutoPilot Disconnected</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="fgLabel">
|
||||
<property name="text">
|
||||
<string>FlighGear Disconnected</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>5</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_8">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>5</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextBrowser" name="textBrowser"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -1,201 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<PropertyList>
|
||||
<generic>
|
||||
|
||||
<input>
|
||||
<line_separator>\n</line_separator>
|
||||
<var_separator>,</var_separator>
|
||||
|
||||
<chunk>
|
||||
<name>aileron</name>
|
||||
<node>/controls/flight/aileron</node>
|
||||
<type>float</type>
|
||||
<format>%f</format>
|
||||
</chunk>
|
||||
|
||||
<chunk>
|
||||
<name>elevator</name>
|
||||
<node>/controls/flight/elevator</node>
|
||||
<type>float</type>
|
||||
<format>%f</format>
|
||||
</chunk>
|
||||
|
||||
<chunk>
|
||||
<name>rudder</name>
|
||||
<node>/controls/flight/rudder</node>
|
||||
<type>float</type>
|
||||
<format>%f</format>
|
||||
</chunk>
|
||||
|
||||
<chunk>
|
||||
<name>throttle</name>
|
||||
<node>/controls/engines/engine/throttle</node>
|
||||
<type>float</type>
|
||||
<format>%f</format>
|
||||
</chunk>
|
||||
|
||||
</input>
|
||||
|
||||
<output>
|
||||
<line_separator>\n</line_separator>
|
||||
<var_separator>,</var_separator>
|
||||
|
||||
<chunk>
|
||||
<name>xRate</name>
|
||||
<node>/fdm/jsbsim/velocities/p-rad_sec</node>
|
||||
<type>float</type>
|
||||
<format>%f</format>
|
||||
</chunk>
|
||||
|
||||
<chunk>
|
||||
<name>yRate</name>
|
||||
<node>/fdm/jsbsim/velocities/q-rad_sec</node>
|
||||
<type>float</type>
|
||||
<format>%f</format>
|
||||
</chunk>
|
||||
|
||||
<chunk>
|
||||
<name>zRate</name>
|
||||
<node>/fdm/jsbsim/velocities/r-rad_sec</node>
|
||||
<type>float</type>
|
||||
<format>%f</format>
|
||||
</chunk>
|
||||
|
||||
<chunk>
|
||||
<name>xAccel</name>
|
||||
<!-- /fdm/jsbsim/accelerations/a-pilot-x-ft_sec2 -->
|
||||
<node>/accelerations/pilot/x-accel-fps_sec</node>
|
||||
<type>float</type>
|
||||
<format>%f</format>
|
||||
</chunk>
|
||||
|
||||
<chunk>
|
||||
<name>yAccel</name>
|
||||
<node>/accelerations/pilot/y-accel-fps_sec</node>
|
||||
<type>float</type>
|
||||
<format>%f</format>
|
||||
</chunk>
|
||||
|
||||
<chunk>
|
||||
<name>zAccel</name>
|
||||
<node>/accelerations/pilot/z-accel-fps_sec</node>
|
||||
<type>float</type>
|
||||
<format>%f</format>
|
||||
</chunk>
|
||||
|
||||
<chunk>
|
||||
<name>Pitch</name>
|
||||
<node>/orientation/pitch-deg</node>
|
||||
<type>float</type>
|
||||
<format>%f</format>
|
||||
</chunk>
|
||||
|
||||
<chunk>
|
||||
<name>PitchRate</name>
|
||||
<node>/orientation/pitch-rate-degps</node>
|
||||
<type>float</type>
|
||||
<format>%f</format>
|
||||
</chunk>
|
||||
|
||||
<chunk>
|
||||
<name>Roll</name>
|
||||
<node>/orientation/roll-deg</node>
|
||||
<type>float</type>
|
||||
<format>%f</format>
|
||||
</chunk>
|
||||
|
||||
<chunk>
|
||||
<name>RollRate</name>
|
||||
<node>/orientation/roll-rate-degps</node>
|
||||
<type>float</type>
|
||||
<format>%f</format>
|
||||
</chunk>
|
||||
|
||||
<chunk>
|
||||
<name>Yaw</name>
|
||||
<node>/orientation/heading-magnetic-deg</node>
|
||||
<type>float</type>
|
||||
<format>%f</format>
|
||||
</chunk>
|
||||
|
||||
<chunk>
|
||||
<name>YawRate</name>
|
||||
<node>/orientation/yaw-rate-degps</node>
|
||||
<type>float</type>
|
||||
<format>%f</format>
|
||||
</chunk>
|
||||
|
||||
<chunk>
|
||||
<name>Latitude</name>
|
||||
<node>/position/latitude-deg</node>
|
||||
<type>float</type>
|
||||
<format>%f</format>
|
||||
</chunk>
|
||||
|
||||
<chunk>
|
||||
<name>Longitude</name>
|
||||
<node>/position/longitude-deg</node>
|
||||
<type>float</type>
|
||||
<format>%f</format>
|
||||
</chunk>
|
||||
|
||||
<chunk>
|
||||
<name>Heading</name>
|
||||
<node>/orientation/heading-deg</node>
|
||||
<type>float</type>
|
||||
<format>%f</format>
|
||||
</chunk>
|
||||
|
||||
<chunk>
|
||||
<name>Altitude</name>
|
||||
<node>/position/altitude-ft</node>
|
||||
<type>float</type>
|
||||
<format>%f</format>
|
||||
</chunk>
|
||||
|
||||
<chunk>
|
||||
<name>AltitudeAGL</name>
|
||||
<node>/position/altitude-agl-ft</node>
|
||||
<type>float</type>
|
||||
<format>%f</format>
|
||||
</chunk>
|
||||
|
||||
<chunk>
|
||||
<name>Groundspeed</name>
|
||||
<node>/velocities/groundspeed-kt</node>
|
||||
<type>float</type>
|
||||
<format>%f</format>
|
||||
</chunk>
|
||||
|
||||
<chunk>
|
||||
<name>Airspeed</name>
|
||||
<node>/velocities/airspeed-kt</node>
|
||||
<type>float</type>
|
||||
<format>%f</format>
|
||||
</chunk>
|
||||
|
||||
<chunk>
|
||||
<name>Temperature</name>
|
||||
<node>/environment/temperature-degc</node>
|
||||
<type>float</type>
|
||||
<format>%f</format>
|
||||
</chunk>
|
||||
|
||||
<chunk>
|
||||
<name>Temperature</name>
|
||||
<node>/environment/temperature-degc</node>
|
||||
<type>float</type>
|
||||
<format>%f</format>
|
||||
</chunk>
|
||||
|
||||
<chunk>
|
||||
<name>Pressure</name>
|
||||
<node>/environment/pressure-inhg</node>
|
||||
<type>float</type>
|
||||
<format>%f</format>
|
||||
</chunk>
|
||||
|
||||
</output>
|
||||
|
||||
</generic>
|
||||
</PropertyList>
|
@ -1,12 +0,0 @@
|
||||
<plugin name="HITLIL2" version="1.0.0" compatVersion="1.0.0">
|
||||
<vendor>The OpenPilot Project</vendor>
|
||||
<copyright>(C) 2010 OpenPilot Project</copyright>
|
||||
<license>The GNU Public License (GPL) Version 3</license>
|
||||
<description>Hardware In The Loop Simulation with IL2</description>
|
||||
<url>http://www.openpilot.org</url>
|
||||
<dependencyList>
|
||||
<dependency name="Core" version="1.0.0"/>
|
||||
<dependency name="UAVObjects" version="1.0.0"/>
|
||||
<dependency name="UAVTalk" version="1.0.0"/>
|
||||
</dependencyList>
|
||||
</plugin>
|
@ -1,51 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file hitlil2.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup hitlil2plugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include "hitlil2.h"
|
||||
#include "hitlil2widget.h"
|
||||
#include "hitlil2configuration.h"
|
||||
|
||||
HITLIL2::HITLIL2(QString classId, HITLIL2Widget *widget, QWidget *parent) :
|
||||
IUAVGadget(classId, parent),
|
||||
m_widget(widget)
|
||||
{
|
||||
}
|
||||
|
||||
HITLIL2::~HITLIL2()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void HITLIL2::loadConfiguration(IUAVGadgetConfiguration* config)
|
||||
{
|
||||
HITLIL2Configuration *m = qobject_cast<HITLIL2Configuration*>(config);
|
||||
m_widget->setIl2HostName( m->il2HostName() );
|
||||
m_widget->setIl2Latitude( m->il2Latitude() );
|
||||
m_widget->setIl2Longitude( m->il2Longitude() );
|
||||
m_widget->setIl2Port( m->il2Port() );
|
||||
m_widget->setIl2ManualControl( m->il2ManualControl() );
|
||||
}
|
||||
|
@ -1,56 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file hitlil2.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup hitlil2plugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef HITLIL2_H
|
||||
#define HITLIL2_H
|
||||
|
||||
#include <coreplugin/iuavgadget.h>
|
||||
#include "hitlil2widget.h"
|
||||
|
||||
class IUAVGadget;
|
||||
class QWidget;
|
||||
class QString;
|
||||
class HITLIL2Widget;
|
||||
|
||||
using namespace Core;
|
||||
|
||||
class HITLIL2 : public Core::IUAVGadget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
HITLIL2(QString classId, HITLIL2Widget *widget, QWidget *parent = 0);
|
||||
~HITLIL2();
|
||||
|
||||
QWidget *widget() { return m_widget; }
|
||||
void loadConfiguration(IUAVGadgetConfiguration* config);
|
||||
|
||||
private:
|
||||
HITLIL2Widget *m_widget;
|
||||
};
|
||||
|
||||
|
||||
#endif // HITLIL2_H
|
@ -1,22 +0,0 @@
|
||||
TEMPLATE = lib
|
||||
TARGET = HITLIL2
|
||||
QT += network
|
||||
include(../../openpilotgcsplugin.pri)
|
||||
include(hitlil2_dependencies.pri)
|
||||
HEADERS += hitlil2plugin.h \
|
||||
hitlil2widget.h \
|
||||
hitlil2optionspage.h \
|
||||
hitlil2factory.h \
|
||||
hitlil2configuration.h \
|
||||
hitlil2.h \
|
||||
il2bridge.h
|
||||
SOURCES += hitlil2plugin.cpp \
|
||||
hitlil2widget.cpp \
|
||||
hitlil2optionspage.cpp \
|
||||
hitlil2factory.cpp \
|
||||
hitlil2configuration.cpp \
|
||||
hitlil2.cpp \
|
||||
il2bridge.cpp
|
||||
OTHER_FILES += HITLIL2.pluginspec
|
||||
FORMS += hitlil2optionspage.ui \
|
||||
hitlil2widget.ui
|
@ -1,4 +0,0 @@
|
||||
include(../../plugins/uavobjects/uavobjects.pri)
|
||||
include(../../plugins/uavtalk/uavtalk.pri)
|
||||
include(../../plugins/coreplugin/coreplugin.pri)
|
||||
include(../../libs/utils/utils.pri)
|
@ -1,77 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file hitlil2configuration.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup hitlil2plugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "hitlil2configuration.h"
|
||||
#include <QtCore/QDataStream>
|
||||
|
||||
HITLIL2Configuration::HITLIL2Configuration(QString classId, const QByteArray &state, QObject *parent) :
|
||||
IUAVGadgetConfiguration(classId, parent),
|
||||
m_il2HostName(""), m_il2Latitude(""), m_il2Longitude(""), m_il2Port(0), m_il2ManualControl(false)
|
||||
{
|
||||
if (state.count() > 0) {
|
||||
QDataStream stream(state);
|
||||
QString il2HostName;
|
||||
QString il2Latitude;
|
||||
QString il2Longitude;
|
||||
int il2Port;
|
||||
bool il2ManualControl;
|
||||
stream >> il2HostName;
|
||||
m_il2HostName = il2HostName;
|
||||
stream >> il2Latitude;
|
||||
m_il2Latitude = il2Latitude;
|
||||
stream >> il2Longitude;
|
||||
m_il2Longitude = il2Longitude;
|
||||
stream >> il2Port;
|
||||
m_il2Port = il2Port;
|
||||
stream >> il2ManualControl;
|
||||
m_il2ManualControl = il2ManualControl;
|
||||
}
|
||||
}
|
||||
|
||||
IUAVGadgetConfiguration *HITLIL2Configuration::clone()
|
||||
{
|
||||
HITLIL2Configuration *m = new HITLIL2Configuration(this->classId());
|
||||
m->m_il2HostName = m_il2HostName;
|
||||
m->m_il2Latitude = m_il2Latitude;
|
||||
m->m_il2Longitude = m_il2Longitude;
|
||||
m->m_il2Port = m_il2Port;
|
||||
m->m_il2ManualControl = m_il2ManualControl;
|
||||
return m;
|
||||
}
|
||||
|
||||
QByteArray HITLIL2Configuration::saveState() const
|
||||
{
|
||||
QByteArray bytes;
|
||||
QDataStream stream(&bytes, QIODevice::WriteOnly);
|
||||
stream << m_il2HostName;
|
||||
stream << m_il2Latitude;
|
||||
stream << m_il2Longitude;
|
||||
stream << m_il2Port;
|
||||
stream << m_il2ManualControl;
|
||||
return bytes;
|
||||
}
|
||||
|
@ -1,76 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file hitlil2configuration.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup hitlil2plugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef HITLIL2CONFIGURATION_H
|
||||
#define HITLIL2CONFIGURATION_H
|
||||
|
||||
#include <coreplugin/iuavgadgetconfiguration.h>
|
||||
#include <QtGui/QColor>
|
||||
#include <QString>
|
||||
|
||||
using namespace Core;
|
||||
|
||||
class HITLIL2Configuration : public IUAVGadgetConfiguration
|
||||
{
|
||||
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString m_il2HostName READ il2HostName WRITE setIl2HostName)
|
||||
Q_PROPERTY(QString m_il2Latitude READ il2Latitude WRITE setIl2Latitude)
|
||||
Q_PROPERTY(QString m_il2Longitude READ il2Longitude WRITE setIl2Longitude)
|
||||
Q_PROPERTY(int m_il2Port READ il2Port WRITE setIl2Port)
|
||||
Q_PROPERTY(bool m_il2ManualControl READ il2ManualControl WRITE setIl2ManualControl)
|
||||
|
||||
public:
|
||||
explicit HITLIL2Configuration(QString classId, const QByteArray &state = 0, QObject *parent = 0);
|
||||
QByteArray saveState() const;
|
||||
IUAVGadgetConfiguration *clone();
|
||||
|
||||
QString il2HostName() const { return m_il2HostName; }
|
||||
QString il2Latitude() const { return m_il2Latitude; }
|
||||
QString il2Longitude() const { return m_il2Longitude; }
|
||||
int il2Port() const { return m_il2Port; }
|
||||
bool il2ManualControl() const { return m_il2ManualControl; }
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
void setIl2HostName(QString HostName) { m_il2HostName = HostName; }
|
||||
void setIl2Latitude(QString Latitude) { m_il2Latitude = Latitude; }
|
||||
void setIl2Longitude(QString Longitude) { m_il2Longitude = Longitude; }
|
||||
void setIl2Port(int Port) { m_il2Port = Port; }
|
||||
void setIl2ManualControl(bool val) { m_il2ManualControl = val; }
|
||||
|
||||
private:
|
||||
QString m_il2HostName;
|
||||
QString m_il2Latitude;
|
||||
QString m_il2Longitude;
|
||||
int m_il2Port;
|
||||
bool m_il2ManualControl;
|
||||
|
||||
};
|
||||
|
||||
#endif // HITLIL2CONFIGURATION_H
|
@ -1,58 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file hitlil2factory.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup hitlil2plugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include "hitlil2factory.h"
|
||||
#include "hitlil2widget.h"
|
||||
#include "hitlil2.h"
|
||||
#include "hitlil2configuration.h"
|
||||
#include "hitlil2optionspage.h"
|
||||
#include <coreplugin/iuavgadget.h>
|
||||
|
||||
HITLIL2Factory::HITLIL2Factory(QObject *parent) :
|
||||
IUAVGadgetFactory(QString("HITLIL2"), tr("HITL Simulation with IL2"), parent)
|
||||
{
|
||||
}
|
||||
|
||||
HITLIL2Factory::~HITLIL2Factory()
|
||||
{
|
||||
}
|
||||
|
||||
Core::IUAVGadget* HITLIL2Factory::createGadget(QWidget *parent)
|
||||
{
|
||||
HITLIL2Widget* gadgetWidget = new HITLIL2Widget(parent);
|
||||
return new HITLIL2(QString("HITLIL2"), gadgetWidget, parent);
|
||||
}
|
||||
|
||||
IUAVGadgetConfiguration *HITLIL2Factory::createConfiguration(const QByteArray &state)
|
||||
{
|
||||
return new HITLIL2Configuration(QString("HITLIL2"), state);
|
||||
}
|
||||
|
||||
IOptionsPage *HITLIL2Factory::createOptionsPage(IUAVGadgetConfiguration *config)
|
||||
{
|
||||
return new HITLIL2OptionsPage(qobject_cast<HITLIL2Configuration*>(config));
|
||||
}
|
||||
|
@ -1,52 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file hitlil2factory.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup hitlil2plugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef HITLIL2FACTORY_H
|
||||
#define HITLIL2FACTORY_H
|
||||
|
||||
#include <coreplugin/iuavgadgetfactory.h>
|
||||
|
||||
namespace Core {
|
||||
class IUAVGadget;
|
||||
class IUAVGadgetFactory;
|
||||
}
|
||||
|
||||
using namespace Core;
|
||||
|
||||
class HITLIL2Factory : public Core::IUAVGadgetFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
HITLIL2Factory(QObject *parent = 0);
|
||||
~HITLIL2Factory();
|
||||
|
||||
Core::IUAVGadget *createGadget(QWidget *parent);
|
||||
IUAVGadgetConfiguration *createConfiguration(const QByteArray &state);
|
||||
IOptionsPage *createOptionsPage(IUAVGadgetConfiguration *config);
|
||||
};
|
||||
|
||||
#endif // HITLIL2FACTORY_H
|
@ -1,70 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file hitlil2optionspage.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup hitlil2plugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "hitlil2optionspage.h"
|
||||
#include "hitlil2configuration.h"
|
||||
#include "ui_hitlil2optionspage.h"
|
||||
|
||||
|
||||
HITLIL2OptionsPage::HITLIL2OptionsPage(HITLIL2Configuration *config, QObject *parent) :
|
||||
IOptionsPage(parent),
|
||||
m_config(config)
|
||||
{
|
||||
}
|
||||
|
||||
QWidget *HITLIL2OptionsPage::createPage(QWidget *parent)
|
||||
{
|
||||
// Create page
|
||||
m_optionsPage = new Ui::HITLIL2OptionsPage();
|
||||
QWidget* optionsPageWidget = new QWidget;
|
||||
m_optionsPage->setupUi(optionsPageWidget);
|
||||
|
||||
|
||||
// Restore the contents from the settings:
|
||||
m_optionsPage->Il2HostName->setText(m_config->il2HostName());
|
||||
m_optionsPage->Il2Latitude->setText(m_config->il2Latitude());
|
||||
m_optionsPage->Il2Longitude->setText(m_config->il2Longitude());
|
||||
m_optionsPage->Il2Port->setValue(m_config->il2Port());
|
||||
m_optionsPage->il2ManualControl->setChecked(m_config->il2ManualControl());
|
||||
|
||||
|
||||
return optionsPageWidget;
|
||||
}
|
||||
|
||||
void HITLIL2OptionsPage::apply()
|
||||
{
|
||||
m_config->setIl2HostName( m_optionsPage->Il2HostName->text());
|
||||
m_config->setIl2Latitude( m_optionsPage->Il2Latitude->text());
|
||||
m_config->setIl2Longitude( m_optionsPage->Il2Longitude->text());
|
||||
m_config->setIl2Port( m_optionsPage->Il2Port->value());
|
||||
m_config->setIl2ManualControl( m_optionsPage->il2ManualControl->isChecked());
|
||||
}
|
||||
|
||||
void HITLIL2OptionsPage::finish()
|
||||
{
|
||||
delete m_optionsPage;
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file hitlil2optionspage.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup hitlil2plugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef HITLIL2OPTIONSPAGE_H
|
||||
#define HITLIL2OPTIONSPAGE_H
|
||||
|
||||
#include "coreplugin/dialogs/ioptionspage.h"
|
||||
|
||||
namespace Core {
|
||||
class IUAVGadgetConfiguration;
|
||||
}
|
||||
|
||||
class HITLIL2Configuration;
|
||||
|
||||
using namespace Core;
|
||||
|
||||
namespace Ui {
|
||||
class HITLIL2OptionsPage;
|
||||
}
|
||||
|
||||
class HITLIL2OptionsPage : public IOptionsPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit HITLIL2OptionsPage(HITLIL2Configuration *config, QObject *parent = 0);
|
||||
|
||||
QWidget *createPage(QWidget *parent);
|
||||
void apply();
|
||||
void finish();
|
||||
|
||||
signals:
|
||||
|
||||
private slots:
|
||||
|
||||
private:
|
||||
HITLIL2Configuration* m_config;
|
||||
Ui::HITLIL2OptionsPage* m_optionsPage;
|
||||
|
||||
};
|
||||
|
||||
#endif // HITLIL2OPTIONSPAGE_H
|
@ -1,100 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>HITLIL2OptionsPage</class>
|
||||
<widget class="QWidget" name="HITLIL2OptionsPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>388</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="3">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QCheckBox" name="il2ManualControl">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Manual aircraft control (can be used when hardware is not available)</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Manual aircraft control (can be used when hardware is not available)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QSpinBox" name="Il2Port">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>999999</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>IL2 DeviceLink Port</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QLineEdit" name="Il2HostName"/>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>IL2 Host Name/Number</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLineEdit" name="Il2Longitude"/>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="label_1">
|
||||
<property name="text">
|
||||
<string>Longitude offset (in degrees)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLineEdit" name="Il2Latitude"/>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label_0">
|
||||
<property name="text">
|
||||
<string>Latitude offset (in degrees)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -1,63 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file hitlil2plugin.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup hitlil2plugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include "hitlil2plugin.h"
|
||||
#include "hitlil2factory.h"
|
||||
#include <QtPlugin>
|
||||
#include <QStringList>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
|
||||
HITLIL2Plugin::HITLIL2Plugin()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
HITLIL2Plugin::~HITLIL2Plugin()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
bool HITLIL2Plugin::initialize(const QStringList& args, QString *errMsg)
|
||||
{
|
||||
Q_UNUSED(args);
|
||||
Q_UNUSED(errMsg);
|
||||
mf = new HITLIL2Factory(this);
|
||||
addAutoReleasedObject(mf);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void HITLIL2Plugin::extensionsInitialized()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
void HITLIL2Plugin::shutdown()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
Q_EXPORT_PLUGIN(HITLIL2Plugin)
|
||||
|
@ -1,47 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file hitlil2plugin.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup hitlil2plugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef HITLIL2PLUGIN_H
|
||||
#define HITLIL2PLUGIN_H
|
||||
|
||||
#include <extensionsystem/iplugin.h>
|
||||
|
||||
class HITLIL2Factory;
|
||||
|
||||
class HITLIL2Plugin : public ExtensionSystem::IPlugin
|
||||
{
|
||||
public:
|
||||
HITLIL2Plugin();
|
||||
~HITLIL2Plugin();
|
||||
|
||||
void extensionsInitialized();
|
||||
bool initialize(const QStringList & arguments, QString * errorString);
|
||||
void shutdown();
|
||||
private:
|
||||
HITLIL2Factory *mf;
|
||||
};
|
||||
#endif /* HITLIL2PLUGIN_H */
|
@ -1,161 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file hitlil2widget.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup hitlil2plugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include "hitlil2widget.h"
|
||||
#include "ui_hitlil2widget.h"
|
||||
#include "qxtlogger.h"
|
||||
#include <QDebug>
|
||||
#include "uavobjects/uavobjectmanager.h"
|
||||
|
||||
HITLIL2Widget::HITLIL2Widget(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
widget = new Ui_HITLIL2Widget();
|
||||
widget->setupUi(this);
|
||||
connect(widget->startButton, SIGNAL(clicked()), this, SLOT(startButtonClicked()));
|
||||
connect(widget->stopButton, SIGNAL(clicked()), this, SLOT(stopButtonClicked()));
|
||||
/* Note to myself: failure to initialize pointers can cause segfaults */
|
||||
il2Bridge=NULL;
|
||||
}
|
||||
|
||||
HITLIL2Widget::~HITLIL2Widget()
|
||||
{
|
||||
delete widget;
|
||||
}
|
||||
|
||||
void HITLIL2Widget::startButtonClicked()
|
||||
{
|
||||
// Stop running process if one is active
|
||||
if (il2Bridge != NULL)
|
||||
{
|
||||
stopButtonClicked();
|
||||
}
|
||||
|
||||
// Setup process
|
||||
widget->textBrowser->append(QString("Connecting to IL2 ...\n"));
|
||||
|
||||
// Start bridge
|
||||
qxtLog->info("HITLIL2: Starting bridge, initializing IL2 and Autopilot connections");
|
||||
il2Bridge = new Il2Bridge(il2HostName,il2Port,il2Latitude,il2Longitude);
|
||||
connect(il2Bridge, SIGNAL(autopilotConnected()), this, SLOT(onAutopilotConnect()));
|
||||
connect(il2Bridge, SIGNAL(autopilotDisconnected()), this, SLOT(onAutopilotDisconnect()));
|
||||
connect(il2Bridge, SIGNAL(il2Connected()), this, SLOT(onIl2Connect()));
|
||||
connect(il2Bridge, SIGNAL(il2Disconnected()), this, SLOT(onIl2Disconnect()));
|
||||
|
||||
// Initialize connection status
|
||||
if ( il2Bridge->isAutopilotConnected() )
|
||||
{
|
||||
onAutopilotConnect();
|
||||
}
|
||||
else
|
||||
{
|
||||
onAutopilotDisconnect();
|
||||
}
|
||||
if ( il2Bridge->isIl2Connected() )
|
||||
{
|
||||
onIl2Connect();
|
||||
}
|
||||
else
|
||||
{
|
||||
onIl2Disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
void HITLIL2Widget::stopButtonClicked()
|
||||
{
|
||||
if (il2Bridge != NULL)
|
||||
{
|
||||
il2Bridge->disconnect(this);
|
||||
delete il2Bridge;
|
||||
il2Bridge = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void HITLIL2Widget::setIl2HostName(QString il2HostName)
|
||||
{
|
||||
this->il2HostName = il2HostName;
|
||||
}
|
||||
|
||||
void HITLIL2Widget::setIl2Latitude(QString il2Latitude)
|
||||
{
|
||||
this->il2Latitude = il2Latitude;
|
||||
}
|
||||
|
||||
void HITLIL2Widget::setIl2Longitude(QString il2Longitude)
|
||||
{
|
||||
this->il2Longitude = il2Longitude;
|
||||
}
|
||||
|
||||
void HITLIL2Widget::setIl2Port(int il2Port)
|
||||
{
|
||||
this->il2Port = il2Port;
|
||||
}
|
||||
|
||||
void HITLIL2Widget::setIl2ManualControl(bool val)
|
||||
{
|
||||
this->il2ManualControl = val;
|
||||
}
|
||||
|
||||
void HITLIL2Widget::onAutopilotConnect()
|
||||
{
|
||||
QPalette pal(widget->apLabel->palette());
|
||||
pal.setColor(QPalette::Window, Qt::green);
|
||||
widget->apLabel->setPalette(pal);
|
||||
widget->apLabel->setAutoFillBackground(true);
|
||||
widget->apLabel->setText("AutoPilot Connected");
|
||||
qxtLog->info("HITL-IL2: Autopilot connected, initializing for HITL simulation");
|
||||
}
|
||||
|
||||
void HITLIL2Widget::onAutopilotDisconnect()
|
||||
{
|
||||
QPalette pal(widget->apLabel->palette());
|
||||
pal.setColor(QPalette::Window, Qt::red);
|
||||
widget->apLabel->setPalette(pal);
|
||||
widget->apLabel->setAutoFillBackground(true);
|
||||
widget->apLabel->setText("AutoPilot Disconnected");
|
||||
qxtLog->info("HITL-IL2: Autopilot disconnected");
|
||||
}
|
||||
|
||||
void HITLIL2Widget::onIl2Connect()
|
||||
{
|
||||
QPalette pal(widget->il2Label->palette());
|
||||
pal.setColor(QPalette::Window, Qt::green);
|
||||
widget->il2Label->setPalette(pal);
|
||||
widget->il2Label->setAutoFillBackground(true);
|
||||
widget->il2Label->setText("IL2 Connected");
|
||||
qxtLog->info("HITL-IL2: IL2 connected");
|
||||
}
|
||||
|
||||
void HITLIL2Widget::onIl2Disconnect()
|
||||
{
|
||||
QPalette pal(widget->il2Label->palette());
|
||||
pal.setColor(QPalette::Window, Qt::red);
|
||||
widget->il2Label->setPalette(pal);
|
||||
widget->il2Label->setAutoFillBackground(true);
|
||||
widget->il2Label->setText("IL2 Disconnected");
|
||||
qxtLog->info("HITL-IL2: IL2 disconnected");
|
||||
}
|
||||
|
||||
|
@ -1,70 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file hitlwidget.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup hitlil2plugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef HITLIL2WIDGET_H
|
||||
#define HITLIL2WIDGET_H
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
#include "il2bridge.h"
|
||||
|
||||
class Ui_HITLIL2Widget;
|
||||
|
||||
class HITLIL2Widget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
HITLIL2Widget(QWidget *parent = 0);
|
||||
~HITLIL2Widget();
|
||||
|
||||
void setIl2HostName(QString il2HostName);
|
||||
void setIl2Latitude(QString il2Latitude);
|
||||
void setIl2Longitude(QString il2Longitude);
|
||||
void setIl2Port(int il2Port);
|
||||
void setIl2ManualControl(bool val);
|
||||
|
||||
public slots:
|
||||
|
||||
private slots:
|
||||
void startButtonClicked();
|
||||
void stopButtonClicked();
|
||||
void onAutopilotConnect();
|
||||
void onAutopilotDisconnect();
|
||||
void onIl2Connect();
|
||||
void onIl2Disconnect();
|
||||
|
||||
private:
|
||||
Ui_HITLIL2Widget* widget;
|
||||
Il2Bridge* il2Bridge;
|
||||
QString il2HostName;
|
||||
QString il2Latitude;
|
||||
QString il2Longitude;
|
||||
int il2Port;
|
||||
bool il2ManualControl;
|
||||
};
|
||||
|
||||
#endif /* HITLIL2WIDGET_H */
|
@ -1,210 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>HITLIL2Widget</class>
|
||||
<widget class="QWidget" name="HITLIL2Widget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>786</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="startButton">
|
||||
<property name="toolTip">
|
||||
<string>Request update</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Start</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="stopButton">
|
||||
<property name="toolTip">
|
||||
<string>Send update</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Stop</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_7">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>5</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>5</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="apLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>AutoPilot Disconnected</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="il2Label">
|
||||
<property name="text">
|
||||
<string>IL2 Disconnected</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>5</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_8">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>5</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextBrowser" name="textBrowser"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -1,412 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file il2bridge.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup hitlil2plugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
* Description of DeviceLink Protocol:
|
||||
* A Request is initiated with R/ followed by id's of to be requested settings
|
||||
* even id's indicate read only values, odd are write only
|
||||
* (usually id =get value id+1= set - for same setting)
|
||||
* id's are separated by /
|
||||
* requests can contain values to set, or to select a subsystem
|
||||
* values are separated by \
|
||||
* example: R/30/48/64\0/64\1/
|
||||
* request read only settings 30,48 and 64 with parameters 0 and 1
|
||||
* the answer consists of an A followed by id value pairs in the same format
|
||||
* example: A/30\0/48\0/64\0\22/64\1\102/
|
||||
*
|
||||
* A full protocol description as well as a list of ID's and their meanings
|
||||
* can be found shipped with IL2 in the file DeviceLink.txt
|
||||
*
|
||||
* id's used in this file:
|
||||
* 30: IAS in km/h (float)
|
||||
* 32: vario in m/s (float)
|
||||
* 38: angular speed °/s (float) (which direction? azimuth?)
|
||||
* 40: barometric alt in m (float)
|
||||
* 42: flight course in ° (0-360) (float)
|
||||
* 46: roll angle in ° (-180 - 180) (floatniguration)
|
||||
* 48: pitch angle in ° (-90 - 90) (float)
|
||||
* 80/81: engine power (-1.0 (0%) - 1.0 (100%)) (float)
|
||||
* 84/85: aileron servo (-1.0 - 1.0) (float)
|
||||
* 86/87: elevator servo (-1.0 - 1.0) (float)
|
||||
* 88/89: rudder servo (-1.0 - 1.0) (float)
|
||||
*
|
||||
* IL2 currently offers no useful way of providing GPS data
|
||||
* therefore fake GPS data will be calculated using IMS
|
||||
*
|
||||
* unfortunately angular acceleration provided is very limited, too
|
||||
*/
|
||||
#include "il2bridge.h"
|
||||
#include "extensionsystem/pluginmanager.h"
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/threadmanager.h>
|
||||
#include <math.h>
|
||||
|
||||
const float Il2Bridge::FT2M = 0.3048;
|
||||
const float Il2Bridge::KT2MPS = 0.514444444;
|
||||
const float Il2Bridge::MPS2KMH = 3.6;
|
||||
const float Il2Bridge::KMH2MPS = (1.0/3.6);
|
||||
const float Il2Bridge::INHG2KPA = 3.386;
|
||||
const float Il2Bridge::RAD2DEG = (180.0/M_PI);
|
||||
const float Il2Bridge::DEG2RAD = (M_PI/180.0);
|
||||
const float Il2Bridge::M2DEG = 60.*1852.; // 60 miles per degree times 1852 meters per mile
|
||||
const float Il2Bridge::DEG2M = (1.0/(60.*1852.));
|
||||
const float Il2Bridge::AIR_CONST = 287.058; // J/(kg*K)
|
||||
const float Il2Bridge::GROUNDDENSITY = 1.225; // kg/m³ ;)
|
||||
const float Il2Bridge::TEMP_GROUND = (15.0 + 273.0); // 15°C in Kelvin
|
||||
const float Il2Bridge::TEMP_LAPSE_RATE = -0.0065; //degrees per meter
|
||||
const float Il2Bridge::AIR_CONST_FACTOR = -0.0341631947363104; //several nature constants calculated into one
|
||||
|
||||
Il2Bridge::Il2Bridge(QString il2HostName, int il2Port, QString il2Latitude, QString il2Longitude)
|
||||
{
|
||||
// Init fields
|
||||
il2Host = QHostAddress(il2HostName);
|
||||
outPort = il2Port;
|
||||
updatePeriod = 50;
|
||||
il2Timeout = 2000;
|
||||
autopilotConnectionStatus = false;
|
||||
il2ConnectionStatus = false;
|
||||
latitude=il2Latitude.toFloat();
|
||||
longitude=il2Longitude.toFloat();
|
||||
|
||||
|
||||
|
||||
// move to thread
|
||||
moveToThread(Core::ICore::instance()->threadManager()->getRealTimeThread());
|
||||
|
||||
connect(this, SIGNAL(myStart()), this, SLOT(onStart()),Qt::QueuedConnection);
|
||||
emit myStart();
|
||||
}
|
||||
|
||||
void Il2Bridge::onStart()
|
||||
{
|
||||
|
||||
// Get required UAVObjects
|
||||
ExtensionSystem::PluginManager* pm = ExtensionSystem::PluginManager::instance();
|
||||
UAVObjectManager* objManager = pm->getObject<UAVObjectManager>();
|
||||
actDesired = ActuatorDesired::GetInstance(objManager);
|
||||
baroAltitude = BaroAltitude::GetInstance(objManager);
|
||||
attActual = AttitudeActual::GetInstance(objManager);
|
||||
posActual = PositionActual::GetInstance(objManager);
|
||||
telStats = GCSTelemetryStats::GetInstance(objManager);
|
||||
|
||||
// Listen to autopilot connection events
|
||||
TelemetryManager* telMngr = pm->getObject<TelemetryManager>();
|
||||
connect(telMngr, SIGNAL(connected()), this, SLOT(onAutopilotConnect()));
|
||||
connect(telMngr, SIGNAL(disconnected()), this, SLOT(onAutopilotDisconnect()));
|
||||
//connect(telStats, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(telStatsUpdated(UAVObject*)));
|
||||
|
||||
// If already connect setup autopilot
|
||||
GCSTelemetryStats::DataFields stats = telStats->getData();
|
||||
if ( stats.Status == GCSTelemetryStats::STATUS_CONNECTED )
|
||||
{
|
||||
onAutopilotConnect();
|
||||
}
|
||||
|
||||
// Setup local ports
|
||||
outSocket = new QUdpSocket();
|
||||
outSocket->connectToHost(il2Host,outPort);
|
||||
connect(outSocket, SIGNAL(readyRead()), this, SLOT(receiveUpdate()),Qt::DirectConnection);
|
||||
|
||||
// Setup transmit timer
|
||||
txTimer = new QTimer();
|
||||
connect(txTimer, SIGNAL(timeout()), this, SLOT(transmitUpdate()),Qt::DirectConnection);
|
||||
txTimer->setInterval(updatePeriod);
|
||||
txTimer->start();
|
||||
|
||||
// Setup FG connection timer
|
||||
il2Timer = new QTimer();
|
||||
connect(il2Timer, SIGNAL(timeout()), this, SLOT(onIl2ConnectionTimeout()),Qt::DirectConnection);
|
||||
il2Timer->setInterval(il2Timeout);
|
||||
il2Timer->start();
|
||||
|
||||
// setup time
|
||||
time = new QTime();
|
||||
time->start();
|
||||
|
||||
current.T=0;
|
||||
|
||||
}
|
||||
|
||||
Il2Bridge::~Il2Bridge()
|
||||
{
|
||||
delete outSocket;
|
||||
delete txTimer;
|
||||
delete il2Timer;
|
||||
}
|
||||
|
||||
bool Il2Bridge::isAutopilotConnected()
|
||||
{
|
||||
return autopilotConnectionStatus;
|
||||
}
|
||||
|
||||
bool Il2Bridge::isIl2Connected()
|
||||
{
|
||||
return il2ConnectionStatus;
|
||||
}
|
||||
|
||||
void Il2Bridge::transmitUpdate()
|
||||
{
|
||||
// Read ActuatorDesired from autopilot
|
||||
ActuatorDesired::DataFields actData = actDesired->getData();
|
||||
float ailerons = actData.Roll;
|
||||
float elevator = actData.Pitch;
|
||||
float rudder = actData.Yaw;
|
||||
float throttle = actData.Throttle*2-1.0;
|
||||
|
||||
// Send update to Il2
|
||||
QString cmd;
|
||||
cmd=QString("R/30/32/40/42/46/48/81\\%1/85\\%2/87\\%3/89\\%4/")
|
||||
.arg(throttle)
|
||||
.arg(ailerons)
|
||||
.arg(elevator)
|
||||
.arg(rudder);
|
||||
QByteArray data = cmd.toAscii();
|
||||
outSocket->write(data);
|
||||
}
|
||||
|
||||
void Il2Bridge::receiveUpdate()
|
||||
{
|
||||
// Update connection timer and status
|
||||
il2Timer->setInterval(il2Timeout);
|
||||
il2Timer->stop();
|
||||
il2Timer->start();
|
||||
if ( !il2ConnectionStatus )
|
||||
{
|
||||
il2ConnectionStatus = true;
|
||||
emit il2Connected();
|
||||
}
|
||||
// Process data
|
||||
while ( outSocket->bytesAvailable() > 0 )
|
||||
{
|
||||
// Receive datagram
|
||||
QByteArray datagram;
|
||||
datagram.resize(outSocket->pendingDatagramSize());
|
||||
QHostAddress sender;
|
||||
quint16 senderPort;
|
||||
outSocket->readDatagram(datagram.data(), datagram.size(),
|
||||
&sender, &senderPort);
|
||||
QString datastr(datagram);
|
||||
// Process incomming data
|
||||
processUpdate(datastr);
|
||||
}
|
||||
}
|
||||
|
||||
void Il2Bridge::setupObjects()
|
||||
{
|
||||
setupInputObject(actDesired, 75);
|
||||
setupOutputObject(baroAltitude, 250);
|
||||
setupOutputObject(attActual, 75);
|
||||
setupOutputObject(posActual, 250);
|
||||
}
|
||||
|
||||
void Il2Bridge::setupInputObject(UAVObject* obj, int updatePeriod)
|
||||
{
|
||||
UAVObject::Metadata mdata;
|
||||
mdata = obj->getDefaultMetadata();
|
||||
mdata.flightAccess = UAVObject::ACCESS_READWRITE;
|
||||
mdata.gcsAccess = UAVObject::ACCESS_READWRITE;
|
||||
mdata.flightTelemetryAcked = false;
|
||||
mdata.flightTelemetryUpdateMode = UAVObject::UPDATEMODE_PERIODIC;
|
||||
mdata.flightTelemetryUpdatePeriod = updatePeriod;
|
||||
mdata.gcsTelemetryUpdateMode = UAVObject::UPDATEMODE_MANUAL;
|
||||
obj->setMetadata(mdata);
|
||||
}
|
||||
|
||||
void Il2Bridge::setupOutputObject(UAVObject* obj, int updatePeriod)
|
||||
{
|
||||
UAVObject::Metadata mdata;
|
||||
mdata = obj->getDefaultMetadata();
|
||||
mdata.flightAccess = UAVObject::ACCESS_READONLY;
|
||||
mdata.gcsAccess = UAVObject::ACCESS_READWRITE;
|
||||
mdata.flightTelemetryUpdateMode = UAVObject::UPDATEMODE_NEVER;
|
||||
mdata.gcsTelemetryAcked = false;
|
||||
mdata.gcsTelemetryUpdateMode = UAVObject::UPDATEMODE_PERIODIC;
|
||||
mdata.gcsTelemetryUpdatePeriod = updatePeriod;
|
||||
obj->setMetadata(mdata);
|
||||
}
|
||||
|
||||
void Il2Bridge::onAutopilotConnect()
|
||||
{
|
||||
autopilotConnectionStatus = true;
|
||||
setupObjects();
|
||||
emit autopilotConnected();
|
||||
}
|
||||
|
||||
void Il2Bridge::onAutopilotDisconnect()
|
||||
{
|
||||
autopilotConnectionStatus = false;
|
||||
emit autopilotDisconnected();
|
||||
}
|
||||
|
||||
void Il2Bridge::onIl2ConnectionTimeout()
|
||||
{
|
||||
if ( il2ConnectionStatus )
|
||||
{
|
||||
il2ConnectionStatus = false;
|
||||
emit il2Disconnected();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* calculate air density from altitude
|
||||
*/
|
||||
float Il2Bridge::DENSITY(float alt) {
|
||||
return (GROUNDDENSITY * pow(
|
||||
((TEMP_GROUND+(TEMP_LAPSE_RATE*alt))/TEMP_GROUND),
|
||||
((AIR_CONST_FACTOR/TEMP_LAPSE_RATE)-1) )
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* calculate air pressure from altitude
|
||||
*/
|
||||
float Il2Bridge::PRESSURE(float alt) {
|
||||
return DENSITY(alt)*(TEMP_GROUND+(alt*TEMP_LAPSE_RATE))*AIR_CONST;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* calculate TAS from IAS and altitude
|
||||
*/
|
||||
float Il2Bridge::TAS(float IAS, float alt) {
|
||||
return (IAS*sqrt(GROUNDDENSITY/DENSITY(alt)));
|
||||
}
|
||||
|
||||
/**
|
||||
* process data string from flight simulator
|
||||
*/
|
||||
void Il2Bridge::processUpdate(QString& data)
|
||||
{
|
||||
// save old flight data to calculate delta's later
|
||||
old=current;
|
||||
|
||||
// Split
|
||||
QStringList fields = data.split("/");
|
||||
|
||||
// split up response string
|
||||
int t;
|
||||
for (t=0; t<fields.length(); t++) {
|
||||
QStringList values = fields[t].split("\\");
|
||||
// parse values
|
||||
if (values.length()>=2) {
|
||||
int id = values[0].toInt();
|
||||
float value = values[1].toFloat();
|
||||
switch (id) {
|
||||
case 30:
|
||||
current.ias=value * KMH2MPS;
|
||||
break;
|
||||
case 32:
|
||||
current.dZ=value;
|
||||
break;
|
||||
case 40:
|
||||
current.Z=value;
|
||||
break;
|
||||
case 42:
|
||||
current.azimuth=value;
|
||||
break;
|
||||
case 46:
|
||||
current.roll=-value;
|
||||
break;
|
||||
case 48:
|
||||
current.pitch=value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// measure time
|
||||
current.dT = ((float)time->restart()) / 1000.0;
|
||||
current.T = old.T+current.dT;
|
||||
|
||||
// calculate TAS from alt and IAS
|
||||
current.tas = TAS(current.ias,current.Z);
|
||||
|
||||
// assume the plane actually flies straight and no wind
|
||||
// groundspeed is horizontal vector of TAS
|
||||
current.groundspeed = current.tas*cos(current.pitch*DEG2RAD);
|
||||
// x and y vector components
|
||||
current.dX = current.groundspeed*sin(current.azimuth*DEG2RAD);
|
||||
current.dY = current.groundspeed*cos(current.azimuth*DEG2RAD);
|
||||
|
||||
// simple IMS - integration over time the easy way...
|
||||
current.X = old.X + (current.dX*current.dT);
|
||||
current.Y = old.Y + (current.dY*current.dT);
|
||||
|
||||
// Update BaroAltitude object
|
||||
BaroAltitude::DataFields baroAltitudeData;
|
||||
baroAltitudeData.Altitude = current.Z;
|
||||
baroAltitudeData.Temperature = TEMP_GROUND + (current.Z * TEMP_LAPSE_RATE) - 273.0;
|
||||
baroAltitudeData.Pressure = PRESSURE(current.Z)/1000.0; // kpa
|
||||
baroAltitude->setData(baroAltitudeData);
|
||||
|
||||
// Update attActual object
|
||||
AttitudeActual::DataFields attActualData;
|
||||
attActualData.Roll = current.roll;
|
||||
attActualData.Pitch = current.pitch;
|
||||
attActualData.Yaw = current.azimuth;
|
||||
attActualData.q1 = 0;
|
||||
attActualData.q2 = 0;
|
||||
attActualData.q3 = 0;
|
||||
attActualData.q4 = 0;
|
||||
attActual->setData(attActualData);
|
||||
|
||||
// Update gps objects
|
||||
PositionActual::DataFields gpsData;
|
||||
gpsData.Altitude = current.Z;
|
||||
gpsData.Heading = current.azimuth;
|
||||
gpsData.Groundspeed = current.groundspeed;
|
||||
gpsData.Latitude = latitude + current.Y * DEG2M;
|
||||
if (gpsData.Latitude<-89.0 or gpsData.Latitude>89.0) {
|
||||
// oops - this is rare enough to just prevent overflow here...
|
||||
// IL2 has no north pole map anyway
|
||||
gpsData.Latitude=0.0;
|
||||
}
|
||||
gpsData.Longitude = longitude + current.X * (1.0/cos(gpsData.Latitude*DEG2RAD)) * DEG2M;
|
||||
while (gpsData.Longitude<-180.0) gpsData.Longitude+=360.0;
|
||||
while (gpsData.Longitude>180.0) gpsData.Longitude-=360.0;
|
||||
gpsData.Satellites = 7;
|
||||
gpsData.Status = PositionActual::STATUS_FIX3D;
|
||||
posActual->setData(gpsData);
|
||||
|
||||
// issue manual update
|
||||
attActual->updated();
|
||||
baroAltitude->updated();
|
||||
posActual->updated();
|
||||
}
|
||||
|
||||
void Il2Bridge::telStatsUpdated(UAVObject* obj)
|
||||
{
|
||||
GCSTelemetryStats::DataFields stats = telStats->getData();
|
||||
if ( !autopilotConnectionStatus && stats.Status == GCSTelemetryStats::STATUS_CONNECTED )
|
||||
{
|
||||
onAutopilotConnect();
|
||||
}
|
||||
else if ( autopilotConnectionStatus && stats.Status != GCSTelemetryStats::STATUS_CONNECTED )
|
||||
{
|
||||
onAutopilotDisconnect();
|
||||
}
|
||||
}
|
@ -1,150 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file il2bridge.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup hitlil2plugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef IL2BRIDGE_H
|
||||
#define IL2BRIDGE_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QUdpSocket>
|
||||
#include <QTimer>
|
||||
#include <QTime>
|
||||
#include <QMessageBox>
|
||||
#include <math.h>
|
||||
#include "uavtalk/telemetrymanager.h"
|
||||
#include "uavobjects/uavobjectmanager.h"
|
||||
#include "uavobjects/actuatordesired.h"
|
||||
#include "uavobjects/baroaltitude.h"
|
||||
#include "uavobjects/attitudeactual.h"
|
||||
#include "uavobjects/positionactual.h"
|
||||
#include "uavobjects/gcstelemetrystats.h"
|
||||
|
||||
|
||||
/**
|
||||
* just imagine this was a class without methods and all public properties
|
||||
*/
|
||||
struct flightParams {
|
||||
|
||||
// time
|
||||
float T;
|
||||
float dT;
|
||||
|
||||
// speed (relative)
|
||||
float ias;
|
||||
float tas;
|
||||
float groundspeed;
|
||||
|
||||
// position (absolute)
|
||||
float X;
|
||||
float Y;
|
||||
float Z;
|
||||
|
||||
// speed (absolute)
|
||||
float dX;
|
||||
float dY;
|
||||
float dZ;
|
||||
|
||||
//angle
|
||||
float azimuth;
|
||||
float pitch;
|
||||
float roll;
|
||||
|
||||
};
|
||||
|
||||
|
||||
class Il2Bridge: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Il2Bridge(QString il2HostName, int il2Port, QString il2Latitude, QString il2Longitude);
|
||||
~Il2Bridge();
|
||||
|
||||
bool isAutopilotConnected();
|
||||
bool isIl2Connected();
|
||||
|
||||
signals:
|
||||
void myStart();
|
||||
void autopilotConnected();
|
||||
void autopilotDisconnected();
|
||||
void il2Connected();
|
||||
void il2Disconnected();
|
||||
|
||||
private slots:
|
||||
void onStart();
|
||||
void transmitUpdate();
|
||||
void receiveUpdate();
|
||||
void onAutopilotConnect();
|
||||
void onAutopilotDisconnect();
|
||||
void onIl2ConnectionTimeout();
|
||||
void telStatsUpdated(UAVObject* obj);
|
||||
|
||||
private:
|
||||
static const float FT2M;
|
||||
static const float KT2MPS;
|
||||
static const float MPS2KMH;
|
||||
static const float KMH2MPS;
|
||||
static const float INHG2KPA;
|
||||
static const float RAD2DEG;
|
||||
static const float DEG2RAD;
|
||||
static const float M2DEG;
|
||||
static const float DEG2M;
|
||||
static const float AIR_CONST;
|
||||
static const float GROUNDDENSITY;
|
||||
static const float TEMP_GROUND;
|
||||
static const float TEMP_LAPSE_RATE;
|
||||
static const float AIR_CONST_FACTOR;
|
||||
|
||||
struct flightParams current;
|
||||
struct flightParams old;
|
||||
QUdpSocket* outSocket;
|
||||
ActuatorDesired* actDesired;
|
||||
BaroAltitude* baroAltitude;
|
||||
AttitudeActual* attActual;
|
||||
PositionActual* posActual;
|
||||
GCSTelemetryStats* telStats;
|
||||
QHostAddress il2Host;
|
||||
float latitude;
|
||||
float longitude;
|
||||
int outPort;
|
||||
int updatePeriod;
|
||||
QTimer* txTimer;
|
||||
QTimer* il2Timer;
|
||||
QTime* time;
|
||||
bool autopilotConnectionStatus;
|
||||
bool il2ConnectionStatus;
|
||||
int il2Timeout;
|
||||
|
||||
float DENSITY(float pressure);
|
||||
float PRESSURE(float alt);
|
||||
float TAS(float ias,float alt);
|
||||
void processUpdate(QString& data);
|
||||
void setupOutputObject(UAVObject* obj, int updatePeriod);
|
||||
void setupInputObject(UAVObject* obj, int updatePeriod);
|
||||
void setupObjects();
|
||||
};
|
||||
|
||||
#endif // IL2BRIDGE_H
|
Loading…
x
Reference in New Issue
Block a user