diff --git a/src/comm/QGCFlightGearLink.h b/src/comm/QGCFlightGearLink.h index f8cbb2628c99fa2be99e3f99d242d7836544679f..9bdda2e5d53c32b6aa635a321675f2c0a408afe2 100644 --- a/src/comm/QGCFlightGearLink.h +++ b/src/comm/QGCFlightGearLink.h @@ -79,6 +79,10 @@ public: return -1; } + bool sensorHilEnabled() { + return _sensorHilEnabled; + } + void run(); public slots: @@ -104,6 +108,12 @@ public slots: Q_UNUSED(airframe); } + void enableSensorHIL(bool enable) { + if (enable != _sensorHilEnabled) + _sensorHilEnabled = enable; + emit sensorHilChanged(enable); + } + void readBytes(); /** * @brief Write a number of bytes to the interface. @@ -144,6 +154,7 @@ protected: QProcess* terraSync; unsigned int flightGearVersion; QString startupArguments; + bool _sensorHilEnabled; void setName(QString name); diff --git a/src/comm/QGCHilLink.h b/src/comm/QGCHilLink.h index d84d128a4e1efe06df3691377d2fd6efefb5da30..b74bac37fa948ea295bd1b91140ca62b168ffd0f 100644 --- a/src/comm/QGCHilLink.h +++ b/src/comm/QGCHilLink.h @@ -37,6 +37,12 @@ public: */ virtual int getAirFrameIndex() = 0; + /** + * @brief Check if sensor level HIL is enabled + * @return true if sensor HIL is enabled + */ + virtual bool sensorHilEnabled() = 0; + public slots: virtual void setPort(int port) = 0; /** @brief Add a new host to broadcast messages to */ @@ -47,6 +53,8 @@ public slots: virtual void processError(QProcess::ProcessError err) = 0; /** @brief Set the simulator version as text string */ virtual void setVersion(const QString& version) = 0; + /** @brief Enable sensor-level HIL (instead of state-level HIL) */ + virtual void enableSensorHIL(bool enable) = 0; virtual void selectAirframe(const QString& airframe) = 0; @@ -105,6 +113,9 @@ signals: /** @brief Selected sim version changed */ void versionChanged(const QString& version); + + /** @brief Sensor leve HIL state changed */ + void sensorHilChanged(bool enabled); }; #endif // QGCHILLINK_H diff --git a/src/comm/QGCJSBSimLink.h b/src/comm/QGCJSBSimLink.h index 4492414b68b735cbbb6c848881105555982160bb..a720f1fff3fbd8d362194027fa826a5822909922 100644 --- a/src/comm/QGCJSBSimLink.h +++ b/src/comm/QGCJSBSimLink.h @@ -81,6 +81,10 @@ public: void run(); + bool sensorHilEnabled() { + return _sensorHilEnabled; + } + public slots: // void setAddress(QString address); void setPort(int port); @@ -104,6 +108,12 @@ public slots: script = airframe; } + void enableSensorHIL(bool enable) { + if (enable != _sensorHilEnabled) + _sensorHilEnabled = enable; + emit sensorHilChanged(enable); + } + void readBytes(); /** * @brief Write a number of bytes to the interface. @@ -142,6 +152,7 @@ protected: unsigned int flightGearVersion; QString startupArguments; QString script; + bool _sensorHilEnabled; void setName(QString name); diff --git a/src/comm/QGCXPlaneLink.cc b/src/comm/QGCXPlaneLink.cc index a2f8a4ec9b0c5f7efa7791d9bb83fcf495d96456..9703981553d83909f5afa78e71042f7c687e6a8f 100644 --- a/src/comm/QGCXPlaneLink.cc +++ b/src/comm/QGCXPlaneLink.cc @@ -54,7 +54,7 @@ QGCXPlaneLink::QGCXPlaneLink(UASInterface* mav, QString remoteHost, QHostAddress simUpdateLast(QGC::groundTimeMilliseconds()), simUpdateLastText(QGC::groundTimeMilliseconds()), simUpdateHz(0), - sensorHilEnabled(true) + _sensorHilEnabled(true) { this->localHost = localHost; this->localPort = localPort/*+mav->getUASID()*/; @@ -81,6 +81,7 @@ void QGCXPlaneLink::loadSettings() setRemoteHost(settings.value("REMOTE_HOST", QString("%1:%2").arg(remoteHost.toString()).arg(remotePort)).toString()); setVersion(settings.value("XPLANE_VERSION", 10).toInt()); selectAirframe(settings.value("AIRFRAME", "default").toString()); + _sensorHilEnabled = settings.value("SENSOR_HIL", _sensorHilEnabled).toBool(); settings.endGroup(); } @@ -92,6 +93,7 @@ void QGCXPlaneLink::storeSettings() settings.setValue("REMOTE_HOST", QString("%1:%2").arg(remoteHost.toString()).arg(remotePort)); settings.setValue("XPLANE_VERSION", xPlaneVersion); settings.setValue("AIRFRAME", airframeName); + settings.setValue("SENSOR_HIL", _sensorHilEnabled); settings.endGroup(); settings.sync(); } @@ -623,7 +625,7 @@ void QGCXPlaneLink::readBytes() } simUpdateLast = QGC::groundTimeMilliseconds(); - if (sensorHilEnabled) + if (_sensorHilEnabled) { diff_pressure = 0.0f; pressure_alt = alt; diff --git a/src/comm/QGCXPlaneLink.h b/src/comm/QGCXPlaneLink.h index daeaad6c3abe272afe547d20a96243d6de64db88..ec7f362d29589435b990aad0497bca74f6276d00 100644 --- a/src/comm/QGCXPlaneLink.h +++ b/src/comm/QGCXPlaneLink.h @@ -91,6 +91,20 @@ public: AIRFRAME_FIXED_WING_BIXLER_II_AILERONS }; + QString getVersion() + { + return QString("X-Plane %1").arg(xPlaneVersion); + } + + int getAirFrameIndex() + { + return (int)airframeID; + } + + bool sensorHilEnabled() { + return _sensorHilEnabled; + } + public slots: // void setAddress(QString address); void setPort(int port); @@ -104,14 +118,11 @@ public slots: void setVersion(const QString& version); /** @brief Set the simulator version as integer */ void setVersion(unsigned int version); - QString getVersion() - { - return QString("X-Plane %1").arg(xPlaneVersion); - } - int getAirFrameIndex() - { - return (int)airframeID; + void enableSensorHIL(bool enable) { + if (enable != _sensorHilEnabled) + _sensorHilEnabled = enable; + emit sensorHilChanged(enable); } void processError(QProcess::ProcessError err); @@ -194,10 +205,9 @@ protected: quint64 simUpdateLast; quint64 simUpdateLastText; float simUpdateHz; - bool sensorHilEnabled; + bool _sensorHilEnabled; void setName(QString name); - }; #endif // QGCXPLANESIMULATIONLINK_H diff --git a/src/configuration.h b/src/configuration.h index 69b926514440627f0444e3352d3add74880ac7d2..b759799d18ffe708f23a1cac2b4d66e041d6e374 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -12,14 +12,14 @@ #define WITH_TEXT_TO_SPEECH 1 #define QGC_APPLICATION_NAME "QGroundControl" -#define QGC_APPLICATION_VERSION "v. 1.0.4 (beta)" +#define QGC_APPLICATION_VERSION "v. 1.0.2 (beta)" namespace QGC { const QString APPNAME = "QGROUNDCONTROL"; const QString COMPANYNAME = "QGROUNDCONTROL"; -const int APPLICATIONVERSION = 104; // 1.0.4 +const int APPLICATIONVERSION = 105; // 1.0.4 } #endif // QGC_CONFIGURATION_H diff --git a/src/ui/MainWindow.cc b/src/ui/MainWindow.cc index e07c459267a74499abce5f15925765e1c72605a0..e204d29fa794f0a3f153d84c11a64eb4124d2749 100644 --- a/src/ui/MainWindow.cc +++ b/src/ui/MainWindow.cc @@ -236,9 +236,10 @@ MainWindow::MainWindow(QWidget *parent): const int screenWidth = QApplication::desktop()->width(); const int screenHeight = QApplication::desktop()->height(); - if (screenWidth < 1200) + if (screenWidth < 1400) { - showFullScreen(); + resize(screenWidth, screenHeight - 80); + show(); } else { @@ -680,7 +681,7 @@ void MainWindow::showHILConfigurationWidget(UASInterface* uas) QDockWidget* hilDock = new QDockWidget(hilDockName, this); hilDock->setWidget(hconf); hilDock->setObjectName(QString("HIL_CONFIG_%1").arg(uas->getUASID())); - addTool(hilDock, hilDockName, Qt::RightDockWidgetArea); + addTool(hilDock, hilDockName, Qt::LeftDockWidgetArea); hilDocks.insert(mav->getUASID(), hilDock); if (currentView != VIEW_SIMULATION) diff --git a/src/ui/MainWindow.ui b/src/ui/MainWindow.ui index ab688cb4af894262b004a72c977fb79835f25f24..15963dd32119fb1014da3197fb31ee3e591c5282 100644 --- a/src/ui/MainWindow.ui +++ b/src/ui/MainWindow.ui @@ -497,7 +497,7 @@ :/files/images/control/launch.svg:/files/images/control/launch.svg - Simulation View + Simulation Open the simulation view diff --git a/src/ui/QGCHilConfiguration.cc b/src/ui/QGCHilConfiguration.cc index 941707dbbc91275c6c20806707c6bc1f239881a1..4919b4d8c91385b0fbc297a4fd5fce3c3f70bf3e 100644 --- a/src/ui/QGCHilConfiguration.cc +++ b/src/ui/QGCHilConfiguration.cc @@ -1,3 +1,5 @@ +#include + #include "QGCHilConfiguration.h" #include "ui_QGCHilConfiguration.h" @@ -11,6 +13,22 @@ QGCHilConfiguration::QGCHilConfiguration(UAS *mav, QWidget *parent) : ui(new Ui::QGCHilConfiguration) { ui->setupUi(this); + + // XXX its quite wrong that this is implicitely a factory + // class, but this is something to clean up for later. + + QSettings settings; + int i = settings.value("SIMULATOR_INDEX", -1).toInt(); + settings.beginGroup("QGC_HILCONFIG"); + + if (i > 0) { + on_simComboBox_currentIndexChanged(i); + ui->simComboBox->blockSignals(true); + ui->simComboBox->setCurrentIndex(i); + ui->simComboBox->blockSignals(false); + } + + settings.endGroup(); } void QGCHilConfiguration::receiveStatusMessage(const QString& message) @@ -20,6 +38,11 @@ void QGCHilConfiguration::receiveStatusMessage(const QString& message) QGCHilConfiguration::~QGCHilConfiguration() { + QSettings settings; + settings.beginGroup("QGC_HILCONFIG"); + settings.setValue("SIMULATOR_INDEX", ui->simComboBox->currentIndex()); + settings.endGroup(); + settings.sync(); delete ui; } @@ -29,8 +52,8 @@ void QGCHilConfiguration::on_simComboBox_currentIndexChanged(int index) QLayoutItem *child; while ((child = ui->simulatorConfigurationLayout->takeAt(0)) != 0) { - delete child->widget(); - delete child; + delete child->widget(); + delete child; } if(1 == index) diff --git a/src/ui/QGCHilXPlaneConfiguration.cc b/src/ui/QGCHilXPlaneConfiguration.cc index 1eaf7632c934a58b041a0f186d611cca2fe61bc0..f024a428717a4735b8775dc3f30e09c8c2f736fe 100644 --- a/src/ui/QGCHilXPlaneConfiguration.cc +++ b/src/ui/QGCHilXPlaneConfiguration.cc @@ -27,6 +27,11 @@ QGCHilXPlaneConfiguration::QGCHilXPlaneConfiguration(QGCHilLink* link, QWidget * // connect(ui->randomPositionButton, SIGNAL(clicked()), link, SLOT(setRandomPosition())); connect(ui->airframeComboBox, SIGNAL(activated(QString)), link, SLOT(selectAirframe(QString))); ui->airframeComboBox->setCurrentIndex(link->getAirFrameIndex()); + // XXX not implemented yet + ui->airframeComboBox->hide(); + ui->sensorHilCheckBox->setChecked(link->sensorHilEnabled()); + connect(link, SIGNAL(sensorHilChanged(bool)), ui->sensorHilCheckBox, SLOT(setChecked(bool))); + connect(ui->sensorHilCheckBox, SIGNAL(clicked(bool)), link, SLOT(enableSensorHIL(bool))); } ui->hostComboBox->clear(); diff --git a/src/ui/QGCHilXPlaneConfiguration.ui b/src/ui/QGCHilXPlaneConfiguration.ui index dbcc93a97110b2ede278717d8eb1c1300a877252..cc6f1def23338b0acbeef7ce37180c800a80e3b4 100644 --- a/src/ui/QGCHilXPlaneConfiguration.ui +++ b/src/ui/QGCHilXPlaneConfiguration.ui @@ -6,14 +6,14 @@ 0 0 - 249 - 100 + 295 + 148 Form - + 0 @@ -24,19 +24,6 @@ - - - - Qt::Vertical - - - - 20 - 40 - - - - @@ -127,6 +114,26 @@ + + + + Enable sensor level HIL + + + + + + + Qt::Vertical + + + + 20 + 1 + + + + diff --git a/src/ui/map3D/SystemViewParams.cc b/src/ui/map3D/SystemViewParams.cc index 0dc70e34cb37b38845822d49da8a0b587b8f45ea..a8ed5a5c43d3c3588dba9bbeace1a81dcd4f7424 100644 --- a/src/ui/map3D/SystemViewParams.cc +++ b/src/ui/map3D/SystemViewParams.cc @@ -18,6 +18,7 @@ SystemViewParams::SystemViewParams(int systemId) , mSetpointHistoryLength(100) { + setObjectName("RGBD VIEW PARAMS"); } bool& diff --git a/src/ui/map3D/ViewParamWidget.cc b/src/ui/map3D/ViewParamWidget.cc index a689bde5906616e484e69124c651df3525c6c438..adf352c399e229a62904d8d2cb3ca06b1c3a79f9 100644 --- a/src/ui/map3D/ViewParamWidget.cc +++ b/src/ui/map3D/ViewParamWidget.cc @@ -19,6 +19,7 @@ ViewParamWidget::ViewParamWidget(GlobalViewParamsPtr& globalViewParams, , mFollowCameraComboBox(new QComboBox(this)) , mTabWidget(new QTabWidget(this)) { + setObjectName("RGBD VIEW PARAMS WIDGET"); QVBoxLayout* layout = new QVBoxLayout; QWidget* widget = new QWidget; widget->setLayout(layout);