Commit 8d0f9620 authored by Bryant's avatar Bryant
parents fd7f93df afd634b4
...@@ -4,4 +4,8 @@ ...@@ -4,4 +4,8 @@
| BAT_N_CELLS | 1 | 100 | 3 | 1 | 1 | Number of SERIAL battery cells. Typically this ranges from 2S to 6S in small-scale UAVs | | BAT_N_CELLS | 1 | 100 | 3 | 1 | 1 | Number of SERIAL battery cells. Typically this ranges from 2S to 6S in small-scale UAVs |
| BAT_V_SCALING | 0.001 | 1.0 | 0.00838 | 1 | 1 | Conversion from ADC ticks to battery voltage. Depends on the connected board, calibrate with a multimeter. | | BAT_V_SCALING | 0.001 | 1.0 | 0.00838 | 1 | 1 | Conversion from ADC ticks to battery voltage. Depends on the connected board, calibrate with a multimeter. |
| MC_ATTRATE_P | 0.0 | 20.0 | 0.20 | 1 | 1 | Multirotor attitude rate control P gain. This gain controls how much of the motor thrust should be used to control angular velocity. A larger number will increase the control response, but will make the system also more twitchy. | | MC_ATTRATE_P | 0.0 | 20.0 | 0.20 | 1 | 1 | Multirotor attitude rate control P gain. This gain controls how much of the motor thrust should be used to control angular velocity. A larger number will increase the control response, but will make the system also more twitchy. |
| MC_ATTRATE_D | 0.0 | 20.0 | 0.05 | 1 | 1 | Multirotor attitude rate control D gain. A large value will allow to damp oscillations due to a high P gain, but will make the system response suspectible to noise.|
| MC_ATT_P | 0.0 | 20.0 | 0.20 | 1 | 1 | Multirotor attitude control proportional (P) gain. This defines how strong the response of the system will be to an attitude error|
| MC_ATT_D | 0.0 | 20.0 | 0.05 | 1 | 1 | Multirotor attitude control D gain. A large value will allow to damp oscillations due to a high P gain, but will make the system response suspectible to noise.|
| FW_ROLLRATE_P | 0.0 | 20.0 | 0.30 | 1 | 1 | Fixed wing roll rate control P gain. This gain controls how strong the ailerons or rudder should be actuated in order to achieve a certain roll rate. A larger number will increase the control response, but will make the system also more twitchy. | | FW_ROLLRATE_P | 0.0 | 20.0 | 0.30 | 1 | 1 | Fixed wing roll rate control P gain. This gain controls how strong the ailerons or rudder should be actuated in order to achieve a certain roll rate. A larger number will increase the control response, but will make the system also more twitchy. |
| FW_HEADING_P | 0.0 | 20.0 | 4.00 | 1 | 1 | Fixed wing heading error to bank angle gain |
\ No newline at end of file
...@@ -96,46 +96,39 @@ border: 1px solid #777777; ...@@ -96,46 +96,39 @@ border: 1px solid #777777;
margin-top: 1ex; /* leave space at the top for the title */ margin-top: 1ex; /* leave space at the top for the title */
} }
QDockWidget { QDockWidget::close-button, QDockWidget::float-button {
border: 1px solid #32345E;
/* titlebar-close-icon: url(close.png);
titlebar-normal-icon: url(undock.png);*/
}
QDockWidget::title {
text-align: left; /* align the text to the left */
background: lightgray;
padding-left: 5px;
}
QDockWidget::close-button, QDockWidget::float-button {
border: 1px solid transparent; border: 1px solid transparent;
background: darkgray; background: none;
padding: 0px; padding: 0px;
} }
QDockWidget::close-button:hover, QDockWidget::float-button:hover { QDockWidget::close-button:hover, QDockWidget::float-button:hover {
background: gray; background: none;
} }
QDockWidget::close-button:pressed, QDockWidget::float-button:pressed { QDockWidget::close-button:pressed, QDockWidget::float-button:pressed {
padding: 1px -1px -1px 1px; padding: 1px -1px -1px 1px;
} background: none;
}
QDockWidget::close-button, QDockWidget::float-button { QDockWidget {
background-color: #181820; border: 10px solid #66666B;
color: #EEEEEE; padding: 2px;
margin: 1px;
border-radius: 1px;
/*background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #59666f, stop: 1 #414B52);*/
/* titlebar-close-icon: url(close.png);
titlebar-normal-icon: url(undock.png);*/
} }
QDockWidget::title { QDockWidget::title {
text-align: left; text-align: left;
background: #121214; background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #3F556A, stop: 1 #293645);
color: #4A4A4F; color: #EDEDED;
padding-left: 5px; padding-left: 10px;
height: 10px; height: 14px;
border-bottom: 1px solid #555555; border-bottom: 1px solid #1B1F22;
border-bottom: 2px solid #2C3A4A;
} }
QSeparator { QSeparator {
...@@ -190,31 +183,36 @@ QPushButton { ...@@ -190,31 +183,36 @@ QPushButton {
min-height: 18px; min-height: 18px;
max-height: 18px; max-height: 18px;
min-width: 60px;*/ min-width: 60px;*/
border: 2px solid #4A4A4F; min-height: 20px;
border-radius: 3px; /*min-width: 24px;*/
max-height: 20px;
border: 0px solid #59666f;
border-radius: 2px;
padding-left: 8px; padding-left: 8px;
padding-right: 8px; padding-right: 8px;
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #232228, stop: 1 #020208); background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #59666f, stop: 1 #414B52);
} }
QPushButton:checked { QPushButton:checked {
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #404040, stop: 1 #808080); background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #404040, stop: 1 #808080);
border: 2px solid #379AC3; border: 0px solid #379AC3;
} }
QPushButton:pressed { QPushButton:pressed {
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #bbbbbb, stop: 1 #b0b0b0); background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #bbbbbb, stop: 1 #b0b0b0);
border: 2px solid #379AC3; border: 0px solid #379AC3;
} }
QToolButton { QToolButton {
font-weight: bold; font-weight: bold;
min-height: 18px; min-height: 20px;
min-width: 24px; /*min-width: 24px;*/
max-height: 18px; max-height: 20px;
border: 2px solid #4A4A4F; border: 0px solid #4A4A4F;
border-radius: 3px; border-radius: 2px;
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #232228, stop: 1 #020208); padding-left: 3px;
padding-right: 3px;
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #59666f, stop: 1 #414B52);
} }
QToolButton:checked { QToolButton:checked {
...@@ -228,8 +226,9 @@ QToolButton:pressed { ...@@ -228,8 +226,9 @@ QToolButton:pressed {
} }
QToolTip { QToolTip {
background-color: #090909; background-color: #3D5368;
border: 1px solid #379AC3; border: 0px solid #379AC3;
margin: 3px;
border-radius: 3px; border-radius: 3px;
color: #DDDDDF; color: #DDDDDF;
} }
......
...@@ -224,7 +224,9 @@ FORMS += src/ui/MainWindow.ui \ ...@@ -224,7 +224,9 @@ FORMS += src/ui/MainWindow.ui \
src/ui/mission/QGCMissionDoStartSearch.ui \ src/ui/mission/QGCMissionDoStartSearch.ui \
src/ui/mission/QGCMissionDoFinishSearch.ui \ src/ui/mission/QGCMissionDoFinishSearch.ui \
src/ui/QGCVehicleConfig.ui \ src/ui/QGCVehicleConfig.ui \
src/ui/QGCHilConfiguration.ui src/ui/QGCHilConfiguration.ui \
src/ui/QGCHilFlightGearConfiguration.ui \
src/ui/QGCHilXPlaneConfiguration.ui
INCLUDEPATH += src \ INCLUDEPATH += src \
src/ui \ src/ui \
src/ui/linechart \ src/ui/linechart \
...@@ -362,7 +364,9 @@ HEADERS += src/MG.h \ ...@@ -362,7 +364,9 @@ HEADERS += src/MG.h \
src/ui/mission/QGCMissionDoFinishSearch.h \ src/ui/mission/QGCMissionDoFinishSearch.h \
src/ui/QGCVehicleConfig.h \ src/ui/QGCVehicleConfig.h \
src/comm/QGCHilLink.h \ src/comm/QGCHilLink.h \
src/ui/QGCHilConfiguration.h src/ui/QGCHilConfiguration.h \
src/ui/QGCHilFlightGearConfiguration.h \
src/ui/QGCHilXPlaneConfiguration.h
# Google Earth is only supported on Mac OS and Windows with Visual Studio Compiler # Google Earth is only supported on Mac OS and Windows with Visual Studio Compiler
macx|macx-g++|macx-g++42|win32-msvc2008|win32-msvc2010::HEADERS += src/ui/map3D/QGCGoogleEarthView.h macx|macx-g++|macx-g++42|win32-msvc2008|win32-msvc2010::HEADERS += src/ui/map3D/QGCGoogleEarthView.h
...@@ -520,7 +524,9 @@ SOURCES += src/main.cc \ ...@@ -520,7 +524,9 @@ SOURCES += src/main.cc \
src/ui/mission/QGCMissionDoFinishSearch.cc \ src/ui/mission/QGCMissionDoFinishSearch.cc \
src/ui/QGCVehicleConfig.cc \ src/ui/QGCVehicleConfig.cc \
src/comm/QGCHilLink.cc \ src/comm/QGCHilLink.cc \
src/ui/QGCHilConfiguration.cc src/ui/QGCHilConfiguration.cc \
src/ui/QGCHilFlightGearConfiguration.cc \
src/ui/QGCHilXPlaneConfiguration.cc
# Enable Google Earth only on Mac OS and Windows with Visual Studio compiler # Enable Google Earth only on Mac OS and Windows with Visual Studio compiler
macx|macx-g++|macx-g++42|win32-msvc2008|win32-msvc2010::SOURCES += src/ui/map3D/QGCGoogleEarthView.cc macx|macx-g++|macx-g++42|win32-msvc2008|win32-msvc2010::SOURCES += src/ui/map3D/QGCGoogleEarthView.cc
......
...@@ -39,9 +39,11 @@ This file is part of the QGROUNDCONTROL project ...@@ -39,9 +39,11 @@ This file is part of the QGROUNDCONTROL project
#include <QHostInfo> #include <QHostInfo>
#include "MainWindow.h" #include "MainWindow.h"
QGCFlightGearLink::QGCFlightGearLink(UASInterface* mav, QString remoteHost, QHostAddress host, quint16 port) : QGCFlightGearLink::QGCFlightGearLink(UASInterface* mav, QString startupArguments, QString remoteHost, QHostAddress host, quint16 port) :
process(NULL), process(NULL),
terraSync(NULL), terraSync(NULL),
socket(NULL),
startupArguments(startupArguments),
flightGearVersion(0) flightGearVersion(0)
{ {
this->host = host; this->host = host;
...@@ -349,20 +351,7 @@ bool QGCFlightGearLink::connectSimulation() ...@@ -349,20 +351,7 @@ bool QGCFlightGearLink::connectSimulation()
QString fgRoot; QString fgRoot;
QString fgScenery; QString fgScenery;
QString terraSyncScenery; QString terraSyncScenery;
QString aircraft; QString fgAircraft;
if (mav->getSystemType() == MAV_TYPE_FIXED_WING)
{
aircraft = "Rascal110-JSBSim";
}
else if (mav->getSystemType() == MAV_TYPE_QUADROTOR)
{
aircraft = "arducopter";
}
else
{
aircraft = "Rascal110-JSBSim";
}
#ifdef Q_OS_MACX #ifdef Q_OS_MACX
processFgfs = "/Applications/FlightGear.app/Contents/Resources/fgfs"; processFgfs = "/Applications/FlightGear.app/Contents/Resources/fgfs";
...@@ -387,6 +376,8 @@ bool QGCFlightGearLink::connectSimulation() ...@@ -387,6 +376,8 @@ bool QGCFlightGearLink::connectSimulation()
terraSyncScenery = QDir::homePath() + "/.terrasync/Scenery"; //according to http://wiki.flightgear.org/TerraSync a separate directory is used terraSyncScenery = QDir::homePath() + "/.terrasync/Scenery"; //according to http://wiki.flightgear.org/TerraSync a separate directory is used
#endif #endif
fgAircraft = QApplication::applicationDirPath() + "/files/flightgear/Aircraft";
// Sanity checks // Sanity checks
bool sane = true; bool sane = true;
QFileInfo executable(processFgfs); QFileInfo executable(processFgfs);
...@@ -426,6 +417,7 @@ bool QGCFlightGearLink::connectSimulation() ...@@ -426,6 +417,7 @@ bool QGCFlightGearLink::connectSimulation()
/*Prepare FlightGear Arguments */ /*Prepare FlightGear Arguments */
flightGearArguments << QString("--fg-root=%1").arg(fgRoot); flightGearArguments << QString("--fg-root=%1").arg(fgRoot);
flightGearArguments << QString("--fg-scenery=%1:%2").arg(fgScenery).arg(terraSyncScenery); //according to http://wiki.flightgear.org/TerraSync a separate directory is used flightGearArguments << QString("--fg-scenery=%1:%2").arg(fgScenery).arg(terraSyncScenery); //according to http://wiki.flightgear.org/TerraSync a separate directory is used
flightGearArguments << QString("--fg-aircraft=%1").arg(fgAircraft);
if (mav->getSystemType() == MAV_TYPE_QUADROTOR) if (mav->getSystemType() == MAV_TYPE_QUADROTOR)
{ {
// FIXME ADD QUAD-Specific protocol here // FIXME ADD QUAD-Specific protocol here
...@@ -438,35 +430,37 @@ bool QGCFlightGearLink::connectSimulation() ...@@ -438,35 +430,37 @@ bool QGCFlightGearLink::connectSimulation()
flightGearArguments << QString("--generic=socket,in,50,127.0.0.1,%1,udp,qgroundcontrol").arg(currentPort); flightGearArguments << QString("--generic=socket,in,50,127.0.0.1,%1,udp,qgroundcontrol").arg(currentPort);
} }
flightGearArguments << "--atlas=socket,out,1,localhost,5505,udp"; flightGearArguments << "--atlas=socket,out,1,localhost,5505,udp";
flightGearArguments << "--in-air"; // flightGearArguments << "--in-air";
flightGearArguments << "--roll=0"; // flightGearArguments << "--roll=0";
flightGearArguments << "--pitch=0"; // flightGearArguments << "--pitch=0";
flightGearArguments << "--vc=90"; // flightGearArguments << "--vc=90";
flightGearArguments << "--heading=300"; // flightGearArguments << "--heading=300";
flightGearArguments << "--timeofday=noon"; // flightGearArguments << "--timeofday=noon";
flightGearArguments << "--disable-hud-3d"; // flightGearArguments << "--disable-hud-3d";
flightGearArguments << "--disable-fullscreen"; // flightGearArguments << "--disable-fullscreen";
flightGearArguments << "--geometry=400x300"; // flightGearArguments << "--geometry=400x300";
flightGearArguments << "--disable-anti-alias-hud"; // flightGearArguments << "--disable-anti-alias-hud";
flightGearArguments << "--wind=0@0"; // flightGearArguments << "--wind=0@0";
flightGearArguments << "--turbulence=0.0"; // flightGearArguments << "--turbulence=0.0";
flightGearArguments << "--prop:/sim/frame-rate-throttle-hz=30"; // flightGearArguments << "--prop:/sim/frame-rate-throttle-hz=30";
flightGearArguments << "--control=mouse"; // flightGearArguments << "--control=mouse";
flightGearArguments << "--disable-intro-music"; // flightGearArguments << "--disable-intro-music";
flightGearArguments << "--disable-sound"; // flightGearArguments << "--disable-sound";
flightGearArguments << "--disable-random-objects"; // flightGearArguments << "--disable-random-objects";
flightGearArguments << "--disable-ai-models"; // flightGearArguments << "--disable-ai-models";
flightGearArguments << "--shading-flat"; // flightGearArguments << "--shading-flat";
flightGearArguments << "--fog-disable"; // flightGearArguments << "--fog-disable";
flightGearArguments << "--disable-specular-highlight"; // flightGearArguments << "--disable-specular-highlight";
//flightGearArguments << "--disable-skyblend"; // //flightGearArguments << "--disable-skyblend";
flightGearArguments << "--disable-random-objects"; // flightGearArguments << "--disable-random-objects";
flightGearArguments << "--disable-panel"; // flightGearArguments << "--disable-panel";
//flightGearArguments << "--disable-horizon-effect"; // //flightGearArguments << "--disable-horizon-effect";
flightGearArguments << "--disable-clouds"; // flightGearArguments << "--disable-clouds";
flightGearArguments << "--fdm=jsb"; // flightGearArguments << "--fdm=jsb";
flightGearArguments << "--units-meters"; //XXX: check: the protocol xml has already a conversion from feet to m? // flightGearArguments << "--units-meters"; //XXX: check: the protocol xml has already a conversion from feet to m?
flightGearArguments << "--notrim"; // flightGearArguments << "--notrim";
flightGearArguments += startupArguments.split(" ");
if (mav->getSystemType() == MAV_TYPE_QUADROTOR) if (mav->getSystemType() == MAV_TYPE_QUADROTOR)
{ {
// Start all engines of the quad // Start all engines of the quad
...@@ -483,7 +477,7 @@ bool QGCFlightGearLink::connectSimulation() ...@@ -483,7 +477,7 @@ bool QGCFlightGearLink::connectSimulation()
flightGearArguments << QString("--lon=%1").arg(UASManager::instance()->getHomeLongitude()); flightGearArguments << QString("--lon=%1").arg(UASManager::instance()->getHomeLongitude());
flightGearArguments << QString("--altitude=%1").arg(UASManager::instance()->getHomeAltitude()); flightGearArguments << QString("--altitude=%1").arg(UASManager::instance()->getHomeAltitude());
// Add new argument with this: flightGearArguments << ""; // Add new argument with this: flightGearArguments << "";
flightGearArguments << QString("--aircraft=%2").arg(aircraft); //flightGearArguments << QString("--aircraft=%2").arg(aircraft);
/*Prepare TerraSync Arguments */ /*Prepare TerraSync Arguments */
QStringList terraSyncArguments; QStringList terraSyncArguments;
...@@ -542,6 +536,15 @@ void QGCFlightGearLink::printTerraSyncError() ...@@ -542,6 +536,15 @@ void QGCFlightGearLink::printTerraSyncError()
} }
} }
/**
* @brief Set the startup arguments used to start flightgear
*
**/
void QGCFlightGearLink::setStartupArguments(QString startupArguments)
{
this->startupArguments = startupArguments;
}
/** /**
* @brief Check if connection is active. * @brief Check if connection is active.
* *
......
...@@ -49,7 +49,7 @@ class QGCFlightGearLink : public QGCHilLink ...@@ -49,7 +49,7 @@ class QGCFlightGearLink : public QGCHilLink
//Q_INTERFACES(QGCFlightGearLinkInterface:LinkInterface) //Q_INTERFACES(QGCFlightGearLinkInterface:LinkInterface)
public: public:
QGCFlightGearLink(UASInterface* mav, QString remoteHost=QString("127.0.0.1:49000"), QHostAddress host = QHostAddress::Any, quint16 port = 49005); QGCFlightGearLink(UASInterface* mav, QString startupArguments, QString remoteHost=QString("127.0.0.1:49000"), QHostAddress host = QHostAddress::Any, quint16 port = 49005);
~QGCFlightGearLink(); ~QGCFlightGearLink();
bool isConnected(); bool isConnected();
...@@ -99,6 +99,11 @@ public slots: ...@@ -99,6 +99,11 @@ public slots:
Q_UNUSED(version); Q_UNUSED(version);
} }
void selectAirframe(const QString& airframe)
{
Q_UNUSED(airframe);
}
void readBytes(); void readBytes();
/** /**
* @brief Write a number of bytes to the interface. * @brief Write a number of bytes to the interface.
...@@ -112,6 +117,7 @@ public slots: ...@@ -112,6 +117,7 @@ public slots:
void printTerraSyncOutput(); void printTerraSyncOutput();
void printTerraSyncError(); void printTerraSyncError();
void setStartupArguments(QString startupArguments);
protected: protected:
QString name; QString name;
...@@ -137,6 +143,7 @@ protected: ...@@ -137,6 +143,7 @@ protected:
QProcess* process; QProcess* process;
QProcess* terraSync; QProcess* terraSync;
unsigned int flightGearVersion; unsigned int flightGearVersion;
QString startupArguments;
void setName(QString name); void setName(QString name);
......
...@@ -48,6 +48,8 @@ public slots: ...@@ -48,6 +48,8 @@ public slots:
/** @brief Set the simulator version as text string */ /** @brief Set the simulator version as text string */
virtual void setVersion(const QString& version) = 0; virtual void setVersion(const QString& version) = 0;
virtual void selectAirframe(const QString& airframe) = 0;
virtual void readBytes() = 0; virtual void readBytes() = 0;
/** /**
* @brief Write a number of bytes to the interface. * @brief Write a number of bytes to the interface.
......
...@@ -75,7 +75,7 @@ void QGCXPlaneLink::loadSettings() ...@@ -75,7 +75,7 @@ void QGCXPlaneLink::loadSettings()
settings.beginGroup("QGC_XPLANE_LINK"); settings.beginGroup("QGC_XPLANE_LINK");
setRemoteHost(settings.value("REMOTE_HOST", QString("%1:%2").arg(remoteHost.toString()).arg(remotePort)).toString()); setRemoteHost(settings.value("REMOTE_HOST", QString("%1:%2").arg(remoteHost.toString()).arg(remotePort)).toString());
setVersion(settings.value("XPLANE_VERSION", 10).toInt()); setVersion(settings.value("XPLANE_VERSION", 10).toInt());
selectPlane(settings.value("AIRFRAME", "default").toString()); selectAirframe(settings.value("AIRFRAME", "default").toString());
settings.endGroup(); settings.endGroup();
} }
...@@ -182,7 +182,6 @@ void QGCXPlaneLink::setRemoteHost(const QString& newHost) ...@@ -182,7 +182,6 @@ void QGCXPlaneLink::setRemoteHost(const QString& newHost)
if (newHost.contains(":")) if (newHost.contains(":"))
{ {
//qDebug() << "HOST: " << newHost.split(":").first();
QHostInfo info = QHostInfo::fromName(newHost.split(":").first()); QHostInfo info = QHostInfo::fromName(newHost.split(":").first());
if (info.error() == QHostInfo::NoError) if (info.error() == QHostInfo::NoError)
{ {
...@@ -198,7 +197,6 @@ void QGCXPlaneLink::setRemoteHost(const QString& newHost) ...@@ -198,7 +197,6 @@ void QGCXPlaneLink::setRemoteHost(const QString& newHost)
} }
} }
remoteHost = address; remoteHost = address;
//qDebug() << "Address:" << address.toString();
// Set localPort according to user input // Set localPort according to user input
remotePort = newHost.split(":").last().toInt(); remotePort = newHost.split(":").last().toInt();
} }
...@@ -586,7 +584,7 @@ bool QGCXPlaneLink::disconnectSimulation() ...@@ -586,7 +584,7 @@ bool QGCXPlaneLink::disconnectSimulation()
return !connectState; return !connectState;
} }
void QGCXPlaneLink::selectPlane(const QString& plane) void QGCXPlaneLink::selectAirframe(const QString& plane)
{ {
airframeName = plane; airframeName = plane;
...@@ -718,6 +716,8 @@ void QGCXPlaneLink::setRandomAttitude() ...@@ -718,6 +716,8 @@ void QGCXPlaneLink::setRandomAttitude()
bool QGCXPlaneLink::connectSimulation() bool QGCXPlaneLink::connectSimulation()
{ {
qDebug() << "STARTING X-PLANE LINK, CONNECTING TO" << remoteHost << ":" << remotePort; qDebug() << "STARTING X-PLANE LINK, CONNECTING TO" << remoteHost << ":" << remotePort;
// XXX Hack
storeSettings();
start(LowPriority); start(LowPriority);
...@@ -730,9 +730,6 @@ bool QGCXPlaneLink::connectSimulation() ...@@ -730,9 +730,6 @@ bool QGCXPlaneLink::connectSimulation()
QObject::connect(socket, SIGNAL(readyRead()), this, SLOT(readBytes())); QObject::connect(socket, SIGNAL(readyRead()), this, SLOT(readBytes()));
//process = new QProcess(this);
//terraSync = new QProcess(this);
connect(mav, SIGNAL(hilControlsChanged(uint64_t, float, float, float, float, uint8_t, uint8_t)), this, SLOT(updateControls(uint64_t,float,float,float,float,uint8_t,uint8_t))); connect(mav, SIGNAL(hilControlsChanged(uint64_t, float, float, float, float, uint8_t, uint8_t)), this, SLOT(updateControls(uint64_t,float,float,float,float,uint8_t,uint8_t)));
connect(mav, SIGNAL(hilActuatorsChanged(uint64_t, float, float, float, float, float, float, float, float)), this, SLOT(updateActuators(uint64_t,float,float,float,float,float,float,float,float))); connect(mav, SIGNAL(hilActuatorsChanged(uint64_t, float, float, float, float, float, float, float, float)), this, SLOT(updateActuators(uint64_t,float,float,float,float,float,float,float,float)));
connect(this, SIGNAL(hilStateChanged(uint64_t,float,float,float,float,float,float,int32_t,int32_t,int32_t,int16_t,int16_t,int16_t,int16_t,int16_t,int16_t)), mav, SLOT(sendHilState(uint64_t,float,float,float,float,float,float,int32_t,int32_t,int32_t,int16_t,int16_t,int16_t,int16_t,int16_t,int16_t))); connect(this, SIGNAL(hilStateChanged(uint64_t,float,float,float,float,float,float,int32_t,int32_t,int32_t,int16_t,int16_t,int16_t,int16_t,int16_t,int16_t)), mav, SLOT(sendHilState(uint64_t,float,float,float,float,float,float,int32_t,int32_t,int32_t,int16_t,int16_t,int16_t,int16_t,int16_t,int16_t)));
......
...@@ -130,7 +130,7 @@ public slots: ...@@ -130,7 +130,7 @@ public slots:
* @brief Select airplane model * @brief Select airplane model
* @param plane the name of the airplane * @param plane the name of the airplane
*/ */
void selectPlane(const QString& plane); void selectAirframe(const QString& airframe);
/** /**
* @brief Set the airplane position and attitude * @brief Set the airplane position and attitude
* @param lat * @param lat
......
...@@ -42,7 +42,7 @@ public: ...@@ -42,7 +42,7 @@ public:
virtual double getParamMin(const QString& param) = 0; virtual double getParamMin(const QString& param) = 0;
virtual double getParamMax(const QString& param) = 0; virtual double getParamMax(const QString& param) = 0;
virtual double getParamDefault(const QString& param) = 0; virtual double getParamDefault(const QString& param) = 0;
virtual const QString& getParamInfo(const QString& param) = 0; virtual QString getParamInfo(const QString& param) = 0;
/** @brief Request an update for the parameter list */ /** @brief Request an update for the parameter list */
void requestParameterListUpdate(int component = 0); void requestParameterListUpdate(int component = 0);
......
...@@ -97,7 +97,7 @@ UAS::UAS(MAVLinkProtocol* protocol, int id) : UASInterface(), ...@@ -97,7 +97,7 @@ UAS::UAS(MAVLinkProtocol* protocol, int id) : UASInterface(),
paramManager(NULL), paramManager(NULL),
attitudeStamped(false), attitudeStamped(false),
lastAttitude(0), lastAttitude(0),
simulation(new QGCXPlaneLink(this)), simulation(0),
isLocalPositionKnown(false), isLocalPositionKnown(false),
isGlobalPositionKnown(false), isGlobalPositionKnown(false),
systemIsArmed(false), systemIsArmed(false),
...@@ -2263,18 +2263,13 @@ void UAS::setParameter(const int component, const QString& id, const QVariant& v ...@@ -2263,18 +2263,13 @@ void UAS::setParameter(const int component, const QString& id, const QVariant& v
for (unsigned int i = 0; i < sizeof(p.param_id); i++) for (unsigned int i = 0; i < sizeof(p.param_id); i++)
{ {
// String characters // String characters
if ((int)i < id.length() && i < (sizeof(p.param_id) - 1)) if ((int)i < id.length())
{ {
p.param_id[i] = id.toAscii()[i]; p.param_id[i] = id.toAscii()[i];
} }
// // Null termination at end of string or end of buffer
// else if ((int)i == id.length() || i == (sizeof(p.param_id) - 1))
// {
// p.param_id[i] = '\0';
// }
// Zero fill
else else
{ {
// Fill rest with zeros
p.param_id[i] = 0; p.param_id[i] = 0;
} }
} }
...@@ -2588,14 +2583,24 @@ bool UAS::emergencyKILL() ...@@ -2588,14 +2583,24 @@ bool UAS::emergencyKILL()
} }
/** /**
* If enabled, connect the fligth gear link. * If enabled, connect the flight gear link.
*/ */
void UAS::enableHilFlightGear(bool enable) void UAS::enableHilFlightGear(bool enable, QString options)
{ {
QGCFlightGearLink* link = dynamic_cast<QGCFlightGearLink*>(simulation);
if (!link || !simulation) {
// Delete wrong sim
if (simulation) {
stopHil();
delete simulation;
}
simulation = new QGCFlightGearLink(this, options);
}
// Connect Flight Gear Link // Connect Flight Gear Link
link = dynamic_cast<QGCFlightGearLink*>(simulation);
link->setStartupArguments(options);
if (enable) if (enable)
{ {
simulation = new QGCFlightGearLink(this);
startHil(); startHil();
} }
else else
...@@ -2605,11 +2610,20 @@ void UAS::enableHilFlightGear(bool enable) ...@@ -2605,11 +2610,20 @@ void UAS::enableHilFlightGear(bool enable)
} }
/** /**
* If enabled, connect the fligth gear link. * If enabled, connect the X-plane gear link.
*/ */
void UAS::enableHilXPlane(bool enable) void UAS::enableHilXPlane(bool enable)
{ {
// Connect Flight Gear Link QGCXPlaneLink* link = dynamic_cast<QGCXPlaneLink*>(simulation);
if (!link || !simulation) {
if (simulation) {
stopHil();
delete simulation;
}
qDebug() << "CREATED NEW XPLANE LINK";
simulation = new QGCXPlaneLink(this);
}
// Connect X-Plane Link
if (enable) if (enable)
{ {
startHil(); startHil();
...@@ -2679,7 +2693,7 @@ void UAS::startHil() ...@@ -2679,7 +2693,7 @@ void UAS::startHil()
*/ */
void UAS::stopHil() void UAS::stopHil()
{ {
simulation->disconnectSimulation(); if (simulation) simulation->disconnectSimulation();
mavlink_message_t msg; mavlink_message_t msg;
mavlink_msg_set_mode_pack(mavlink->getSystemId(), mavlink->getComponentId(), &msg, this->getUASID(), mode & !MAV_MODE_FLAG_HIL_ENABLED, navMode); mavlink_msg_set_mode_pack(mavlink->getSystemId(), mavlink->getComponentId(), &msg, this->getUASID(), mode & !MAV_MODE_FLAG_HIL_ENABLED, navMode);
sendMessage(msg); sendMessage(msg);
......
...@@ -531,7 +531,7 @@ public slots: ...@@ -531,7 +531,7 @@ public slots:
void go(); void go();
/** @brief Enable / disable HIL */ /** @brief Enable / disable HIL */
void enableHilFlightGear(bool enable); void enableHilFlightGear(bool enable, QString options);
void enableHilXPlane(bool enable); void enableHilXPlane(bool enable);
......
...@@ -108,8 +108,8 @@ HSIDisplay::HSIDisplay(QWidget *parent) : ...@@ -108,8 +108,8 @@ HSIDisplay::HSIDisplay(QWidget *parent) :
laserFix(0), laserFix(0),
iruFix(0), iruFix(0),
mavInitialized(false), mavInitialized(false),
topMargin(12.0f), topMargin(18.0f),
bottomMargin(10.0f), bottomMargin(12.0f),
attControlKnown(false), attControlKnown(false),
xyControlKnown(false), xyControlKnown(false),
zControlKnown(false), zControlKnown(false),
......
...@@ -70,7 +70,7 @@ HUD::HUD(int width, int height, QWidget* parent) ...@@ -70,7 +70,7 @@ HUD::HUD(int width, int height, QWidget* parent)
yCenterOffset(0.0f), yCenterOffset(0.0f),
vwidth(200.0f), vwidth(200.0f),
vheight(150.0f), vheight(150.0f),
vGaugeSpacing(50.0f), vGaugeSpacing(65.0f),
vPitchPerDeg(6.0f), ///< 4 mm y translation per degree) vPitchPerDeg(6.0f), ///< 4 mm y translation per degree)
rawBuffer1(NULL), rawBuffer1(NULL),
rawBuffer2(NULL), rawBuffer2(NULL),
...@@ -335,7 +335,7 @@ void HUD::updateAttitude(UASInterface* uas, int component, double roll, double p ...@@ -335,7 +335,7 @@ void HUD::updateAttitude(UASInterface* uas, int component, double roll, double p
void HUD::updateBattery(UASInterface* uas, double voltage, double percent, int seconds) void HUD::updateBattery(UASInterface* uas, double voltage, double percent, int seconds)
{ {
Q_UNUSED(uas); Q_UNUSED(uas);
fuelStatus = tr("BAT [%1% | %2V] (%3:%4)").arg(percent, 2, 'f', 0, QChar('0')).arg(voltage, 4, 'f', 1, QChar('0')).arg(seconds/60, 2, 10, QChar('0')).arg(seconds%60, 2, 10, QChar('0')); fuelStatus = tr("BAT [%1% | %2V]").arg(percent, 2, 'f', 0, QChar('0')).arg(voltage, 4, 'f', 1, QChar('0'));
if (percent < 20.0f) { if (percent < 20.0f) {
fuelColor = warningColor; fuelColor = warningColor;
} else if (percent < 10.0f) { } else if (percent < 10.0f) {
...@@ -622,7 +622,7 @@ void HUD::paintHUD() ...@@ -622,7 +622,7 @@ void HUD::paintHUD()
// Low-pass roll, pitch and yaw // Low-pass roll, pitch and yaw
rollLP = roll;//rollLP * 0.2f + 0.8f * roll; rollLP = roll;//rollLP * 0.2f + 0.8f * roll;
pitchLP = pitch;//pitchLP * 0.2f + 0.8f * pitch; pitchLP = pitch;//pitchLP * 0.2f + 0.8f * pitch;
yawLP = yaw;//yawLP * 0.2f + 0.8f * yaw; yawLP = (!isinf(yaw) && !isnan(yaw)) ? yaw : yawLP;//yawLP * 0.2f + 0.8f * yaw;
// Translate for yaw // Translate for yaw
const float maxYawTrans = 60.0f; const float maxYawTrans = 60.0f;
...@@ -650,6 +650,8 @@ void HUD::paintHUD() ...@@ -650,6 +650,8 @@ void HUD::paintHUD()
// Negate to correct direction // Negate to correct direction
yawTrans = -yawTrans; yawTrans = -yawTrans;
yawTrans = 0;
//qDebug() << "yaw translation" << yawTrans << "integral" << yawInt << "difference" << yawDiff << "yaw" << yaw; //qDebug() << "yaw translation" << yawTrans << "integral" << yawInt << "difference" << yawDiff << "yaw" << yaw;
// Update scaling factor // Update scaling factor
...@@ -714,20 +716,20 @@ void HUD::paintHUD() ...@@ -714,20 +716,20 @@ void HUD::paintHUD()
painter.setRenderHint(QPainter::HighQualityAntialiasing, true); painter.setRenderHint(QPainter::HighQualityAntialiasing, true);
painter.translate((this->vwidth/2.0+xCenterOffset)*scalingFactor, (this->vheight/2.0+yCenterOffset)*scalingFactor); painter.translate((this->vwidth/2.0+xCenterOffset)*scalingFactor, (this->vheight/2.0+yCenterOffset)*scalingFactor);
// COORDINATE FRAME IS NOW (0,0) at CENTER OF WIDGET // COORDINATE FRAME IS NOW (0,0) at CENTER OF WIDGET
// Draw all fixed indicators // Draw all fixed indicators
// MODE
paintText(mode, infoColor, 2.0f, (-vwidth/2.0) + 10, -vheight/2.0 + 10, &painter);
// STATE
paintText(state, infoColor, 2.0f, (-vwidth/2.0) + 10, -vheight/2.0 + 15, &painter);
// BATTERY // BATTERY
paintText(fuelStatus, fuelColor, 2.0f, (-vwidth/2.0) + 10, -vheight/2.0 + 20, &painter); paintText(fuelStatus, fuelColor, 6.0f, (-vwidth/2.0) + 10, -vheight/2.0 + 6, &painter);
// Waypoint // Waypoint
paintText(waypointName, defaultColor, 2.0f, (-vwidth/3.0) + 10, +vheight/3.0 + 15, &painter); paintText(waypointName, defaultColor, 6.0f, (-vwidth/3.0) + 10, +vheight/3.0 + 15, &painter);
QPen linePen(Qt::SolidLine);
linePen.setWidth(refLineWidthToPen(1.0f));
linePen.setColor(defaultColor);
painter.setBrush(Qt::NoBrush);
painter.setPen(linePen);
// YAW INDICATOR // YAW INDICATOR
// //
...@@ -735,15 +737,15 @@ void HUD::paintHUD() ...@@ -735,15 +737,15 @@ void HUD::paintHUD()
// . . // . .
// ....... // .......
// //
const float yawIndicatorWidth = 4.0f; const float yawIndicatorWidth = 12.0f;
const float yawIndicatorY = vheight/2.0f - 10.0f; const float yawIndicatorY = vheight/2.0f - 15.0f;
QPolygon yawIndicator(4); QPolygon yawIndicator(4);
yawIndicator.setPoint(0, QPoint(refToScreenX(0.0f), refToScreenY(yawIndicatorY))); yawIndicator.setPoint(0, QPoint(refToScreenX(0.0f), refToScreenY(yawIndicatorY)));
yawIndicator.setPoint(1, QPoint(refToScreenX(yawIndicatorWidth/2.0f), refToScreenY(yawIndicatorY+yawIndicatorWidth))); yawIndicator.setPoint(1, QPoint(refToScreenX(yawIndicatorWidth/2.0f), refToScreenY(yawIndicatorY+yawIndicatorWidth)));
yawIndicator.setPoint(2, QPoint(refToScreenX(-yawIndicatorWidth/2.0f), refToScreenY(yawIndicatorY+yawIndicatorWidth))); yawIndicator.setPoint(2, QPoint(refToScreenX(-yawIndicatorWidth/2.0f), refToScreenY(yawIndicatorY+yawIndicatorWidth)));
yawIndicator.setPoint(3, QPoint(refToScreenX(0.0f), refToScreenY(yawIndicatorY))); yawIndicator.setPoint(3, QPoint(refToScreenX(0.0f), refToScreenY(yawIndicatorY)));
painter.setPen(defaultColor);
painter.drawPolyline(yawIndicator); painter.drawPolyline(yawIndicator);
painter.setPen(linePen);
// CENTER // CENTER
...@@ -752,7 +754,7 @@ void HUD::paintHUD() ...@@ -752,7 +754,7 @@ void HUD::paintHUD()
// __ __ // __ __
// \/\/ // \/\/
// //
const float hIndicatorWidth = 7.0f; const float hIndicatorWidth = 20.0f;
const float hIndicatorY = -25.0f; const float hIndicatorY = -25.0f;
const float hIndicatorYLow = hIndicatorY + hIndicatorWidth / 6.0f; const float hIndicatorYLow = hIndicatorY + hIndicatorWidth / 6.0f;
const float hIndicatorSegmentWidth = hIndicatorWidth / 7.0f; const float hIndicatorSegmentWidth = hIndicatorWidth / 7.0f;
...@@ -764,18 +766,15 @@ void HUD::paintHUD() ...@@ -764,18 +766,15 @@ void HUD::paintHUD()
hIndicator.setPoint(4, QPoint(refToScreenX(0.0f+hIndicatorSegmentWidth*1.0f), refToScreenY(hIndicatorYLow))); hIndicator.setPoint(4, QPoint(refToScreenX(0.0f+hIndicatorSegmentWidth*1.0f), refToScreenY(hIndicatorYLow)));
hIndicator.setPoint(5, QPoint(refToScreenX(0.0f+hIndicatorWidth/2.0f-hIndicatorSegmentWidth*1.75f), refToScreenY(hIndicatorY))); hIndicator.setPoint(5, QPoint(refToScreenX(0.0f+hIndicatorWidth/2.0f-hIndicatorSegmentWidth*1.75f), refToScreenY(hIndicatorY)));
hIndicator.setPoint(6, QPoint(refToScreenX(0.0f+hIndicatorWidth/2.0f), refToScreenY(hIndicatorY))); hIndicator.setPoint(6, QPoint(refToScreenX(0.0f+hIndicatorWidth/2.0f), refToScreenY(hIndicatorY)));
painter.setPen(defaultColor);
painter.drawPolyline(hIndicator); painter.drawPolyline(hIndicator);
// SETPOINT // SETPOINT
const float centerWidth = 4.0f; const float centerWidth = 8.0f;
painter.setPen(defaultColor);
painter.setBrush(Qt::NoBrush);
// TODO // TODO
//painter.drawEllipse(QPointF(refToScreenX(qMin(10.0f, values.value("roll desired", 0.0f) * 10.0f)), refToScreenY(qMin(10.0f, values.value("pitch desired", 0.0f) * 10.0f))), refToScreenX(centerWidth/2.0f), refToScreenX(centerWidth/2.0f)); //painter.drawEllipse(QPointF(refToScreenX(qMin(10.0f, values.value("roll desired", 0.0f) * 10.0f)), refToScreenY(qMin(10.0f, values.value("pitch desired", 0.0f) * 10.0f))), refToScreenX(centerWidth/2.0f), refToScreenX(centerWidth/2.0f));
const float centerCrossWidth = 10.0f; const float centerCrossWidth = 20.0f;
// left // left
painter.drawLine(QPointF(refToScreenX(-centerWidth / 2.0f), refToScreenY(0.0f)), QPointF(refToScreenX(-centerCrossWidth / 2.0f), refToScreenY(0.0f))); painter.drawLine(QPointF(refToScreenX(-centerWidth / 2.0f), refToScreenY(0.0f)), QPointF(refToScreenX(-centerCrossWidth / 2.0f), refToScreenY(0.0f)));
// right // right
...@@ -786,12 +785,11 @@ void HUD::paintHUD() ...@@ -786,12 +785,11 @@ void HUD::paintHUD()
// COMPASS // COMPASS
const float compassY = -vheight/2.0f + 10.0f; const float compassY = -vheight/2.0f + 6.0f;
QRectF compassRect(QPointF(refToScreenX(-5.0f), refToScreenY(compassY)), QSizeF(refToScreenX(10.0f), refToScreenY(5.0f))); QRectF compassRect(QPointF(refToScreenX(-12.0f), refToScreenY(compassY)), QSizeF(refToScreenX(24.0f), refToScreenY(12.0f)));
painter.setBrush(Qt::NoBrush); painter.setBrush(Qt::NoBrush);
painter.setPen(Qt::SolidLine); painter.setPen(linePen);
painter.setPen(defaultColor); painter.drawRoundedRect(compassRect, 3, 3);
painter.drawRoundedRect(compassRect, 2, 2);
QString yawAngle; QString yawAngle;
// const float yawDeg = ((values.value("yaw", 0.0f)/M_PI)*180.0f)+180.f; // const float yawDeg = ((values.value("yaw", 0.0f)/M_PI)*180.0f)+180.f;
...@@ -803,13 +801,16 @@ void HUD::paintHUD() ...@@ -803,13 +801,16 @@ void HUD::paintHUD()
/* final safeguard for really stupid systems */ /* final safeguard for really stupid systems */
int yawCompass = static_cast<int>(yawDeg) % 360; int yawCompass = static_cast<int>(yawDeg) % 360;
yawAngle.sprintf("%03d", yawCompass); yawAngle.sprintf("%03d", yawCompass);
paintText(yawAngle, defaultColor, 3.5f, -4.3f, compassY+ 0.97f, &painter); paintText(yawAngle, defaultColor,8.5f, -9.8f, compassY+ 1.7f, &painter);
painter.setBrush(Qt::NoBrush);
painter.setPen(linePen);
// CHANGE RATE STRIPS // CHANGE RATE STRIPS
drawChangeRateStrip(-51.0f, -50.0f, 15.0f, -1.0f, 1.0f, -zSpeed, &painter); drawChangeRateStrip(-65.0f, -60.0f, 25.0f, -10.0f, 10.0f, -zSpeed, &painter);
// CHANGE RATE STRIPS // CHANGE RATE STRIPS
drawChangeRateStrip(49.0f, -50.0f, 15.0f, -1.0f, 1.0f, totalAcc, &painter); drawChangeRateStrip(65.0f, -60.0f, 25.0f, -10.0f, 10.0f, totalAcc, &painter);
// GAUGES // GAUGES
...@@ -822,10 +823,15 @@ void HUD::paintHUD() ...@@ -822,10 +823,15 @@ void HUD::paintHUD()
gaugeAltitude = -zPos; gaugeAltitude = -zPos;
} }
drawChangeIndicatorGauge(-vGaugeSpacing, -15.0f, 10.0f, 2.0f, gaugeAltitude, defaultColor, &painter, false); painter.setBrush(Qt::NoBrush);
painter.setPen(linePen);
drawChangeIndicatorGauge(-vGaugeSpacing, 35.0f, 30.0f, 10.0f, gaugeAltitude, defaultColor, &painter, false);
paintText("alt m", defaultColor, 5.5f, -73.0f, 50, &painter);
// Right speed gauge // Right speed gauge
drawChangeIndicatorGauge(vGaugeSpacing, -15.0f, 10.0f, 5.0f, totalSpeed, defaultColor, &painter, false); drawChangeIndicatorGauge(vGaugeSpacing, 35.0f, 30.0f, 10.0f, totalSpeed, defaultColor, &painter, false);
paintText("v m/s", defaultColor, 5.5f, 55.0f, 50, &painter);
// Waypoint name // Waypoint name
...@@ -961,8 +967,8 @@ void HUD::paintPitchLinePos(QString text, float refPosX, float refPosY, QPainter ...@@ -961,8 +967,8 @@ void HUD::paintPitchLinePos(QString text, float refPosX, float refPosY, QPainter
const float pitchWidth = 30.0f; const float pitchWidth = 30.0f;
const float pitchGap = pitchWidth / 2.5f; const float pitchGap = pitchWidth / 2.5f;
const float pitchHeight = pitchWidth / 12.0f; const float pitchHeight = pitchWidth / 12.0f;
const float textSize = pitchHeight * 1.1f; const float textSize = pitchHeight * 1.6f;
const float lineWidth = 0.5f; const float lineWidth = 1.5f;
// Positive pitch indicator: // Positive pitch indicator:
// //
...@@ -975,7 +981,7 @@ void HUD::paintPitchLinePos(QString text, float refPosX, float refPosY, QPainter ...@@ -975,7 +981,7 @@ void HUD::paintPitchLinePos(QString text, float refPosX, float refPosY, QPainter
// Left horizontal line // Left horizontal line
drawLine(refPosX-pitchWidth/2.0f, refPosY, refPosX-pitchGap/2.0f, refPosY, lineWidth, defaultColor, painter); drawLine(refPosX-pitchWidth/2.0f, refPosY, refPosX-pitchGap/2.0f, refPosY, lineWidth, defaultColor, painter);
// Text left // Text left
paintText(text, defaultColor, textSize, refPosX-pitchWidth/2.0 + 0.75f, refPosY + pitchHeight - 1.75f, painter); paintText(text, defaultColor, textSize, refPosX-pitchWidth/2.0 + 0.75f, refPosY + pitchHeight - 1.3f, painter);
// Right vertical line // Right vertical line
drawLine(refPosX+pitchWidth/2.0f, refPosY, refPosX+pitchWidth/2.0f, refPosY+pitchHeight, lineWidth, defaultColor, painter); drawLine(refPosX+pitchWidth/2.0f, refPosY, refPosX+pitchWidth/2.0f, refPosY+pitchHeight, lineWidth, defaultColor, painter);
...@@ -988,10 +994,10 @@ void HUD::paintPitchLineNeg(QString text, float refPosX, float refPosY, QPainter ...@@ -988,10 +994,10 @@ void HUD::paintPitchLineNeg(QString text, float refPosX, float refPosY, QPainter
const float pitchWidth = 30.0f; const float pitchWidth = 30.0f;
const float pitchGap = pitchWidth / 2.5f; const float pitchGap = pitchWidth / 2.5f;
const float pitchHeight = pitchWidth / 12.0f; const float pitchHeight = pitchWidth / 12.0f;
const float textSize = pitchHeight * 1.1f; const float textSize = pitchHeight * 1.6f;
const float segmentWidth = ((pitchWidth - pitchGap)/2.0f) / 7.0f; ///< Four lines and three gaps -> 7 segments const float segmentWidth = ((pitchWidth - pitchGap)/2.0f) / 7.0f; ///< Four lines and three gaps -> 7 segments
const float lineWidth = 0.1f; const float lineWidth = 1.5f;
// Negative pitch indicator: // Negative pitch indicator:
// //
...@@ -1007,7 +1013,7 @@ void HUD::paintPitchLineNeg(QString text, float refPosX, float refPosY, QPainter ...@@ -1007,7 +1013,7 @@ void HUD::paintPitchLineNeg(QString text, float refPosX, float refPosY, QPainter
drawLine(refPosX-pitchWidth/2.0+(i*segmentWidth), refPosY, refPosX-pitchWidth/2.0+(i*segmentWidth)+segmentWidth, refPosY, lineWidth, defaultColor, painter); drawLine(refPosX-pitchWidth/2.0+(i*segmentWidth), refPosY, refPosX-pitchWidth/2.0+(i*segmentWidth)+segmentWidth, refPosY, lineWidth, defaultColor, painter);
} }
// Text left // Text left
paintText(text, defaultColor, textSize, refPosX-pitchWidth/2.0f + 0.75f, refPosY + pitchHeight - 1.75f, painter); paintText(text, defaultColor, textSize, refPosX-pitchWidth/2.0f + 0.75f, refPosY + pitchHeight - 1.3f, painter);
// Right vertical line // Right vertical line
drawLine(refPosX+pitchGap/2.0, refPosY, refPosX+pitchGap/2.0, refPosY-pitchHeight, lineWidth, defaultColor, painter); drawLine(refPosX+pitchGap/2.0, refPosY, refPosX+pitchGap/2.0, refPosY-pitchHeight, lineWidth, defaultColor, painter);
...@@ -1080,13 +1086,6 @@ void HUD::drawPolygon(QPolygonF refPolygon, QPainter* painter) ...@@ -1080,13 +1086,6 @@ void HUD::drawPolygon(QPolygonF refPolygon, QPainter* painter)
void HUD::drawChangeRateStrip(float xRef, float yRef, float height, float minRate, float maxRate, float value, QPainter* painter) void HUD::drawChangeRateStrip(float xRef, float yRef, float height, float minRate, float maxRate, float value, QPainter* painter)
{ {
QBrush brush(defaultColor, Qt::NoBrush);
painter->setBrush(brush);
QPen rectPen(Qt::SolidLine);
rectPen.setWidth(0);
rectPen.setColor(defaultColor);
painter->setPen(rectPen);
float scaledValue = value; float scaledValue = value;
// Saturate value // Saturate value
...@@ -1105,7 +1104,7 @@ void HUD::drawChangeRateStrip(float xRef, float yRef, float height, float minRat ...@@ -1105,7 +1104,7 @@ void HUD::drawChangeRateStrip(float xRef, float yRef, float height, float minRat
// - // -
const float width = height / 8.0f; const float width = height / 8.0f;
const float lineWidth = 0.5f; const float lineWidth = 1.5f;
// Indicator lines // Indicator lines
// Top horizontal line // Top horizontal line
...@@ -1120,7 +1119,7 @@ void HUD::drawChangeRateStrip(float xRef, float yRef, float height, float minRat ...@@ -1120,7 +1119,7 @@ void HUD::drawChangeRateStrip(float xRef, float yRef, float height, float minRat
// Text // Text
QString label; QString label;
label.sprintf("< %+06.2f", value); label.sprintf("< %+06.2f", value);
paintText(label, defaultColor, 3.0f, xRef+width/2.0f, yRef+height-((scaledValue - minRate)/(maxRate-minRate))*height - 1.6f, painter); paintText(label, defaultColor, 6.0f, xRef+width/2.0f, yRef+height-((scaledValue - minRate)/(maxRate-minRate))*height - 1.6f, painter);
} }
//void HUD::drawSystemIndicator(float xRef, float yRef, int maxNum, float maxWidth, float maxHeight, QPainter* painter) //void HUD::drawSystemIndicator(float xRef, float yRef, int maxNum, float maxWidth, float maxHeight, QPainter* painter)
...@@ -1205,17 +1204,19 @@ void HUD::drawChangeIndicatorGauge(float xRef, float yRef, float radius, float e ...@@ -1205,17 +1204,19 @@ void HUD::drawChangeIndicatorGauge(float xRef, float yRef, float radius, float e
// Draw the circle // Draw the circle
QPen circlePen(Qt::SolidLine); QPen circlePen(Qt::SolidLine);
if (!solid) circlePen.setStyle(Qt::DotLine); if (!solid) circlePen.setStyle(Qt::DotLine);
circlePen.setWidth(refLineWidthToPen(0.5f));
circlePen.setColor(defaultColor); circlePen.setColor(defaultColor);
circlePen.setWidth(refLineWidthToPen(2.0f));
painter->setBrush(Qt::NoBrush); painter->setBrush(Qt::NoBrush);
painter->setPen(circlePen); painter->setPen(circlePen);
drawCircle(xRef, yRef, radius, 200.0f, 170.0f, 1.0f, color, painter); drawCircle(xRef, yRef, radius, 200.0f, 170.0f, 1.5f, color, painter);
QString label; QString label;
label.sprintf("%05.1f", value); label.sprintf("%05.1f", value);
float textSize = radius / 2.5;
// Draw the value // Draw the value
paintText(label, color, 4.5f, xRef-7.5f, yRef-2.0f, painter); paintText(label, color, textSize, xRef-textSize*1.7f, yRef-textSize*0.4f, painter);
// Draw the needle // Draw the needle
// Scale the rotation so that the gauge does one revolution // Scale the rotation so that the gauge does one revolution
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
<number>10</number> <number>10</number>
</property> </property>
<widget class="QWidget" name="curveGroupBox" native="true"> <widget class="QWidget" name="curveGroupBox" native="true">
<layout class="QGridLayout" name="gridLayout" rowstretch="50,1"> <layout class="QGridLayout" name="gridLayout" rowstretch="50,0">
<property name="leftMargin"> <property name="leftMargin">
<number>6</number> <number>6</number>
</property> </property>
...@@ -103,8 +103,8 @@ ...@@ -103,8 +103,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>202</width> <width>884</width>
<height>488</height> <height>491</height>
</rect> </rect>
</property> </property>
</widget> </widget>
...@@ -164,6 +164,28 @@ ...@@ -164,6 +164,28 @@
</item> </item>
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_4"> <layout class="QVBoxLayout" name="verticalLayout_4">
<property name="spacing">
<number>0</number>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item> <item>
<widget class="QPushButton" name="recolorButton"> <widget class="QPushButton" name="recolorButton">
<property name="toolTip"> <property name="toolTip">
......
...@@ -37,6 +37,7 @@ This file is part of the QGROUNDCONTROL project ...@@ -37,6 +37,7 @@ This file is part of the QGROUNDCONTROL project
#include <QSplashScreen> #include <QSplashScreen>
#include <QGCHilLink.h> #include <QGCHilLink.h>
#include <QGCHilConfiguration.h> #include <QGCHilConfiguration.h>
#include <QGCHilFlightGearConfiguration.h>
#include "QGC.h" #include "QGC.h"
#include "MAVLinkSimulationLink.h" #include "MAVLinkSimulationLink.h"
...@@ -643,6 +644,26 @@ void MainWindow::showCentralWidget() ...@@ -643,6 +644,26 @@ void MainWindow::showCentralWidget()
centerStack->setCurrentWidget(widget); centerStack->setCurrentWidget(widget);
} }
void MainWindow::showHILConfigurationWidget(UASInterface* uas)
{
// Add simulation configuration widget
UAS* mav = dynamic_cast<UAS*>(uas);
if (mav)
{
QGCHilConfiguration* hconf = new QGCHilConfiguration(mav, this);
QString hilDockName = tr("HIL Config (%1)").arg(uas->getUASName());
QDockWidget* hilDock = new QDockWidget(hilDockName, this);
hilDock->setWidget(hconf);
hilDock->setObjectName(QString("HIL_CONFIG_%1").arg(uas->getUASID()));
addTool(hilDock, hilDockName, Qt::RightDockWidgetArea);
}
// Reload view state in case new widgets were added
loadViewState();
}
void MainWindow::closeEvent(QCloseEvent *event) void MainWindow::closeEvent(QCloseEvent *event)
{ {
if (isVisible()) storeViewState(); if (isVisible()) storeViewState();
...@@ -1424,19 +1445,6 @@ void MainWindow::UASCreated(UASInterface* uas) ...@@ -1424,19 +1445,6 @@ void MainWindow::UASCreated(UASInterface* uas)
if (!ui.menuConnected_Systems->isEnabled()) ui.menuConnected_Systems->setEnabled(true); if (!ui.menuConnected_Systems->isEnabled()) ui.menuConnected_Systems->setEnabled(true);
if (!ui.menuUnmanned_System->isEnabled()) ui.menuUnmanned_System->setEnabled(true); if (!ui.menuUnmanned_System->isEnabled()) ui.menuUnmanned_System->setEnabled(true);
// Add simulation configuration widget
UAS* mav = dynamic_cast<UAS*>(uas);
if (mav)
{
QGCHilConfiguration* hconf = new QGCHilConfiguration(mav->getHILSimulation(), this);
QString hilDockName = tr("HIL Config (%1)").arg(uas->getUASName());
QDockWidget* hilDock = new QDockWidget(hilDockName, this);
hilDock->setWidget(hconf);
hilDock->setObjectName(QString("HIL_CONFIG_%1").arg(uas->getUASID()));
addTool(hilDock, hilDockName, Qt::RightDockWidgetArea);
}
// Reload view state in case new widgets were added // Reload view state in case new widgets were added
loadViewState(); loadViewState();
} }
......
...@@ -201,6 +201,9 @@ public slots: ...@@ -201,6 +201,9 @@ public slots:
/** @brief Load custom widgets from default file */ /** @brief Load custom widgets from default file */
void loadCustomWidgetsFromDefaults(const QString& systemType, const QString& autopilotType); void loadCustomWidgetsFromDefaults(const QString& systemType, const QString& autopilotType);
/** @brief Loads and shows the HIL Configuration Widget for the given UAS*/
void showHILConfigurationWidget(UASInterface *uas);
void closeEvent(QCloseEvent* event); void closeEvent(QCloseEvent* event);
/** @brief Load data view, allowing to plot flight data */ /** @brief Load data view, allowing to plot flight data */
......
#include "QGCHilConfiguration.h" #include "QGCHilConfiguration.h"
#include "ui_QGCHilConfiguration.h" #include "ui_QGCHilConfiguration.h"
#include "QGCXPlaneLink.h"
QGCHilConfiguration::QGCHilConfiguration(QGCHilLink* link, QWidget *parent) : #include "QGCHilFlightGearConfiguration.h"
#include "QGCHilXPlaneConfiguration.h"
QGCHilConfiguration::QGCHilConfiguration(UAS *mav, QWidget *parent) :
QWidget(parent), QWidget(parent),
link(link), mav(mav),
ui(new Ui::QGCHilConfiguration) ui(new Ui::QGCHilConfiguration)
{ {
ui->setupUi(this); ui->setupUi(this);
connect(ui->startButton, SIGNAL(clicked(bool)), this, SLOT(toggleSimulation(bool)));
connect(ui->hostComboBox, SIGNAL(activated(QString)), link, SLOT(setRemoteHost(QString)));
connect(link, SIGNAL(remoteChanged(QString)), ui->hostComboBox, SLOT(setEditText(QString)));
connect(link, SIGNAL(statusMessage(QString)), this, SLOT(receiveStatusMessage(QString)));
connect(link, SIGNAL(versionChanged(QString)), ui->simComboBox, SLOT(setEditText(QString)));
connect(ui->simComboBox, SIGNAL(activated(QString)), link, SLOT(setVersion(QString)));
ui->simComboBox->setEditText(link->getVersion());
ui->startButton->setText(tr("Connect"));
QGCXPlaneLink* xplane = dynamic_cast<QGCXPlaneLink*>(link);
if (xplane)
{
connect(ui->randomAttitudeButton, SIGNAL(clicked()), link, SLOT(setRandomAttitude()));
connect(ui->randomPositionButton, SIGNAL(clicked()), link, SLOT(setRandomPosition()));
connect(ui->airframeComboBox, SIGNAL(activated(QString)), link, SLOT(setAirframe(QString)));
ui->airframeComboBox->setCurrentIndex(link->getAirFrameIndex());
}
ui->hostComboBox->clear();
ui->hostComboBox->addItem(link->getRemoteHost());
// connect(ui->)
} }
void QGCHilConfiguration::receiveStatusMessage(const QString& message) void QGCHilConfiguration::receiveStatusMessage(const QString& message)
...@@ -39,23 +17,29 @@ void QGCHilConfiguration::receiveStatusMessage(const QString& message) ...@@ -39,23 +17,29 @@ void QGCHilConfiguration::receiveStatusMessage(const QString& message)
ui->statusLabel->setText(message); ui->statusLabel->setText(message);
} }
void QGCHilConfiguration::toggleSimulation(bool connect) QGCHilConfiguration::~QGCHilConfiguration()
{
delete ui;
}
void QGCHilConfiguration::on_simComboBox_currentIndexChanged(int index)
{ {
Q_UNUSED(connect); if(1 == index)
if (!link->isConnected())
{ {
link->setRemoteHost(ui->hostComboBox->currentText()); // Ensure the sim exists and is disabled
link->connectSimulation(); mav->enableHilFlightGear(false, "");
ui->startButton->setText(tr("Disconnect")); QGCHilFlightGearConfiguration* hfgconf = new QGCHilFlightGearConfiguration(mav, this);
hfgconf->show();
ui->simulatorConfigurationDockWidget->setWidget(hfgconf);
} }
else else if(2 == index || 3 == index)
{ {
link->disconnectSimulation(); // Ensure the sim exists and is disabled
ui->startButton->setText(tr("Connect")); mav->enableHilXPlane(false);
} QGCHilXPlaneConfiguration* hxpconf = new QGCHilXPlaneConfiguration(mav->getHILSimulation(), this);
} hxpconf->show();
ui->simulatorConfigurationDockWidget->setWidget(hxpconf);
QGCHilConfiguration::~QGCHilConfiguration() }
{
delete ui;
} }
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include <QWidget> #include <QWidget>
#include "QGCHilLink.h" #include "QGCHilLink.h"
#include "UAS.h"
namespace Ui { namespace Ui {
class QGCHilConfiguration; class QGCHilConfiguration;
...@@ -14,17 +15,18 @@ class QGCHilConfiguration : public QWidget ...@@ -14,17 +15,18 @@ class QGCHilConfiguration : public QWidget
Q_OBJECT Q_OBJECT
public: public:
QGCHilConfiguration(QGCHilLink* link, QWidget *parent = 0); QGCHilConfiguration(UAS* mav, QWidget *parent = 0);
~QGCHilConfiguration(); ~QGCHilConfiguration();
public slots: public slots:
/** @brief Start / stop simulation */
void toggleSimulation(bool connect);
/** @brief Receive status message */ /** @brief Receive status message */
void receiveStatusMessage(const QString& message); void receiveStatusMessage(const QString& message);
protected: protected:
QGCHilLink* link; UAS* mav;
private slots:
void on_simComboBox_currentIndexChanged(int index);
private: private:
Ui::QGCHilConfiguration *ui; Ui::QGCHilConfiguration *ui;
......
...@@ -7,70 +7,19 @@ ...@@ -7,70 +7,19 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>305</width> <width>305</width>
<height>261</height> <height>355</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout" columnstretch="40,60,50,50"> <layout class="QGridLayout" name="gridLayout" columnstretch="40,0,0">
<item row="1" column="1" colspan="3">
<widget class="QComboBox" name="airframeComboBox">
<property name="editable">
<bool>true</bool>
</property>
<item>
<property name="text">
<string>X-Plane default</string>
</property>
</item>
<item>
<property name="text">
<string>QRO_X/MK</string>
</property>
</item>
<item>
<property name="text">
<string>QRO_X/Ardrone</string>
</property>
</item>
<item>
<property name="text">
<string>QRO_X/PWM</string>
</property>
</item>
<item>
<property name="text">
<string>Unlimited</string>
</property>
</item>
<item>
<property name="text">
<string>Twinjet</string>
</property>
</item>
<item>
<property name="text">
<string>Early Bird</string>
</property>
</item>
<item>
<property name="text">
<string>Reno Racer</string>
</property>
</item>
<item>
<property name="text">
<string>Slowstick</string>
</property>
</item>
<item>
<property name="text">
<string>Tiny</string>
</property>
</item>
</widget>
</item>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="simLabel"> <widget class="QLabel" name="simLabel">
<property name="text"> <property name="text">
...@@ -78,96 +27,69 @@ ...@@ -78,96 +27,69 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="2" colspan="2"> <item row="3" column="0">
<widget class="QPushButton" name="setHomeButton">
<property name="text">
<string>Set HOME</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="statusLabel"> <widget class="QLabel" name="statusLabel">
<property name="text"> <property name="text">
<string>Status</string> <string>Status</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="0" column="2">
<widget class="QLabel" name="label">
<property name="text">
<string>Airframe</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="3">
<widget class="QComboBox" name="simComboBox"> <widget class="QComboBox" name="simComboBox">
<property name="editable"> <property name="editable">
<bool>true</bool> <bool>true</bool>
</property> </property>
<item> <item>
<property name="text"> <property name="text">
<string>X-Plane 10</string> <string/>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>X-Plane 9</string> <string>Flightgear</string>
</property> </property>
</item> </item>
</widget>
</item>
<item row="2" column="1" colspan="3">
<widget class="QComboBox" name="hostComboBox">
<property name="editable">
<bool>true</bool>
</property>
<item> <item>
<property name="text"> <property name="text">
<string>127.0.0.1:49000</string> <string>X-Plane 10</string>
</property>
</item>
</widget>
</item>
<item row="6" column="2" colspan="2">
<widget class="QPushButton" name="randomPositionButton">
<property name="text">
<string>Random POS</string>
</property>
</widget>
</item>
<item row="6" column="0" colspan="2">
<widget class="QPushButton" name="randomAttitudeButton">
<property name="text">
<string>Random ATT</string>
</property> </property>
</widget>
</item> </item>
<item row="2" column="0"> <item>
<widget class="QLabel" name="hostLabel">
<property name="text"> <property name="text">
<string>Host</string> <string>X-Plane 9</string>
</property> </property>
</widget>
</item> </item>
<item row="4" column="0" colspan="2">
<widget class="QPushButton" name="startButton">
<property name="text">
<string>Start</string>
</property>
</widget> </widget>
</item> </item>
<item row="8" column="0"> <item row="2" column="0" colspan="3">
<spacer name="verticalSpacer"> <widget class="QDockWidget" name="simulatorConfigurationDockWidget">
<property name="orientation"> <property name="sizePolicy">
<enum>Qt::Vertical</enum> <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property> </property>
<property name="sizeHint" stdset="0"> <property name="minimumSize">
<size> <size>
<width>20</width> <width>20</width>
<height>40</height> <height>150</height>
</size> </size>
</property> </property>
</spacer> <property name="features">
<set>QDockWidget::NoDockWidgetFeatures</set>
</property>
<property name="windowTitle">
<string>Simulator Options</string>
</property>
<widget class="QWidget" name="dockWidgetContents">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>
......
#include "QGCHilFlightGearConfiguration.h"
#include "ui_QGCHilFlightGearConfiguration.h"
#include "MainWindow.h"
QGCHilFlightGearConfiguration::QGCHilFlightGearConfiguration(UAS* mav,QWidget *parent) :
QWidget(parent),
mav(mav),
ui(new Ui::QGCHilFlightGearConfiguration)
{
ui->setupUi(this);
QStringList items = QStringList();
if (mav->getSystemType() == MAV_TYPE_FIXED_WING)
{
items << "Rascal110-JSBSim";
items << "c172p";
items << "YardStik";
items << "Malolo1";
}
else if (mav->getSystemType() == MAV_TYPE_QUADROTOR)
{
items << "arducopter";
}
else
{
items << "<aircraft>";
}
ui->aircraftComboBox->addItems(items);
}
QGCHilFlightGearConfiguration::~QGCHilFlightGearConfiguration()
{
delete ui;
}
void QGCHilFlightGearConfiguration::on_startButton_clicked()
{
//XXX check validity of inputs
QString options = ui->optionsPlainTextEdit->toPlainText();
options.append(" --aircraft=" + ui->aircraftComboBox->currentText());
mav->enableHilFlightGear(true, options);
}
#ifndef QGCHILFLIGHTGEARCONFIGURATION_H
#define QGCHILFLIGHTGEARCONFIGURATION_H
#include <QWidget>
#include "QGCHilLink.h"
#include "QGCFlightGearLink.h"
#include "UAS.h"
namespace Ui {
class QGCHilFlightGearConfiguration;
}
class QGCHilFlightGearConfiguration : public QWidget
{
Q_OBJECT
public:
explicit QGCHilFlightGearConfiguration(UAS* mav, QWidget *parent = 0);
~QGCHilFlightGearConfiguration();
protected:
UAS* mav;
private slots:
void on_startButton_clicked();
private:
Ui::QGCHilFlightGearConfiguration *ui;
};
#endif // QGCHILFLIGHTGEARCONFIGURATION_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QGCHilFlightGearConfiguration</class>
<widget class="QWidget" name="QGCHilFlightGearConfiguration">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>190</width>
<height>246</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout" rowminimumheight="0,0,0,0,0,0">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="5" column="0">
<widget class="QPushButton" name="startButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Start</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="aircraftPlaintextInfoLabel">
<property name="text">
<string>Airframe:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QComboBox" name="aircraftComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="editable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="optionsLabel">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Additional Options:&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QPlainTextEdit" name="optionsPlainTextEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="plainText">
<string>--in-air --roll=0 --pitch=0 --vc=90 --heading=300 --timeofday=noon --disable-hud-3d --disable-fullscreen --geometry=400x300 --disable-anti-alias-hud --wind=0@0 --turbulence=0.0 --prop:/sim/frame-rate-throttle-hz=30 --control=mouse --disable-intro-music --disable-sound --disable-random-objects --disable-ai-models --shading-flat --fog-disable --disable-specular-highlight --disable-random-objects --disable-panel --disable-clouds --fdm=jsb --units-meters --notrim --prop:/engines/engine/running=true</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
#include "QGCHilXPlaneConfiguration.h"
#include "ui_QGCHilXPlaneConfiguration.h"
#include "QGCXPlaneLink.h"
QGCHilXPlaneConfiguration::QGCHilXPlaneConfiguration(QGCHilLink* link, QWidget *parent) :
QWidget(parent),
ui(new Ui::QGCHilXPlaneConfiguration)
{
ui->setupUi(this);
this->link = link;
connect(ui->startButton, SIGNAL(clicked(bool)), this, SLOT(toggleSimulation(bool)));
connect(ui->hostComboBox, SIGNAL(activated(QString)), link, SLOT(setRemoteHost(QString)));
connect(link, SIGNAL(remoteChanged(QString)), ui->hostComboBox, SLOT(setEditText(QString)));
connect(link, SIGNAL(statusMessage(QString)), parent, SLOT(receiveStatusMessage(QString)));
// connect(mav->getHILSimulation(), SIGNAL(statusMessage(QString)), this, SLOT(receiveStatusMessage(QString)));
// connect(ui->simComboBox, SIGNAL(activated(QString)), mav->getHILSimulation(), SLOT(setVersion(QString)));
ui->startButton->setText(tr("Connect"));
QGCXPlaneLink* xplane = dynamic_cast<QGCXPlaneLink*>(link);
if (xplane)
{
connect(ui->randomAttitudeButton, SIGNAL(clicked()), link, SLOT(setRandomAttitude()));
connect(ui->randomPositionButton, SIGNAL(clicked()), link, SLOT(setRandomPosition()));
connect(ui->airframeComboBox, SIGNAL(activated(QString)), link, SLOT(selectAirframe(QString)));
ui->airframeComboBox->setCurrentIndex(link->getAirFrameIndex());
}
ui->hostComboBox->clear();
ui->hostComboBox->addItem(link->getRemoteHost());
}
void QGCHilXPlaneConfiguration::toggleSimulation(bool connect)
{
Q_UNUSED(connect);
if (!link->isConnected())
{
link->setRemoteHost(ui->hostComboBox->currentText());
link->connectSimulation();
ui->startButton->setText(tr("Disconnect"));
}
else
{
link->disconnectSimulation();
ui->startButton->setText(tr("Connect"));
}
}
QGCHilXPlaneConfiguration::~QGCHilXPlaneConfiguration()
{
delete ui;
}
#ifndef QGCHILXPLANECONFIGURATION_H
#define QGCHILXPLANECONFIGURATION_H
#include <QWidget>
#include "QGCHilLink.h"
namespace Ui {
class QGCHilXPlaneConfiguration;
}
class QGCHilXPlaneConfiguration : public QWidget
{
Q_OBJECT
public:
explicit QGCHilXPlaneConfiguration(QGCHilLink* link, QWidget *parent = 0);
~QGCHilXPlaneConfiguration();
public slots:
/** @brief Start / stop simulation */
void toggleSimulation(bool connect);
protected:
QGCHilLink* link;
private:
Ui::QGCHilXPlaneConfiguration *ui;
};
#endif // QGCHILXPLANECONFIGURATION_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QGCHilXPlaneConfiguration</class>
<widget class="QWidget" name="QGCHilXPlaneConfiguration">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>243</width>
<height>261</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout" columnstretch="40,0,0,0">
<property name="margin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Airframe</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="3">
<widget class="QComboBox" name="airframeComboBox">
<property name="editable">
<bool>true</bool>
</property>
<item>
<property name="text">
<string>X-Plane default</string>
</property>
</item>
<item>
<property name="text">
<string>QRO_X/MK</string>
</property>
</item>
<item>
<property name="text">
<string>QRO_X/Ardrone</string>
</property>
</item>
<item>
<property name="text">
<string>QRO_X/PWM</string>
</property>
</item>
<item>
<property name="text">
<string>Unlimited</string>
</property>
</item>
<item>
<property name="text">
<string>Twinjet</string>
</property>
</item>
<item>
<property name="text">
<string>Early Bird</string>
</property>
</item>
<item>
<property name="text">
<string>Reno Racer</string>
</property>
</item>
<item>
<property name="text">
<string>Slowstick</string>
</property>
</item>
<item>
<property name="text">
<string>Tiny</string>
</property>
</item>
</widget>
</item>
<item row="3" column="2" colspan="2">
<widget class="QPushButton" name="setHomeButton">
<property name="text">
<string>Set HOME</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="3">
<widget class="QComboBox" name="hostComboBox">
<property name="editable">
<bool>true</bool>
</property>
<item>
<property name="text">
<string>127.0.0.1:49000</string>
</property>
</item>
</widget>
</item>
<item row="5" column="2" colspan="2">
<widget class="QPushButton" name="randomPositionButton">
<property name="text">
<string>Random POS</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<widget class="QPushButton" name="randomAttitudeButton">
<property name="text">
<string>Random ATT</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="hostLabel">
<property name="text">
<string>Host</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QPushButton" name="startButton">
<property name="text">
<string>Start</string>
</property>
</widget>
</item>
<item row="6" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
...@@ -57,7 +57,7 @@ public: ...@@ -57,7 +57,7 @@ public:
double getParamMin(const QString& param) { return paramMin.value(param, 0.0f); } double getParamMin(const QString& param) { return paramMin.value(param, 0.0f); }
double getParamMax(const QString& param) { return paramMax.value(param, 0.0f); } double getParamMax(const QString& param) { return paramMax.value(param, 0.0f); }
double getParamDefault(const QString& param) { return paramDefault.value(param, 0.0f); } double getParamDefault(const QString& param) { return paramDefault.value(param, 0.0f); }
const QString& getParamInfo(const QString& param) { return paramToolTips.value(param, ""); } QString getParamInfo(const QString& param) { return paramToolTips.value(param, ""); }
signals: signals:
/** @brief A parameter was changed in the widget, NOT onboard */ /** @brief A parameter was changed in the widget, NOT onboard */
......
...@@ -54,7 +54,7 @@ QGCToolBar::QGCToolBar(QWidget *parent) : ...@@ -54,7 +54,7 @@ QGCToolBar::QGCToolBar(QWidget *parent) :
// Add internal actions // Add internal actions
// Add MAV widget // Add MAV widget
symbolButton = new QToolButton(this); symbolButton = new QToolButton(this);
symbolButton->setStyleSheet("QWidget { background-color: #050508; color: #DDDDDF; background-clip: border; } QToolButton { font-weight: bold; font-size: 12px; border: 0px solid #999999; border-radius: 5px; min-width:22px; max-width: 22px; min-height: 22px; max-height: 22px; padding: 0px; margin: 0px 0px 0px 20px; background-color: none; }"); symbolButton->setStyleSheet("QWidget { background-color: #050508; color: #DDDDDF; background-clip: border; }");
addWidget(symbolButton); addWidget(symbolButton);
toolBarNameLabel = new QLabel("------", this); toolBarNameLabel = new QLabel("------", this);
...@@ -226,39 +226,6 @@ void QGCToolBar::logging(bool checked) ...@@ -226,39 +226,6 @@ void QGCToolBar::logging(bool checked)
void QGCToolBar::addPerspectiveChangeAction(QAction* action) void QGCToolBar::addPerspectiveChangeAction(QAction* action)
{ {
insertAction(toggleLoggingAction, action); insertAction(toggleLoggingAction, action);
// Set tab style
QWidget* widget = widgetForAction(action);
widget->setStyleSheet("\
* { font-weight: bold; min-height: 16px; min-width: 24px; \
border-top: 1px solid #BBBBBB; \
border-bottom: 0px; \
border-left: 1px solid #BBBBBB; \
border-right: 1px solid #BBBBBB; \
border-top-left-radius: 5px; \
border-top-right-radius: 5px; \
border-bottom-left-radius: 0px; \
border-bottom-right-radius: 0px; \
max-height: 22px; \
margin-top: 4px; \
margin-left: 2px; \
margin-bottom: 0px; \
margin-right: 2px; \
background-color: #222222; \
} \
*:checked { \
background-color: #000000; \
border-top: 2px solid #379AC3; \
border-bottom: 0px; \
border-left: 2px solid #379AC3; \
border-right: 2px solid #379AC3; \
} \
*:pressed { \
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #bbbbbb, stop: 1 #b0b0b0); \
border-top: 2px solid #379AC3; \
border-bottom: 0px; \
border-left: 2px solid #379AC3; \
border-right: 2px solid #379AC3; }");
} }
void QGCToolBar::setActiveUAS(UASInterface* active) void QGCToolBar::setActiveUAS(UASInterface* active)
...@@ -322,6 +289,8 @@ void QGCToolBar::updateArmingState(bool armed) ...@@ -322,6 +289,8 @@ void QGCToolBar::updateArmingState(bool armed)
{ {
systemArmed = armed; systemArmed = armed;
changed = true; changed = true;
/* important, immediately update */
updateView();
} }
void QGCToolBar::updateView() void QGCToolBar::updateView()
...@@ -377,6 +346,8 @@ void QGCToolBar::updateState(UASInterface* system, QString name, QString descrip ...@@ -377,6 +346,8 @@ void QGCToolBar::updateState(UASInterface* system, QString name, QString descrip
Q_UNUSED(description); Q_UNUSED(description);
if (state != name) changed = true; if (state != name) changed = true;
state = name; state = name;
/* important, immediately update */
updateView();
} }
void QGCToolBar::updateMode(int system, QString name, QString description) void QGCToolBar::updateMode(int system, QString name, QString description)
...@@ -385,11 +356,16 @@ void QGCToolBar::updateMode(int system, QString name, QString description) ...@@ -385,11 +356,16 @@ void QGCToolBar::updateMode(int system, QString name, QString description)
Q_UNUSED(description); Q_UNUSED(description);
if (mode != name) changed = true; if (mode != name) changed = true;
mode = name; mode = name;
/* important, immediately update */
updateView();
} }
void QGCToolBar::updateName(const QString& name) void QGCToolBar::updateName(const QString& name)
{ {
if (systemName != name) changed = true; if (systemName != name)
{
changed = true;
}
systemName = name; systemName = name;
} }
......
...@@ -191,10 +191,10 @@ void QGCVehicleConfig::writeCalibrationRC() ...@@ -191,10 +191,10 @@ void QGCVehicleConfig::writeCalibrationRC()
for (unsigned int i = 0; i < chanMax; ++i) for (unsigned int i = 0; i < chanMax; ++i)
{ {
mav->setParameter(0, minTpl.arg(i), rcMin[i]); mav->setParameter(0, minTpl.arg(i+1), rcMin[i]);
mav->setParameter(0, trimTpl.arg(i), rcTrim[i]); mav->setParameter(0, trimTpl.arg(i+1), rcTrim[i]);
mav->setParameter(0, maxTpl.arg(i), rcMax[i]); mav->setParameter(0, maxTpl.arg(i+1), rcMax[i]);
mav->setParameter(0, revTpl.arg(i), (rcRev[i]) ? -1 : 1); mav->setParameter(0, revTpl.arg(i+1), (rcRev[i]) ? -1 : 1);
} }
// Write mappings // Write mappings
...@@ -222,13 +222,13 @@ void QGCVehicleConfig::requestCalibrationRC() ...@@ -222,13 +222,13 @@ void QGCVehicleConfig::requestCalibrationRC()
for (unsigned int i = 0; i < chanMax; ++i) for (unsigned int i = 0; i < chanMax; ++i)
{ {
mav->requestParameter(0, minTpl.arg(i)); mav->requestParameter(0, minTpl.arg(i+1));
QGC::SLEEP::usleep(5000); QGC::SLEEP::usleep(5000);
mav->requestParameter(0, trimTpl.arg(i)); mav->requestParameter(0, trimTpl.arg(i+1));
QGC::SLEEP::usleep(5000); QGC::SLEEP::usleep(5000);
mav->requestParameter(0, maxTpl.arg(i)); mav->requestParameter(0, maxTpl.arg(i+1));
QGC::SLEEP::usleep(5000); QGC::SLEEP::usleep(5000);
mav->requestParameter(0, revTpl.arg(i)); mav->requestParameter(0, revTpl.arg(i+1));
QGC::SLEEP::usleep(5000); QGC::SLEEP::usleep(5000);
} }
} }
...@@ -379,7 +379,7 @@ void QGCVehicleConfig::parameterChanged(int uas, int component, QString paramete ...@@ -379,7 +379,7 @@ void QGCVehicleConfig::parameterChanged(int uas, int component, QString paramete
if (minTpl.exactMatch(parameterName)) { if (minTpl.exactMatch(parameterName)) {
bool ok; bool ok;
unsigned int index = parameterName.mid(2, 1).toInt(&ok); unsigned int index = parameterName.mid(2, 1).toInt(&ok) - 1;
if (ok && (index > 0) && (index < chanMax)) if (ok && (index > 0) && (index < chanMax))
{ {
rcMin[index] = value.toInt(); rcMin[index] = value.toInt();
...@@ -388,7 +388,7 @@ void QGCVehicleConfig::parameterChanged(int uas, int component, QString paramete ...@@ -388,7 +388,7 @@ void QGCVehicleConfig::parameterChanged(int uas, int component, QString paramete
if (maxTpl.exactMatch(parameterName)) { if (maxTpl.exactMatch(parameterName)) {
bool ok; bool ok;
unsigned int index = parameterName.mid(2, 1).toInt(&ok); unsigned int index = parameterName.mid(2, 1).toInt(&ok) - 1;
if (ok && (index > 0) && (index < chanMax)) if (ok && (index > 0) && (index < chanMax))
{ {
rcMax[index] = value.toInt(); rcMax[index] = value.toInt();
...@@ -397,7 +397,7 @@ void QGCVehicleConfig::parameterChanged(int uas, int component, QString paramete ...@@ -397,7 +397,7 @@ void QGCVehicleConfig::parameterChanged(int uas, int component, QString paramete
if (trimTpl.exactMatch(parameterName)) { if (trimTpl.exactMatch(parameterName)) {
bool ok; bool ok;
unsigned int index = parameterName.mid(2, 1).toInt(&ok); unsigned int index = parameterName.mid(2, 1).toInt(&ok) - 1;
if (ok && (index > 0) && (index < chanMax)) if (ok && (index > 0) && (index < chanMax))
{ {
rcTrim[index] = value.toInt(); rcTrim[index] = value.toInt();
...@@ -406,7 +406,7 @@ void QGCVehicleConfig::parameterChanged(int uas, int component, QString paramete ...@@ -406,7 +406,7 @@ void QGCVehicleConfig::parameterChanged(int uas, int component, QString paramete
if (revTpl.exactMatch(parameterName)) { if (revTpl.exactMatch(parameterName)) {
bool ok; bool ok;
unsigned int index = parameterName.mid(2, 1).toInt(&ok); unsigned int index = parameterName.mid(2, 1).toInt(&ok) - 1;
if (ok && (index > 0) && (index < chanMax)) if (ok && (index > 0) && (index < chanMax))
{ {
rcRev[index] = (value.toInt() == -1) ? true : false; rcRev[index] = (value.toInt() == -1) ? true : false;
......
...@@ -40,13 +40,16 @@ ...@@ -40,13 +40,16 @@
<item row="0" column="0" colspan="2"> <item row="0" column="0" colspan="2">
<widget class="QTabWidget" name="tabWidget"> <widget class="QTabWidget" name="tabWidget">
<property name="currentIndex"> <property name="currentIndex">
<number>2</number> <number>1</number>
</property> </property>
<widget class="QWidget" name="rcTab"> <widget class="QWidget" name="rcTab">
<attribute name="title"> <attribute name="title">
<string>RC Calibration</string> <string>RC Calibration</string>
</attribute> </attribute>
<layout class="QGridLayout" name="gridLayout_5" columnstretch="1,1,10,1,1,10,1,1,1,1,1,1,1,1,10"> <layout class="QGridLayout" name="gridLayout_5" columnstretch="1,1,10,1,1,10,1,1,1,1,1,1,1,1,10">
<property name="topMargin">
<number>20</number>
</property>
<item row="8" column="1" rowspan="3"> <item row="8" column="1" rowspan="3">
<widget class="QSlider" name="throttleSlider"> <widget class="QSlider" name="throttleSlider">
<property name="minimum"> <property name="minimum">
...@@ -716,10 +719,26 @@ ...@@ -716,10 +719,26 @@
<string>Sensor Calibration</string> <string>Sensor Calibration</string>
</attribute> </attribute>
<layout class="QGridLayout" name="gridLayout_6" columnstretch="70,30"> <layout class="QGridLayout" name="gridLayout_6" columnstretch="70,30">
<property name="topMargin">
<number>20</number>
</property>
<item row="0" column="1"> <item row="0" column="1">
<layout class="QVBoxLayout" name="sensorLayout"/> <layout class="QVBoxLayout" name="sensorLayout"/>
</item> </item>
<item row="0" column="0"> <item row="1" column="1">
<spacer name="verticalSpacer_8">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0" rowspan="2">
<widget class="QTextBrowser" name="sensorTips"> <widget class="QTextBrowser" name="sensorTips">
<property name="html"> <property name="html">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt; <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
...@@ -732,7 +751,7 @@ p, li { white-space: pre-wrap; } ...@@ -732,7 +751,7 @@ p, li { white-space: pre-wrap; }
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:12pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:12pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:16pt;&quot;&gt;Magnetometer Calibration&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:16pt;&quot;&gt;Magnetometer Calibration&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:16pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:16pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;Carefully follow the instructions. Click on MAG to start the calibration. Watch the communication console for further instructions (Available through Main Menu -&amp;gt; Tool Widgets -&amp;gt; Communication Console). Do not calibrate the vehicle in vincinity of metal, e.g. from a table or chair. Start the calibration, leave the system unmoved on the table. Wait for the double beep. Next move the system in a figure eight, roll and pitch it strongly and perform the figure eight also upside-down. The calibration is finished after the triple beep.&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;Carefully follow the instructions. Click on MAG to start the calibration. Watch the communication console for further instructions (Available through Main Menu -&amp;gt; Tool Widgets -&amp;gt; Communication Console). Do not calibrate the vehicle in vincinity of metal, e.g. from a table or chair. Start the calibration, leave the system unmoved on the table. Wait for the double beep. Next move the system in a figure eight, roll and pitch it strongly, rotate around all axes and perform the figure eight also upside-down. The calibration is finished after the triple beep.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:12pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:12pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:16pt;&quot;&gt;Accelerometer Calibration&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:16pt;&quot;&gt;Accelerometer Calibration&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:16pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:16pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
...@@ -746,42 +765,80 @@ p, li { white-space: pre-wrap; } ...@@ -746,42 +765,80 @@ p, li { white-space: pre-wrap; }
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="tab"> <widget class="QWidget" name="multirotorTab">
<attribute name="title"> <attribute name="title">
<string>Multirotor Control</string> <string>Multirotor Control</string>
</attribute> </attribute>
<layout class="QGridLayout" name="gridLayout_3"> <layout class="QGridLayout" name="gridLayout_3" columnstretch="80,0,0">
<item row="0" column="0"> <property name="topMargin">
<widget class="QComboBox" name="multiRotorComboBox"/> <number>20</number>
</item> </property>
<item row="0" column="1"> <item row="0" column="2">
<widget class="QPushButton" name="loadMultiRotorDefaultsButton"> <widget class="QPushButton" name="loadMultiRotorDefaultsButton">
<property name="text"> <property name="text">
<string>Load Platform Defaults</string> <string>Load Platform Defaults</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0" colspan="2"> <item row="0" column="0">
<widget class="QWidget" name="multiRotorControlWidget" native="true"> <spacer name="horizontalSpacer_8">
<layout class="QGridLayout" name="gridLayout_7"> <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="0" column="1"> <item row="0" column="1">
<widget class="QComboBox" name="multiRotorComboBox"/>
</item>
<item row="2" column="0" colspan="3">
<widget class="QGroupBox" name="multiRotorControlPositionGroupBox"> <widget class="QGroupBox" name="multiRotorControlPositionGroupBox">
<property name="title"> <property name="title">
<string>Position</string> <string>Position</string>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_5"> <layout class="QVBoxLayout" name="verticalLayout_5">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QScrollArea" name="scrollArea_2">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents_2">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>651</width>
<height>203</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<property name="margin">
<number>0</number>
</property>
<item> <item>
<layout class="QVBoxLayout" name="multiRotorPositionLayout"/> <layout class="QVBoxLayout" name="multiRotorPositionLayout"/>
</item> </item>
</layout> </layout>
</widget> </widget>
</widget>
</item>
</layout>
</widget>
</item> </item>
<item row="0" column="0"> <item row="1" column="0" colspan="3">
<widget class="QGroupBox" name="multiRotorControlAttitudeGroupBox"> <widget class="QGroupBox" name="multiRotorControlAttitudeGroupBox">
<property name="title"> <property name="title">
<string>Attitude</string> <string>Attitude</string>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_6"> <layout class="QVBoxLayout" name="verticalLayout_3">
<property name="margin"> <property name="margin">
<number>0</number> <number>0</number>
</property> </property>
...@@ -795,8 +852,8 @@ p, li { white-space: pre-wrap; } ...@@ -795,8 +852,8 @@ p, li { white-space: pre-wrap; }
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>541</width> <width>651</width>
<height>417</height> <height>204</height>
</rect> </rect>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_4"> <layout class="QHBoxLayout" name="horizontalLayout_4">
...@@ -815,44 +872,107 @@ p, li { white-space: pre-wrap; } ...@@ -815,44 +872,107 @@ p, li { white-space: pre-wrap; }
</item> </item>
</layout> </layout>
</widget> </widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="fixedWingTab"> <widget class="QWidget" name="fixedWingTab">
<attribute name="title"> <attribute name="title">
<string>Fixed Wing Control</string> <string>Fixed Wing Control</string>
</attribute> </attribute>
<layout class="QGridLayout" name="gridLayout_4"> <layout class="QGridLayout" name="gridLayout_4" columnstretch="65,30,19,1">
<item row="1" column="0" colspan="2"> <property name="topMargin">
<widget class="QGroupBox" name="fixedWingControlAttitudeGroupBox"> <number>20</number>
</property>
<item row="3" column="0" colspan="4">
<widget class="QGroupBox" name="fixedWingControlPositionGroupBox">
<property name="title"> <property name="title">
<string>Attitude</string> <string>Position</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="margin">
<number>0</number>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item> <item>
<layout class="QVBoxLayout" name="fixedWingAttitudeLayout"/> <widget class="QScrollArea" name="scrollArea_3">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents_3">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>651</width>
<height>203</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QVBoxLayout" name="fixedWingPositionLayout"/>
</item> </item>
</layout> </layout>
</widget> </widget>
</widget>
</item> </item>
<item row="0" column="0"> </layout>
<widget class="QComboBox" name="fixedWingComboBox"/> </widget>
</item> </item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="QComboBox" name="fixedWingComboBox"/>
</item>
<item row="0" column="2" colspan="2">
<widget class="QPushButton" name="loadFixedWingDefaultsButton"> <widget class="QPushButton" name="loadFixedWingDefaultsButton">
<property name="text"> <property name="text">
<string>Load Platform Defaults</string> <string>Load Platform Defaults</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0" colspan="2"> <item row="0" column="0">
<widget class="QGroupBox" name="fixedWingControlPositionGroupBox"> <spacer name="horizontalSpacer_9">
<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="1" column="0" colspan="4">
<widget class="QGroupBox" name="fixedWingControlAttitudeGroupBox">
<property name="title"> <property name="title">
<string>Position</string> <string>Attitude</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="margin">
<number>0</number>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item> <item>
<layout class="QVBoxLayout" name="fixedWingPositionLayout"/> <widget class="QScrollArea" name="scrollArea_4">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents_4">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>651</width>
<height>204</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_7">
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QVBoxLayout" name="fixedWingAttitudeLayout"/>
</item>
</layout>
</widget>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>
......
...@@ -50,8 +50,6 @@ This file is part of the QGROUNDCONTROL project ...@@ -50,8 +50,6 @@ This file is part of the QGROUNDCONTROL project
#include "SwitchCalibrator.h" #include "SwitchCalibrator.h"
#include "CurveCalibrator.h" #include "CurveCalibrator.h"
#include "../../../mavlink/include/mavlink/v1.0/common/mavlink.h"
#include "../../../mavlink/include/mavlink/v1.0/mavlink_types.h"
#include "UAS.h" #include "UAS.h"
#include "UASManager.h" #include "UASManager.h"
#include "RadioCalibrationData.h" #include "RadioCalibrationData.h"
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#include <QContextMenuEvent> #include <QContextMenuEvent>
#include <QSettings> #include <QSettings>
#include <QTimer> #include <QTimer>
#include <QToolTip>
#include "QGCParamSlider.h" #include "QGCParamSlider.h"
#include "ui_QGCParamSlider.h" #include "ui_QGCParamSlider.h"
...@@ -53,7 +54,8 @@ QGCParamSlider::QGCParamSlider(QWidget *parent) : ...@@ -53,7 +54,8 @@ QGCParamSlider::QGCParamSlider(QWidget *parent) :
connect(ui->readButton, SIGNAL(clicked()), this, SLOT(requestParameter())); connect(ui->readButton, SIGNAL(clicked()), this, SLOT(requestParameter()));
connect(ui->editRefreshParamsButton, SIGNAL(clicked()), this, SLOT(refreshParamList())); connect(ui->editRefreshParamsButton, SIGNAL(clicked()), this, SLOT(refreshParamList()));
connect(ui->editInfoCheckBox, SIGNAL(clicked(bool)), this, SLOT(showInfo(bool))); connect(ui->editInfoCheckBox, SIGNAL(clicked(bool)), this, SLOT(showInfo(bool)));
// connect to self
connect(ui->infoLabel, SIGNAL(released()), this, SLOT(showTooltip()));
// Set the current UAS if present // Set the current UAS if present
connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(setActiveUAS(UASInterface*))); connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(setActiveUAS(UASInterface*)));
} }
...@@ -63,6 +65,17 @@ QGCParamSlider::~QGCParamSlider() ...@@ -63,6 +65,17 @@ QGCParamSlider::~QGCParamSlider()
delete ui; delete ui;
} }
void QGCParamSlider::showTooltip()
{
QWidget* sender = dynamic_cast<QWidget*>(QObject::sender());
if (sender)
{
QPoint point = mapToGlobal(pos());
QToolTip::showText(point, sender->toolTip());
}
}
void QGCParamSlider::refreshParamList() void QGCParamSlider::refreshParamList()
{ {
ui->editSelectParamComboBox->setEnabled(true); ui->editSelectParamComboBox->setEnabled(true);
...@@ -70,6 +83,7 @@ void QGCParamSlider::refreshParamList() ...@@ -70,6 +83,7 @@ void QGCParamSlider::refreshParamList()
if (uas) if (uas)
{ {
uas->getParamManager()->requestParameterList(); uas->getParamManager()->requestParameterList();
ui->editStatusLabel->setText(tr("Parameter list updating.."));
} }
} }
...@@ -89,7 +103,7 @@ void QGCParamSlider::setActiveUAS(UASInterface* activeUas) ...@@ -89,7 +103,7 @@ void QGCParamSlider::setActiveUAS(UASInterface* activeUas)
requestParameter(); requestParameter();
// Set param info // Set param info
QString text = uas->getParamManager()->getParamInfo(parameterName); QString text = uas->getParamManager()->getParamInfo(parameterName);
ui->infoLabel->setText(text); ui->infoLabel->setToolTip(text);
// Force-uncheck and hide label if no description is available // Force-uncheck and hide label if no description is available
if (ui->editInfoCheckBox->isChecked()) if (ui->editInfoCheckBox->isChecked())
{ {
...@@ -345,6 +359,11 @@ void QGCParamSlider::setParameterValue(int uas, int component, int paramCount, i ...@@ -345,6 +359,11 @@ void QGCParamSlider::setParameterValue(int uas, int component, int paramCount, i
} }
ui->valueSlider->setValue(floatToScaledInt(value.toDouble())); ui->valueSlider->setValue(floatToScaledInt(value.toDouble()));
} }
if (paramIndex == paramCount - 1)
{
ui->editStatusLabel->setText(tr("Complete parameter list received."));
}
} }
void QGCParamSlider::changeEvent(QEvent *e) void QGCParamSlider::changeEvent(QEvent *e)
......
...@@ -41,6 +41,8 @@ public slots: ...@@ -41,6 +41,8 @@ public slots:
void setParamValue(int value); void setParamValue(int value);
/** @brief Show descriptive text next to slider */ /** @brief Show descriptive text next to slider */
void showInfo(bool enable); void showInfo(bool enable);
/** @brief Show tool tip of calling element */
void showTooltip();
protected slots: protected slots:
/** @brief Request the parameter of this widget from the MAV */ /** @brief Request the parameter of this widget from the MAV */
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout" columnstretch="10,0,0,0,0,0,0,0,0,0"> <layout class="QGridLayout" name="gridLayout" columnstretch="10,0,0,0,0,0,0,0,0,0,0">
<property name="leftMargin"> <property name="leftMargin">
<number>6</number> <number>6</number>
</property> </property>
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
<property name="verticalSpacing"> <property name="verticalSpacing">
<number>12</number> <number>12</number>
</property> </property>
<item row="2" column="5"> <item row="2" column="6">
<widget class="QSpinBox" name="intValueSpinBox"> <widget class="QSpinBox" name="intValueSpinBox">
<property name="minimum"> <property name="minimum">
<number>-999999999</number> <number>-999999999</number>
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="5" colspan="3"> <item row="3" column="6" colspan="3">
<widget class="QComboBox" name="editSelectParamComboBox"> <widget class="QComboBox" name="editSelectParamComboBox">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
...@@ -55,39 +55,68 @@ ...@@ -55,39 +55,68 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="2"> <item row="0" column="0" colspan="11">
<widget class="QLabel" name="nameLabel"> <widget class="Line" name="editLine1">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="2" column="7" colspan="2">
<widget class="QSlider" name="valueSlider">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>60</width> <width>60</width>
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<property name="text"> <property name="maximumSize">
<string>Name</string> <size>
<width>250</width>
<height>16777215</height>
</size>
</property> </property>
<property name="alignment"> <property name="maximum">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <number>1000000</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="7"> <item row="4" column="10">
<widget class="QDoubleSpinBox" name="editMinSpinBox"> <widget class="QPushButton" name="editDoneButton">
<property name="prefix"> <property name="text">
<string>MIN: </string> <string>Done</string>
</property> </property>
<property name="minimum"> </widget>
<double>-999999999.000000000000000</double> </item>
<item row="6" column="0" colspan="11">
<widget class="Line" name="editLine2">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property> </property>
<property name="maximum"> <property name="orientation">
<double>999999999.000000000000000</double> <enum>Qt::Horizontal</enum>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="2" colspan="5"> <item row="3" column="9">
<widget class="QLineEdit" name="editNameLabel"> <widget class="QCheckBox" name="editInfoCheckBox">
<property name="text"> <property name="text">
<string>&lt;Parameter Name / Label&gt;</string> <string>Show Info</string>
</property>
<property name="checked">
<bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
...@@ -104,77 +133,49 @@ ...@@ -104,77 +133,49 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="2" column="8"> <item row="3" column="10">
<widget class="QPushButton" name="writeButton"> <widget class="QPushButton" name="editRefreshParamsButton">
<property name="minimumSize"> <property name="enabled">
<size> <bool>true</bool>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Transmit the current slider value to the system</string>
</property>
<property name="statusTip">
<string>Transmit the current slider value to the system</string>
</property> </property>
<property name="text"> <property name="text">
<string>W</string> <string>Refresh</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="0" colspan="10"> <item row="5" column="2" colspan="9">
<widget class="Line" name="editLine2"> <spacer name="verticalSpacer">
<property name="minimumSize"> <property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size> <size>
<width>0</width> <width>20</width>
<height>0</height> <height>40</height>
</size> </size>
</property> </property>
<property name="orientation"> </spacer>
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item> </item>
<item row="2" column="6" colspan="2"> <item row="2" column="10">
<widget class="QSlider" name="valueSlider"> <widget class="QPushButton" name="readButton">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>60</width> <width>0</width>
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="toolTip">
<size> <string>Read the current parameter value on the system</string>
<width>250</width>
<height>16777215</height>
</size>
</property>
<property name="maximum">
<number>1000000</number>
</property> </property>
<property name="orientation"> <property name="statusTip">
<enum>Qt::Horizontal</enum> <string>Read the current parameter value on the system</string>
</property> </property>
</widget>
</item>
<item row="3" column="8">
<widget class="QCheckBox" name="editInfoCheckBox">
<property name="text"> <property name="text">
<string>Show Info</string> <string>R</string>
</property>
<property name="checked">
<bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="2" colspan="3"> <item row="3" column="1" colspan="5">
<widget class="QComboBox" name="editSelectComponentComboBox"> <widget class="QComboBox" name="editSelectComponentComboBox">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
...@@ -187,36 +188,59 @@ ...@@ -187,36 +188,59 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1" colspan="7">
<widget class="QLineEdit" name="editNameLabel">
<property name="text">
<string>&lt;Parameter Name / Label&gt;</string>
</property>
</widget>
</item>
<item row="4" column="1" colspan="8">
<widget class="QLabel" name="editStatusLabel">
<property name="text">
<string>Please click first on refresh to update selection menus..</string>
</property>
</widget>
</item>
<item row="2" column="9"> <item row="2" column="9">
<widget class="QPushButton" name="readButton"> <widget class="QPushButton" name="writeButton">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>0</width> <width>0</width>
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip"> <property name="toolTip">
<string>Read the current parameter value on the system</string> <string>Transmit the current slider value to the system</string>
</property> </property>
<property name="statusTip"> <property name="statusTip">
<string>Read the current parameter value on the system</string> <string>Transmit the current slider value to the system</string>
</property> </property>
<property name="text"> <property name="text">
<string>R</string> <string>W</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="2" colspan="6"> <item row="2" column="4">
<widget class="QLabel" name="editStatusLabel"> <widget class="QDoubleSpinBox" name="doubleValueSpinBox">
<property name="text"> <property name="minimum">
<string>Please click first on refresh to update selection menus..</string> <double>-999999999.000000000000000</double>
</property>
<property name="maximum">
<double>999999999.000000000000000</double>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="8" colspan="2"> <item row="1" column="8">
<widget class="QDoubleSpinBox" name="editMaxSpinBox"> <widget class="QDoubleSpinBox" name="editMinSpinBox">
<property name="prefix"> <property name="prefix">
<string>MAX: </string> <string>MIN: </string>
</property> </property>
<property name="minimum"> <property name="minimum">
<double>-999999999.000000000000000</double> <double>-999999999.000000000000000</double>
...@@ -226,8 +250,11 @@ ...@@ -226,8 +250,11 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="3"> <item row="1" column="9" colspan="2">
<widget class="QDoubleSpinBox" name="doubleValueSpinBox"> <widget class="QDoubleSpinBox" name="editMaxSpinBox">
<property name="prefix">
<string>MAX: </string>
</property>
<property name="minimum"> <property name="minimum">
<double>-999999999.000000000000000</double> <double>-999999999.000000000000000</double>
</property> </property>
...@@ -236,54 +263,37 @@ ...@@ -236,54 +263,37 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1" rowspan="6"> <item row="2" column="2">
<widget class="QTextBrowser" name="infoLabel"/> <widget class="QLabel" name="nameLabel">
</item>
<item row="0" column="0" colspan="10">
<widget class="Line" name="editLine1">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>0</width> <width>60</width>
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="3" column="9">
<widget class="QPushButton" name="editRefreshParamsButton">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text"> <property name="text">
<string>Refresh</string> <string>Name</string>
</property> </property>
</widget> <property name="alignment">
</item> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
<item row="5" column="9">
<widget class="QPushButton" name="editDoneButton">
<property name="text">
<string>Done</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="2" colspan="8"> <item row="2" column="3">
<spacer name="verticalSpacer"> <widget class="QToolButton" name="infoLabel">
<property name="orientation"> <property name="text">
<enum>Qt::Vertical</enum> <string/>
</property> </property>
<property name="sizeHint" stdset="0"> <property name="icon">
<size> <iconset resource="../../../qgroundcontrol.qrc">
<width>20</width> <normaloff>:/files/images/status/dialog-information.svg</normaloff>:/files/images/status/dialog-information.svg</iconset>
<height>40</height>
</size>
</property> </property>
</spacer> </widget>
</item> </item>
</layout> </layout>
</widget> </widget>
<resources/> <resources>
<include location="../../../qgroundcontrol.qrc"/>
</resources>
<connections/> <connections/>
</ui> </ui>
...@@ -40,6 +40,7 @@ This file is part of the PIXHAWK project ...@@ -40,6 +40,7 @@ This file is part of the PIXHAWK project
#include "UASWaypointManager.h" #include "UASWaypointManager.h"
#include "MainWindow.h" #include "MainWindow.h"
#include "ui_UASView.h" #include "ui_UASView.h"
#include <QGCHilFlightGearConfiguration.h>
UASView::UASView(UASInterface* uas, QWidget *parent) : UASView::UASView(UASInterface* uas, QWidget *parent) :
QWidget(parent), QWidget(parent),
...@@ -68,8 +69,7 @@ UASView::UASView(UASInterface* uas, QWidget *parent) : ...@@ -68,8 +69,7 @@ UASView::UASView(UASInterface* uas, QWidget *parent) :
removeAction(new QAction("Delete this system", this)), removeAction(new QAction("Delete this system", this)),
renameAction(new QAction("Rename..", this)), renameAction(new QAction("Rename..", this)),
selectAction(new QAction("Control this system", this )), selectAction(new QAction("Control this system", this )),
hilAction(new QAction("Enable Flightgear Hardware-in-the-Loop Simulation", this )), hilAction(new QAction("HIL - Hardware in the Loop", this )),
hilXAction(new QAction("Enable X-Plane Hardware-in-the-Loop Simulation", this )),
selectAirframeAction(new QAction("Choose Airframe", this)), selectAirframeAction(new QAction("Choose Airframe", this)),
setBatterySpecsAction(new QAction("Set Battery Options", this)), setBatterySpecsAction(new QAction("Set Battery Options", this)),
lowPowerModeEnabled(true), lowPowerModeEnabled(true),
...@@ -81,9 +81,6 @@ UASView::UASView(UASInterface* uas, QWidget *parent) : ...@@ -81,9 +81,6 @@ UASView::UASView(UASInterface* uas, QWidget *parent) :
lowPowerModeEnabled = MainWindow::instance()->lowPowerModeEnabled(); lowPowerModeEnabled = MainWindow::instance()->lowPowerModeEnabled();
hilAction->setCheckable(true); hilAction->setCheckable(true);
// Flightgear is not ready for prime time
//hilAction->setEnabled(false);
hilXAction->setCheckable(true);
m_ui->setupUi(this); m_ui->setupUi(this);
...@@ -122,8 +119,7 @@ UASView::UASView(UASInterface* uas, QWidget *parent) : ...@@ -122,8 +119,7 @@ UASView::UASView(UASInterface* uas, QWidget *parent) :
connect(removeAction, SIGNAL(triggered()), this, SLOT(deleteLater())); connect(removeAction, SIGNAL(triggered()), this, SLOT(deleteLater()));
connect(renameAction, SIGNAL(triggered()), this, SLOT(rename())); connect(renameAction, SIGNAL(triggered()), this, SLOT(rename()));
connect(selectAction, SIGNAL(triggered()), uas, SLOT(setSelected())); connect(selectAction, SIGNAL(triggered()), uas, SLOT(setSelected()));
connect(hilAction, SIGNAL(triggered(bool)), uas, SLOT(enableHilFlightGear(bool))); connect(hilAction, SIGNAL(triggered(bool)), this, SLOT(showHILUi()));
connect(hilXAction, SIGNAL(triggered(bool)), uas, SLOT(enableHilXPlane(bool)));
connect(selectAirframeAction, SIGNAL(triggered()), this, SLOT(selectAirframe())); connect(selectAirframeAction, SIGNAL(triggered()), this, SLOT(selectAirframe()));
connect(setBatterySpecsAction, SIGNAL(triggered()), this, SLOT(setBatterySpecs())); connect(setBatterySpecsAction, SIGNAL(triggered()), this, SLOT(setBatterySpecs()));
connect(uas, SIGNAL(systemRemoved()), this, SLOT(deleteLater())); connect(uas, SIGNAL(systemRemoved()), this, SLOT(deleteLater()));
...@@ -504,8 +500,6 @@ void UASView::contextMenuEvent (QContextMenuEvent* event) ...@@ -504,8 +500,6 @@ void UASView::contextMenuEvent (QContextMenuEvent* event)
menu.addAction(removeAction); menu.addAction(removeAction);
} }
menu.addAction(hilAction); menu.addAction(hilAction);
menu.addAction(hilXAction);
// XXX Re-enable later menu.addAction(hilXAction);
menu.addAction(selectAirframeAction); menu.addAction(selectAirframeAction);
menu.addAction(setBatterySpecsAction); menu.addAction(setBatterySpecsAction);
menu.exec(event->globalPos()); menu.exec(event->globalPos());
...@@ -566,6 +560,11 @@ void UASView::selectAirframe() ...@@ -566,6 +560,11 @@ void UASView::selectAirframe()
} }
} }
void UASView::showHILUi()
{
MainWindow::instance()->showHILConfigurationWidget(uas);
}
void UASView::refresh() void UASView::refresh()
{ {
//setUpdatesEnabled(false); //setUpdatesEnabled(false);
......
...@@ -64,6 +64,7 @@ public slots: ...@@ -64,6 +64,7 @@ public slots:
void updateMode(int sysId, QString status, QString description); void updateMode(int sysId, QString status, QString description);
void updateLoad(UASInterface* uas, double load); void updateLoad(UASInterface* uas, double load);
//void receiveValue(int uasid, QString id, double value, quint64 time); //void receiveValue(int uasid, QString id, double value, quint64 time);
void showHILUi();
void refresh(); void refresh();
/** @brief Receive new waypoint information */ /** @brief Receive new waypoint information */
void setWaypoint(int uasId, int id, double x, double y, double z, double yaw, bool autocontinue, bool current); void setWaypoint(int uasId, int id, double x, double y, double z, double yaw, bool autocontinue, bool current);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment