diff --git a/qgroundcontrol.pro b/qgroundcontrol.pro index a9e8a18421da3e1e6e027dea4c5917f3c2b626f2..9cb17a35068bf2910820ef0fec0d4dd0be55a442 100644 --- a/qgroundcontrol.pro +++ b/qgroundcontrol.pro @@ -272,7 +272,6 @@ FORMS += \ src/ui/AudioOutputWidget.ui \ src/ui/QGCSensorSettingsWidget.ui \ src/ui/QGCDataPlot2D.ui \ - src/ui/QGCRemoteControlView.ui \ src/ui/QMap3D.ui \ src/ui/QGCWebView.ui \ src/ui/map3D/QGCGoogleEarthView.ui \ @@ -290,7 +289,6 @@ FORMS += \ src/ui/QGCUDPLinkConfiguration.ui \ src/ui/QGCTCPLinkConfiguration.ui \ src/ui/QGCSettingsWidget.ui \ - src/ui/UASControlParameters.ui \ src/ui/map/QGCMapTool.ui \ src/ui/map/QGCMapToolBar.ui \ src/ui/QGCMAVLinkInspector.ui \ @@ -317,7 +315,6 @@ FORMS += \ src/ui/QGCHilXPlaneConfiguration.ui \ src/ui/uas/UASQuickView.ui \ src/ui/uas/UASQuickViewItemSelect.ui \ - src/ui/uas/UASActionsWidget.ui \ src/ui/QGCTabbedInfoView.ui \ src/ui/UASRawStatusView.ui \ src/ui/uas/QGCMessageView.ui \ @@ -383,13 +380,6 @@ HEADERS += \ src/QGC.h \ src/ui/QGCDataPlot2D.h \ src/ui/linechart/IncrementalPlot.h \ - src/ui/QGCRemoteControlView.h \ - src/ui/RadioCalibration/RadioCalibrationData.h \ - src/ui/RadioCalibration/RadioCalibrationWindow.h \ - src/ui/RadioCalibration/AirfoilServoCalibrator.h \ - src/ui/RadioCalibration/SwitchCalibrator.h \ - src/ui/RadioCalibration/CurveCalibrator.h \ - src/ui/RadioCalibration/AbstractCalibrator.h \ src/comm/QGCMAVLink.h \ src/ui/QGCWebView.h \ src/ui/map3D/QGCWebPage.h \ @@ -414,7 +404,6 @@ HEADERS += \ src/ui/QGCUDPLinkConfiguration.h \ src/ui/QGCTCPLinkConfiguration.h \ src/ui/QGCSettingsWidget.h \ - src/ui/uas/UASControlParameters.h \ src/uas/QGCUASParamManager.h \ src/ui/map/QGCMapWidget.h \ src/ui/map/MAV2DIcon.h \ @@ -456,7 +445,6 @@ HEADERS += \ src/ui/uas/UASQuickViewItemSelect.h \ src/ui/uas/UASQuickViewTextItem.h \ src/ui/uas/UASQuickViewGaugeItem.h \ - src/ui/uas/UASActionsWidget.h \ src/ui/QGCTabbedInfoView.h \ src/ui/UASRawStatusView.h \ src/ui/PrimaryFlightDisplay.h \ @@ -535,13 +523,6 @@ SOURCES += \ src/QGC.cc \ src/ui/QGCDataPlot2D.cc \ src/ui/linechart/IncrementalPlot.cc \ - src/ui/QGCRemoteControlView.cc \ - src/ui/RadioCalibration/RadioCalibrationWindow.cc \ - src/ui/RadioCalibration/AirfoilServoCalibrator.cc \ - src/ui/RadioCalibration/SwitchCalibrator.cc \ - src/ui/RadioCalibration/CurveCalibrator.cc \ - src/ui/RadioCalibration/AbstractCalibrator.cc \ - src/ui/RadioCalibration/RadioCalibrationData.cc \ src/ui/QGCWebView.cc \ src/ui/map3D/QGCWebPage.cc \ src/ui/QGCMainWindowAPConfigurator.cc \ @@ -565,7 +546,6 @@ SOURCES += \ src/ui/QGCUDPLinkConfiguration.cc \ src/ui/QGCTCPLinkConfiguration.cc \ src/ui/QGCSettingsWidget.cc \ - src/ui/uas/UASControlParameters.cpp \ src/uas/QGCUASParamManager.cc \ src/ui/map/QGCMapWidget.cc \ src/ui/map/MAV2DIcon.cc \ @@ -605,7 +585,6 @@ SOURCES += \ src/ui/uas/UASQuickViewTextItem.cc \ src/ui/uas/UASQuickViewGaugeItem.cc \ src/ui/uas/UASQuickViewItemSelect.cc \ - src/ui/uas/UASActionsWidget.cpp \ src/ui/QGCTabbedInfoView.cpp \ src/ui/UASRawStatusView.cpp \ src/ui/PrimaryFlightDisplay.cc \ diff --git a/src/uas/QGCUASParamManager.cc b/src/uas/QGCUASParamManager.cc index 3f19abcd044831833539c25c1df57caf968b233b..f9fb2940d534a65975768f5c2af62fc9d22a537a 100644 --- a/src/uas/QGCUASParamManager.cc +++ b/src/uas/QGCUASParamManager.cc @@ -3,6 +3,7 @@ #include #include #include +#include #include "UASInterface.h" diff --git a/src/uas/UASInterface.h b/src/uas/UASInterface.h index e15b98949a491993a48fa600f7e4ec1fb4631415..2d7beb74a0616f20e401a351b526a04d5d5a8a09 100644 --- a/src/uas/UASInterface.h +++ b/src/uas/UASInterface.h @@ -43,7 +43,6 @@ This file is part of the QGROUNDCONTROL project #include "UASParameterDataModel.h" #include "UASWaypointManager.h" #include "QGCUASParamManagerInterface.h" -#include "RadioCalibration/RadioCalibrationData.h" class QGCUASFileManager; @@ -584,8 +583,6 @@ signals: void remoteControlChannelScaledChanged(int channelId, float normalized); /** @brief Remote control RSSI changed */ void remoteControlRSSIChanged(float rssi); - /** @brief Radio Calibration Data has been received from the MAV*/ - void radioCalibrationReceived(const QPointer&); /** * @brief Localization quality changed diff --git a/src/uas/UASParameterCommsMgr.cc b/src/uas/UASParameterCommsMgr.cc index 627a01f4f99d436ee43e4597f8c927ea2aae0138..137c2385600f9ef94b995f11c60462baf302b8ae 100644 --- a/src/uas/UASParameterCommsMgr.cc +++ b/src/uas/UASParameterCommsMgr.cc @@ -1,6 +1,7 @@ #include "UASParameterCommsMgr.h" #include +#include #include "QGCUASParamManagerInterface.h" #include "UASInterface.h" diff --git a/src/ui/MAVLinkDecoder.cc b/src/ui/MAVLinkDecoder.cc index 3ce913a1b841693bba52dcc758df8a7f72692a62..6fc661383adb94acfcc61b16621986a13660a2c8 100644 --- a/src/ui/MAVLinkDecoder.cc +++ b/src/ui/MAVLinkDecoder.cc @@ -1,6 +1,8 @@ #include "MAVLinkDecoder.h" #include "UASManager.h" +#include + MAVLinkDecoder::MAVLinkDecoder(MAVLinkProtocol* protocol, QObject *parent) : QThread() { diff --git a/src/ui/MainWindow.cc b/src/ui/MainWindow.cc index e5f87c531107640231003be92bae2c08757769fa..eaa49e7025416d0fc86d7d10fbc4a81ed9404808 100644 --- a/src/ui/MainWindow.cc +++ b/src/ui/MainWindow.cc @@ -62,7 +62,6 @@ This file is part of the QGROUNDCONTROL project #include "UASQuickView.h" #include "QGCDataPlot2D.h" #include "Linecharts.h" -#include "UASActionsWidget.h" #include "QGCTabbedInfoView.h" #include "UASRawStatusView.h" #include "PrimaryFlightDisplay.h" diff --git a/src/ui/MainWindow.h b/src/ui/MainWindow.h index 7de1a1110e8eec0ab7396419ecb2d8a064e7375e..6781e8fbe739745d2672538c4628595c7140b90f 100644 --- a/src/ui/MainWindow.h +++ b/src/ui/MainWindow.h @@ -57,7 +57,6 @@ This file is part of the QGROUNDCONTROL project #include "ParameterInterface.h" #include "HDDisplay.h" #include "HSIDisplay.h" -#include "QGCRemoteControlView.h" #include "opmapcontrol.h" #ifdef QGC_GOOGLE_EARTH_ENABLED #include "QGCGoogleEarthView.h" @@ -65,11 +64,11 @@ This file is part of the QGROUNDCONTROL project #include "QGCToolBar.h" #include "LogCompressor.h" -#include "UASControlParameters.h" #include "QGCMAVLinkInspector.h" #include "QGCMAVLinkLogPlayer.h" #include "MAVLinkDecoder.h" #include "QGCUASFileViewMulti.h" +#include "QGCFlightGearLink.h" class QGCMapTool; class QGCMAVLinkMessageSender; diff --git a/src/ui/QGCRemoteControlView.cc b/src/ui/QGCRemoteControlView.cc deleted file mode 100644 index 1825a4dc6b5a79bfcf6b393404d8389c36b63bb8..0000000000000000000000000000000000000000 --- a/src/ui/QGCRemoteControlView.cc +++ /dev/null @@ -1,231 +0,0 @@ -/*===================================================================== - -QGroundControl Open Source Ground Control Station - -(c) 2009, 2010 QGROUNDCONTROL PROJECT - -This file is part of the QGROUNDCONTROL project - - QGROUNDCONTROL is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - QGROUNDCONTROL is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with QGROUNDCONTROL. If not, see . - -======================================================================*/ - -/** - * @file - * @brief Implementation of QGCRemoteControlView - * @author Lorenz Meier - * @author Bryan Godbolt - */ - -#include -#include -#include -#include -#include -#include -#include "QGCRemoteControlView.h" -#include "ui_QGCRemoteControlView.h" -#include "UASManager.h" - -QGCRemoteControlView::QGCRemoteControlView(QWidget *parent) : - QWidget(parent), - uasId(-1), - rssi(0.0f), - updated(false), - channelLayout(new QVBoxLayout()), - ui(NULL) -{ - ui->setupUi(this); - QGridLayout* layout = new QGridLayout(this); - layout->addLayout(channelLayout, 1, 0, 1, 2); - nameLabel = new QLabel(this); - layout->addWidget(nameLabel, 0, 0, 1, 2); - - this->setVisible(false); - //setVisible(false); - -// calibrate = new QPushButton(tr("Calibrate"), this); -// QHBoxLayout *calibrateButtonLayout = new QHBoxLayout(); -// calibrateButtonLayout->addWidget(calibrate, 0, Qt::AlignHCenter); -// layout->addItem(calibrateButtonLayout, 3, 0, 1, 2); - -// calibrationWindow = new RadioCalibrationWindow(this); -// connect(calibrate, SIGNAL(clicked()), calibrationWindow, SLOT(show())); - - connect(UASManager::instance(), SIGNAL(activeUASSet(int)), this, SLOT(setUASId(int))); - - connect(&updateTimer, SIGNAL(timeout()), this, SLOT(redraw())); - updateTimer.start(1500); -} - -QGCRemoteControlView::~QGCRemoteControlView() -{ - if(this->ui) - { - delete ui; - } - if(this->channelLayout) - { - delete channelLayout; - } -} - -void QGCRemoteControlView::setUASId(int id) -{ - if (uasId != -1) - { - UASInterface* uas = UASManager::instance()->getUASForId(uasId); - if (uas) - { - // The UAS exists, disconnect any existing connections - disconnect(uas, SIGNAL(remoteControlChannelRawChanged(int,float,float)), this, SLOT(setChannel(int,float,float))); - disconnect(uas, SIGNAL(remoteControlRSSIChanged(float)), this, SLOT(setRemoteRSSI(float))); - //disconnect(uas, SIGNAL(radioCalibrationRawReceived(const QPointer&)), calibrationWindow, SLOT(receive(const QPointer&))); - //disconnect(uas, SIGNAL(remoteControlChannelRawChanged(int,float)), calibrationWindow, SLOT(setChannel(int,float))); - disconnect(uas, SIGNAL(remoteControlChannelScaledChanged(int,float)), this, SLOT(setChannelScaled(int,float))); - } - } - - // Clear channel count - raw.clear(); - raw.resize(0); - normalized.clear(); - normalized.resize(0); - - foreach (QLabel* label, rawLabels) - { - label->deleteLater(); - } - - foreach(QProgressBar* bar, progressBars) - { - bar->deleteLater(); - } - - rawLabels.clear(); - rawLabels.resize(0); - progressBars.clear(); - progressBars.resize(0); - - // Connect the new UAS - UASInterface* newUAS = UASManager::instance()->getUASForId(id); - if (newUAS) - { - // New UAS exists, connect - nameLabel->setText(QString("RC Input of %1").arg(newUAS->getUASName())); - //calibrationWindow->setUASId(id); - //connect(newUAS, SIGNAL(radioCalibrationReceived(const QPointer&)), calibrationWindow, SLOT(receive(const QPointer&))); - - connect(newUAS, SIGNAL(remoteControlRSSIChanged(float)), this, SLOT(setRemoteRSSI(float))); - connect(newUAS, SIGNAL(remoteControlChannelRawChanged(int,float)), this, SLOT(setChannelRaw(int,float))); - connect(newUAS, SIGNAL(remoteControlChannelScaledChanged(int,float)), this, SLOT(setChannelScaled(int,float))); - - // only connect raw channels to calibration window widget - //connect(newUAS, SIGNAL(remoteControlChannelRawChanged(int,float)), calibrationWindow, SLOT(setChannel(int,float))); - } -} - -void QGCRemoteControlView::setChannelRaw(int channelId, float raw) -{ - - if (this->raw.count() <= channelId) { - // This is a new channel, append it - this->raw.append(raw); - appendChannelWidget(channelId); - updated = true; - } else { - // This is an existing channel, aupdate it - if (this->raw[channelId] != raw) updated = true; - this->raw[channelId] = raw; - } -} - -void QGCRemoteControlView::setChannelScaled(int channelId, float normalized) -{ - if (this->normalized.count() <= channelId) // using raw vector as size indicator - { - // This is a new channel, append it - this->normalized.append(normalized); - appendChannelWidget(channelId); - updated = true; - } - else - { - // This is an existing channel, update it - if (this->normalized[channelId] != normalized) updated = true; - this->normalized[channelId] = normalized; - } -} - -void QGCRemoteControlView::setRemoteRSSI(float rssiNormalized) -{ - if (rssi != rssiNormalized) updated = true; - rssi = rssiNormalized; -} - -void QGCRemoteControlView::appendChannelWidget(int channelId) -{ - // Create new layout - QHBoxLayout* layout = new QHBoxLayout(); - // Add content - layout->addWidget(new QLabel(QString("Channel %1").arg(channelId + 1), this)); - QLabel* raw = new QLabel(this); - - // Append raw label - rawLabels.append(raw); - layout->addWidget(raw); - // Append progress bar - QProgressBar* normalized = new QProgressBar(this); - normalized->setMinimum(-100); - normalized->setMaximum(100); - normalized->setFormat("%v%"); - progressBars.append(normalized); - layout->addWidget(normalized); - channelLayout->addLayout(layout); -} - -void QGCRemoteControlView::redraw() -{ - if(isVisible() && updated) - { - // Update percent bars and raw labels - for(int i = 0; (i < progressBars.count()) && (i < rawLabels.count()) && (i < normalized.count()) && (i < raw.count()); i++) - { - rawLabels.at(i)->setText(QString("%1 us").arg(raw.at(i), 4, 10, QChar('0'))); - int vv = normalized.at(i)*100.0f; - progressBars.at(i)->setValue(vv); - } - // Update RSSI - if(rssi>0) { - //rssiBar->setValue(rssi);//*100); - } - - updated = false; - } -} - -void QGCRemoteControlView::changeEvent(QEvent *e) -{ - Q_UNUSED(e); - // FIXME If the lines below are commented in - // runtime errors can occur on x64 systems. -// QWidget::changeEvent(e); -// switch (e->type()) { -// case QEvent::LanguageChange: -// //ui->retranslateUi(this); -// break; -// default: -// break; -// } -} diff --git a/src/ui/QGCRemoteControlView.h b/src/ui/QGCRemoteControlView.h deleted file mode 100644 index 49b501a18952e992556581425eefae87be4b380a..0000000000000000000000000000000000000000 --- a/src/ui/QGCRemoteControlView.h +++ /dev/null @@ -1,85 +0,0 @@ -/*===================================================================== - -QGroundControl Open Source Ground Control Station - -(c) 2009, 2010 QGROUNDCONTROL PROJECT - -This file is part of the QGROUNDCONTROL project - - QGROUNDCONTROL is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - QGROUNDCONTROL is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with QGROUNDCONTROL. If not, see . - -======================================================================*/ - -/** - * @file - * @brief Declaration of QGCRemoteControlView - * @author Lorenz Meier - */ - -#ifndef QGCREMOTECONTROLVIEW_H -#define QGCREMOTECONTROLVIEW_H - -#include -#include -#include - -#include "RadioCalibration/RadioCalibrationWindow.h" - -namespace Ui -{ -class QGCRemoteControlView; -} - -class QVBoxLayout; -class QLabel; -class QProgressBar; - -class QGCRemoteControlView : public QWidget -{ - Q_OBJECT -public: - QGCRemoteControlView(QWidget *parent = 0); - ~QGCRemoteControlView(); - -public slots: - void setUASId(int id); - void setChannelRaw(int channelId, float raw); - void setChannelScaled(int channelId, float normalized); - void setRemoteRSSI(float rssiNormalized); - void redraw(); - -protected slots: - void appendChannelWidget(int channelId); - -protected: - void changeEvent(QEvent *e); - int uasId; - float rssi; - bool updated; - QVBoxLayout* channelLayout; - QVector raw; - QVector normalized; - QVector rawLabels; - QVector progressBars; - QProgressBar* rssiBar; - QLabel* nameLabel; - QPushButton *calibrate; - RadioCalibrationWindow *calibrationWindow; - QTimer updateTimer; - -private: - Ui::QGCRemoteControlView *ui; -}; - -#endif // QGCREMOTECONTROLVIEW_H diff --git a/src/ui/QGCRemoteControlView.ui b/src/ui/QGCRemoteControlView.ui deleted file mode 100644 index 9d863cfa57d71e5230c8cde7b56e71003d9d2046..0000000000000000000000000000000000000000 --- a/src/ui/QGCRemoteControlView.ui +++ /dev/null @@ -1,19 +0,0 @@ - - - QGCRemoteControlView - - - - 0 - 0 - 155 - 106 - - - - Form - - - - - diff --git a/src/ui/QGCStatusBar.cc b/src/ui/QGCStatusBar.cc index 9f771b53d44015e0ccc3747cc729bdfaa32caf48..9c8f2d638467b470d8219a628ac696c3a313e50b 100644 --- a/src/ui/QGCStatusBar.cc +++ b/src/ui/QGCStatusBar.cc @@ -24,6 +24,8 @@ This file is part of the QGROUNDCONTROL project #include #include #include +#include + #include "QGCStatusBar.h" #include "UASManager.h" #include "MainWindow.h" diff --git a/src/ui/QGCTabbedInfoView.h b/src/ui/QGCTabbedInfoView.h index b8ba5faa144572dab68ae4c26afc53713c1c605f..4431c95279220c85406e543d63e9ef88f758b810 100644 --- a/src/ui/QGCTabbedInfoView.h +++ b/src/ui/QGCTabbedInfoView.h @@ -5,7 +5,6 @@ #include "ui_QGCTabbedInfoView.h" #include "MAVLinkDecoder.h" #include "QGCMessageView.h" -#include "UASActionsWidget.h" #include "UASQuickView.h" #include "UASRawStatusView.h" class QGCTabbedInfoView : public QWidget @@ -20,7 +19,6 @@ private: MAVLinkDecoder *m_decoder; Ui::QGCTabbedInfoView ui; QGCMessageView *messageView; - UASActionsWidget *actionsWidget; UASQuickView *quickView; UASRawStatusView *rawView; }; diff --git a/src/ui/QGCUASFileView.cc b/src/ui/QGCUASFileView.cc index 536f1ca6a37b24acde448533c10e3cbc91ad825c..ba718e14070cbf4437506c6b24667363779ef042 100644 --- a/src/ui/QGCUASFileView.cc +++ b/src/ui/QGCUASFileView.cc @@ -28,6 +28,7 @@ #include #include #include +#include QGCUASFileView::QGCUASFileView(QWidget *parent, QGCUASFileManager *manager) : QWidget(parent), diff --git a/src/ui/RadioCalibration/AbstractCalibrator.cc b/src/ui/RadioCalibration/AbstractCalibrator.cc deleted file mode 100644 index 2ab73111b0c28c183ae18aa1e7d8bbd8ae458fa2..0000000000000000000000000000000000000000 --- a/src/ui/RadioCalibration/AbstractCalibrator.cc +++ /dev/null @@ -1,68 +0,0 @@ -#include "AbstractCalibrator.h" - -AbstractCalibrator::AbstractCalibrator(QWidget *parent) : - QWidget(parent), - pulseWidth(new QLabel()), - log(new QVector()) -{ -} - -AbstractCalibrator::~AbstractCalibrator() -{ - delete log; -} - -uint16_t AbstractCalibrator::logAverage() -{ - // Short-circuit here if the log is empty otherwise we get a div-by-0 error. - if (log->empty()) - { - return 0; - } - - uint16_t total = 0; - for (int i=0; isize(); ++i) - { - total += log->value(i); - } - return total/log->size(); -} - -uint16_t AbstractCalibrator::logExtrema() -{ - uint16_t extrema = logAverage(); - if (logAverage() < 1500) - { - for (int i=0; isize(); ++i) - { - if (log->value(i) < extrema) - { - extrema = log->value(i); - } - } - extrema -= 5; // add 5us to prevent integer overflow - } - else - { - for (int i=0; isize(); ++i) - { - if (log->value(i) > extrema) - { - extrema = log->value(i); - } - } - extrema += 5; // subtact 5us to prevent integer overflow - } - - return extrema; -} - -void AbstractCalibrator::channelChanged(uint16_t raw) -{ - pulseWidth->setText(QString::number(raw)); - if (log->size() == 5) - { - log->pop_front(); - } - log->push_back(raw); -} diff --git a/src/ui/RadioCalibration/AbstractCalibrator.h b/src/ui/RadioCalibration/AbstractCalibrator.h deleted file mode 100644 index 70ff632915fa45a8ff0f6e3cd95a35830fe9864a..0000000000000000000000000000000000000000 --- a/src/ui/RadioCalibration/AbstractCalibrator.h +++ /dev/null @@ -1,83 +0,0 @@ -/*===================================================================== - -QGroundControl Open Source Ground Control Station - -(c) 2009, 2010 QGROUNDCONTROL PROJECT - -This file is part of the QGROUNDCONTROL project - - QGROUNDCONTROL is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - QGROUNDCONTROL is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with QGROUNDCONTROL. If not, see . - -======================================================================*/ - -/** - * @file - * @brief Common aspects of radio calibration widgets - * @author Bryan Godbolt - */ - -#ifndef ABSTRACTCALIBRATOR_H -#define ABSTRACTCALIBRATOR_H - -#include -#include -#include -#include - -#include -#include - -/** - @brief Holds the code which is common to all the radio calibration widgets. - - @author Bryan Godbolt - */ -class AbstractCalibrator : public QWidget -{ - Q_OBJECT -public: - explicit AbstractCalibrator(QWidget *parent = 0); - ~AbstractCalibrator(); - - /** Change the setpoints of the widget. Used when - changing the display from an external source (file/uav). - @param data QVector of setpoints - */ - virtual void set(const QVector& data)=0; -signals: - /** Announce a setpoint change. - @param index setpoint number - 0 based in the current implementation - @param value new value - */ - void setpointChanged(int index, uint16_t value); - -public slots: - /** Slot to call when the relevant channel is updated - @param raw current channel value - */ - void channelChanged(uint16_t raw); - -protected: - /** Display the current pulse width */ - QLabel *pulseWidth; - - /** Log of the past few samples for use in averaging and finding extrema */ - QVector *log; - /** Find the maximum or minimum of the data log */ - uint16_t logExtrema(); - /** Find the average of the log */ - uint16_t logAverage(); -}; - -#endif // ABSTRACTCALIBRATOR_H diff --git a/src/ui/RadioCalibration/AirfoilServoCalibrator.cc b/src/ui/RadioCalibration/AirfoilServoCalibrator.cc deleted file mode 100644 index dc7faf28ce3dd4914dcb16cf53ec8b1d9e78d191..0000000000000000000000000000000000000000 --- a/src/ui/RadioCalibration/AirfoilServoCalibrator.cc +++ /dev/null @@ -1,104 +0,0 @@ -#include "AirfoilServoCalibrator.h" - -AirfoilServoCalibrator::AirfoilServoCalibrator(AirfoilType type, QWidget *parent) : - AbstractCalibrator(parent), - highPulseWidth(new QLabel()), - centerPulseWidth(new QLabel()), - lowPulseWidth(new QLabel()) -{ - QGridLayout *grid = new QGridLayout(this); - - /* Add title */ - QHBoxLayout *titleLayout = new QHBoxLayout(); - QLabel* title; - if (type == AILERON) { - title = new QLabel(tr("Aileron")); - } else if (type == ELEVATOR) { - title = new QLabel(tr("Elevator")); - } else if (type == RUDDER) { - title = new QLabel(tr("Rudder")); - } else { - title = new QLabel(tr("Unknown")); - } - - titleLayout->addWidget(title); - grid->addLayout(titleLayout, 0, 0, 1, 3, Qt::AlignHCenter); - - /* Add current Pulse Width Display */ - QLabel *pulseWidthTitle = new QLabel(tr("Pulse Width (us)")); - QHBoxLayout *pulseLayout = new QHBoxLayout(); - pulseLayout->addWidget(pulseWidthTitle); - pulseLayout->addWidget(pulseWidth); - grid->addLayout(pulseLayout, 1, 0, 1, 3); - - QLabel *highPulseString; - QLabel *centerPulseString; - QLabel *lowPulseString; - if (type == AILERON) { - highPulseString = new QLabel(tr("Bank Right")); - centerPulseString = new QLabel(tr("Center")); - lowPulseString = new QLabel(tr("Bank Left")); - } else if (type == ELEVATOR) { - highPulseString = new QLabel(tr("Nose Up")); - centerPulseString = new QLabel(tr("Center")); - lowPulseString = new QLabel(tr("Nose Down")); - } else if (type == RUDDER) { - highPulseString = new QLabel(tr("Nose Right")); - centerPulseString = new QLabel(tr("Center")); - lowPulseString = new QLabel(tr("Nose Left")); - } else { - highPulseString = new QLabel(tr("High")); - centerPulseString = new QLabel(tr("Center")); - lowPulseString = new QLabel(tr("Low")); - } - - - QPushButton *highButton = new QPushButton(tr("Set")); - QPushButton *centerButton = new QPushButton(tr("Set")); - QPushButton *lowButton = new QPushButton(tr("Set")); - - grid->addWidget(highPulseString, 2, 0); - grid->addWidget(highPulseWidth, 2, 1); - grid->addWidget(highButton, 2, 2); - - grid->addWidget(centerPulseString, 3, 0); - grid->addWidget(centerPulseWidth, 3, 1); - grid->addWidget(centerButton, 3, 2); - - grid->addWidget(lowPulseString, 4, 0); - grid->addWidget(lowPulseWidth, 4, 1); - grid->addWidget(lowButton, 4, 2); - - this->setLayout(grid); - - connect(highButton, SIGNAL(clicked()), this, SLOT(setHigh())); - connect(centerButton, SIGNAL(clicked()), this, SLOT(setCenter())); - connect(lowButton, SIGNAL(clicked()), this, SLOT(setLow())); -} - -void AirfoilServoCalibrator::setHigh() -{ - highPulseWidth->setText(QString::number(logExtrema())); - emit setpointChanged(2, logExtrema()); -} - -void AirfoilServoCalibrator::setCenter() -{ - centerPulseWidth->setText(QString::number(logAverage())); - emit setpointChanged(1, logAverage()); -} - -void AirfoilServoCalibrator::setLow() -{ - lowPulseWidth->setText(QString::number(logExtrema())); - emit setpointChanged(0, logExtrema()); -} - -void AirfoilServoCalibrator::set(const QVector &data) -{ - if (data.size() == 3) { - lowPulseWidth->setText(QString::number(data[0])); - centerPulseWidth->setText(QString::number(data[1])); - highPulseWidth->setText(QString::number(data[2])); - } -} diff --git a/src/ui/RadioCalibration/AirfoilServoCalibrator.h b/src/ui/RadioCalibration/AirfoilServoCalibrator.h deleted file mode 100644 index 4775c939a824ee3d5275f79fe31eb4ab866e346a..0000000000000000000000000000000000000000 --- a/src/ui/RadioCalibration/AirfoilServoCalibrator.h +++ /dev/null @@ -1,74 +0,0 @@ -/*===================================================================== - -QGroundControl Open Source Ground Control Station - -(c) 2009, 2010 QGROUNDCONTROL PROJECT - -This file is part of the QGROUNDCONTROL project - - QGROUNDCONTROL is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - QGROUNDCONTROL is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with QGROUNDCONTROL. If not, see . - -======================================================================*/ - -/** - * @file - * @brief Calibration widget for 3 point airfoil servo - * @author Bryan Godbolt - */ - -#ifndef AIRFOILSERVOCALIBRATOR_H -#define AIRFOILSERVOCALIBRATOR_H - -#include -#include -#include -#include -#include -#include - -#include "AbstractCalibrator.h" - -/** - @brief Calibration widget three setpoint control input. - For the helicopter autopilot at UAlberta this is used for Aileron, Elevator, and Rudder channels. - - @author Bryan Godbolt - */ -class AirfoilServoCalibrator : public AbstractCalibrator -{ - Q_OBJECT -public: - enum AirfoilType { - AILERON, - ELEVATOR, - RUDDER - }; - - explicit AirfoilServoCalibrator(AirfoilType type = AILERON, QWidget *parent = 0); - - /** @param data must have exaclty 3 elemets. they are assumed to be low center high */ - void set(const QVector& data); - -protected slots: - void setHigh(); - void setCenter(); - void setLow(); - -protected: - QLabel *highPulseWidth; - QLabel *centerPulseWidth; - QLabel *lowPulseWidth; -}; - -#endif // AIRFOILSERVOCALIBRATOR_H diff --git a/src/ui/RadioCalibration/CurveCalibrator.cc b/src/ui/RadioCalibration/CurveCalibrator.cc deleted file mode 100644 index 5fb3d2456b747f8d3495c0fc0ec422d8afa6071a..0000000000000000000000000000000000000000 --- a/src/ui/RadioCalibration/CurveCalibrator.cc +++ /dev/null @@ -1,126 +0,0 @@ -#include "CurveCalibrator.h" - -CurveCalibrator::CurveCalibrator(QString titleString, QWidget *parent) : - AbstractCalibrator(parent), - setpoints(new QVector(5)), - positions(new QVector()) -{ - QGridLayout *grid = new QGridLayout(this); - QLabel *title = new QLabel(titleString); - grid->addWidget(title, 0, 0, 1, 5, Qt::AlignHCenter); - - QLabel *pulseWidthTitle = new QLabel(tr("Pulse Width (us)")); - pulseWidth = new QLabel(); - QHBoxLayout *pulseLayout = new QHBoxLayout(); - pulseLayout->addWidget(pulseWidthTitle); - pulseLayout->addWidget(pulseWidth); - grid->addLayout(pulseLayout, 1, 0, 1, 5, Qt::AlignHCenter); - - for (int i=0; i<=100; i=i+100/4) - positions->append(static_cast(i)); - - - setpoints->fill(1500); - - plot = new QwtPlot(); - - grid->addWidget(plot, 2, 0, 1, 5, Qt::AlignHCenter); - - - plot->setAxisScale(QwtPlot::yLeft, 1000, 2000, 200); - plot->setAxisScale(QwtPlot::xBottom, 0, 100, 25); - - curve = new QwtPlotCurve(); - curve->setPen(QPen(QColor(QString("lime")))); - - QVector pos(positions->size()); - QVector set(setpoints->size()); - - for (int i=0; isize()&&isize(); i++) - { - pos[i] = static_cast((*positions)[i]); - set[i] = static_cast((*setpoints)[i]); - } - - curve->setSamples(pos, set); - curve->attach(plot); - - plot->replot(); - - QPushButton *zero = new QPushButton(tr("0 %")); - QPushButton *twentyfive = new QPushButton(tr("25 %")); - QPushButton *fifty = new QPushButton(tr("50 %")); - QPushButton *seventyfive = new QPushButton(tr("75 %")); - QPushButton *hundred = new QPushButton(tr("100 %")); - - grid->addWidget(zero, 3, 0); - grid->addWidget(twentyfive, 3, 1); - grid->addWidget(fifty, 3, 2); - grid->addWidget(seventyfive, 3, 3); - grid->addWidget(hundred, 3, 4); - - this->setLayout(grid); - - signalMapper = new QSignalMapper(this); - signalMapper->setMapping(zero, 0); - signalMapper->setMapping(twentyfive, 1); - signalMapper->setMapping(fifty, 2); - signalMapper->setMapping(seventyfive, 3); - signalMapper->setMapping(hundred, 4); - - connect(zero, SIGNAL(clicked()), signalMapper, SLOT(map())); - connect(twentyfive, SIGNAL(clicked()), signalMapper, SLOT(map())); - connect(fifty, SIGNAL(clicked()), signalMapper, SLOT(map())); - connect(seventyfive, SIGNAL(clicked()), signalMapper, SLOT(map())); - connect(hundred, SIGNAL(clicked()), signalMapper, SLOT(map())); - connect(signalMapper, SIGNAL(mapped(int)), this, SLOT(setSetpoint(int))); -} - -CurveCalibrator::~CurveCalibrator() -{ - delete setpoints; - delete positions; -} - -void CurveCalibrator::setSetpoint(int setpoint) -{ - if (setpoint == 0 || setpoint == 4) { - setpoints->replace(setpoint,logExtrema()); - } else { - setpoints->replace(setpoint, logAverage()); - } - - QVector pos(positions->size()); - QVector set(setpoints->size()); - - for (int i=0; isize()&&isize(); i++) - { - pos[i] = static_cast((*positions)[i]); - set[i] = static_cast((*setpoints)[i]); - } - - curve->setSamples(pos, set); - plot->replot(); - - emit setpointChanged(setpoint, setpoints->value(setpoint)); -} - -void CurveCalibrator::set(const QVector &data) -{ - if (data.size() == 5) { - for (int i=0; ireplace(i, data[i]); - QVector pos(positions->size()); - QVector set(setpoints->size()); - - for (int i=0; isize()&&isize(); i++) - { - pos[i] = static_cast((*positions)[i]); - set[i] = static_cast((*setpoints)[i]); - } - curve->setSamples(pos, set); - plot->replot(); - } else { - qDebug() << __FILE__ << __LINE__ << ": wrong data vector size"; - } -} diff --git a/src/ui/RadioCalibration/CurveCalibrator.h b/src/ui/RadioCalibration/CurveCalibrator.h deleted file mode 100644 index 9a4dec9220ab5230415a8235a6f7947caca1ae75..0000000000000000000000000000000000000000 --- a/src/ui/RadioCalibration/CurveCalibrator.h +++ /dev/null @@ -1,76 +0,0 @@ -/*===================================================================== - -QGroundControl Open Source Ground Control Station - -(c) 2009, 2010 QGROUNDCONTROL PROJECT - -This file is part of the QGROUNDCONTROL project - - QGROUNDCONTROL is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - QGROUNDCONTROL is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with QGROUNDCONTROL. If not, see . - -======================================================================*/ - -/** - * @file - * @brief Calibration widget for 5 point inerpolated curve - * @author Bryan Godbolt - */ - -#ifndef CURVECALIBRATOR_H -#define CURVECALIBRATOR_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "AbstractCalibrator.h" - -/** - @brief Calibration widget for 5 point inerpolated curve. - For the helicopter autopilot at UAlberta this is used for the throttle and pitch curves. - */ -class CurveCalibrator : public AbstractCalibrator -{ - Q_OBJECT -public: - explicit CurveCalibrator(QString title = QString(), QWidget *parent = 0); - ~CurveCalibrator(); - - void set(const QVector &data); - -protected slots: - void setSetpoint(int setpoint); - -protected: - QVector *setpoints; - QVector *positions; - /** Plot to display calibration curve */ - QwtPlot *plot; - /** Curve object of calibration curve */ - QwtPlotCurve *curve; - - QSignalMapper *signalMapper; -}; - -#endif // CURVECALIBRATOR_H diff --git a/src/ui/RadioCalibration/RadioCalibrationData.cc b/src/ui/RadioCalibration/RadioCalibrationData.cc deleted file mode 100644 index 30933158a0662e7d62eff5e7a3f7a9e71f805852..0000000000000000000000000000000000000000 --- a/src/ui/RadioCalibration/RadioCalibrationData.cc +++ /dev/null @@ -1,66 +0,0 @@ -#include "RadioCalibrationData.h" - -RadioCalibrationData::RadioCalibrationData() -{ - data = new QVector >(6); - (*data).insert(AILERON, QVector(3)); - (*data).insert(ELEVATOR, QVector(3)); - (*data).insert(RUDDER, QVector(3)); - (*data).insert(GYRO, QVector(2)); - (*data).insert(PITCH, QVector(5)); - (*data).insert(THROTTLE, QVector(5)); -} - -RadioCalibrationData::RadioCalibrationData(const QVector &aileron, - const QVector &elevator, - const QVector &rudder, - const QVector &gyro, - const QVector &pitch, - const QVector &throttle) -{ - data = new QVector >(); - (*data) << aileron - << elevator - << rudder - << gyro - << pitch - << throttle; -} - -RadioCalibrationData::RadioCalibrationData(const RadioCalibrationData &other) - :QObject() -{ - data = new QVector >(*other.data); -} - -RadioCalibrationData::~RadioCalibrationData() -{ - delete data; -} - -const uint16_t* RadioCalibrationData::operator [](int i) const -{ - if (i < data->size()) { - return (*data)[i].constData(); - } - - return NULL; -} - -const QVector& RadioCalibrationData::operator ()(const int i) const throw(std::out_of_range) -{ - if ((i < data->size()) && (i >=0)) { - return (*data)[i]; - } - - throw std::out_of_range("Invalid channel index"); -} - -QString RadioCalibrationData::toString(RadioElement element) const -{ - QString s; - foreach (float f, (*data)[element]) { - s += QString::number(f) + ", "; - } - return s.mid(0, s.length()-2); -} diff --git a/src/ui/RadioCalibration/RadioCalibrationData.h b/src/ui/RadioCalibration/RadioCalibrationData.h deleted file mode 100644 index 89e1f3b05c4c11f6757280d8c593f4249597a6e1..0000000000000000000000000000000000000000 --- a/src/ui/RadioCalibration/RadioCalibrationData.h +++ /dev/null @@ -1,116 +0,0 @@ -/*===================================================================== - -QGroundControl Open Source Ground Control Station - -(c) 2009, 2010 QGROUNDCONTROL PROJECT - -This file is part of the QGROUNDCONTROL project - - QGROUNDCONTROL is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - QGROUNDCONTROL is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with QGROUNDCONTROL. If not, see . - -======================================================================*/ - -/** - * @file - * @brief Class to hold the calibration data - * @author Bryan Godbolt - */ - -#ifndef RADIOCALIBRATIONDATA_H -#define RADIOCALIBRATIONDATA_H - -#include -#include -#include -#include -#include - -#include - - -/** - @brief Class to hold the calibration data. - @author Bryan Godbolt - */ -class RadioCalibrationData : public QObject -{ - Q_OBJECT - -public: - explicit RadioCalibrationData(); - RadioCalibrationData(const RadioCalibrationData&); - RadioCalibrationData(const QVector& aileron, - const QVector& elevator, - const QVector& rudder, - const QVector& gyro, - const QVector& pitch, - const QVector& throttle); - ~RadioCalibrationData(); - - enum RadioElement { - AILERON=0, - ELEVATOR, - RUDDER, - GYRO, - PITCH, - THROTTLE - }; - - const uint16_t* operator[](int i) const; -#ifdef _MSC_VER - const QVector& operator()(int i) const; -#else - const QVector& operator()(int i) const throw(std::out_of_range); -#endif - void set(int element, int index, float value) { - (*data)[element][index] = value; - } - -public slots: - void setAileron(int index, uint16_t value) { - set(AILERON, index, value); - } - void setElevator(int index, uint16_t value) { - set(ELEVATOR, index, value); - } - void setRudder(int index, uint16_t value) { - set(RUDDER, index, value); - } - void setGyro(int index, uint16_t value) { - set(GYRO, index, value); - } - void setPitch(int index, uint16_t value) { - set(PITCH, index, value); - } - void setThrottle(int index, uint16_t value) { - set(THROTTLE, index, value); - } - -public: - /// Creates a comma seperated list of the values for a particular element - QString toString(const RadioElement element) const; - -protected: - QVector > *data; - - void init(const QVector& aileron, - const QVector& elevator, - const QVector& rudder, - const QVector& gyro, - const QVector& pitch, - const QVector& throttle); - -}; - -#endif // RADIOCALIBRATIONDATA_H diff --git a/src/ui/RadioCalibration/RadioCalibrationWindow.cc b/src/ui/RadioCalibration/RadioCalibrationWindow.cc deleted file mode 100644 index 14b913c1de0b58d0b238e929c2bb40c8915e6ab3..0000000000000000000000000000000000000000 --- a/src/ui/RadioCalibration/RadioCalibrationWindow.cc +++ /dev/null @@ -1,298 +0,0 @@ -#include "RadioCalibrationWindow.h" -#include "QGCFileDialog.h" - -RadioCalibrationWindow::RadioCalibrationWindow(QWidget *parent) : - QWidget(parent, Qt::Window), - radio(new RadioCalibrationData()) -{ - QGridLayout *grid = new QGridLayout(); - - aileron = new AirfoilServoCalibrator(AirfoilServoCalibrator::AILERON); - grid->addWidget(aileron, 0, 0, 1, 1, Qt::AlignTop); - - elevator = new AirfoilServoCalibrator(AirfoilServoCalibrator::ELEVATOR); - grid->addWidget(elevator, 0, 1, 1, 1, Qt::AlignTop); - - rudder = new AirfoilServoCalibrator(AirfoilServoCalibrator::RUDDER); - grid->addWidget(rudder, 0, 2, 1, 1, Qt::AlignTop); - - gyro = new SwitchCalibrator(tr("Gyro Mode/Gain")); - grid->addWidget(gyro, 0, 3, 1, 1, Qt::AlignTop); - - - pitch = new CurveCalibrator(tr("Collective Pitch")); - grid->addWidget(pitch, 1, 0, 1, 2); - - throttle = new CurveCalibrator(tr("Throttle")); - grid->addWidget(throttle, 1, 2, 1, 2); - - /* Buttons for loading/transmitting calibration data */ - QHBoxLayout *hbox = new QHBoxLayout(); - QPushButton *load = new QPushButton(tr("Load File")); - QPushButton *save = new QPushButton(tr("Save File")); - QPushButton *transmit = new QPushButton(tr("Transmit to UAV")); - QPushButton *get = new QPushButton(tr("Get from UAV")); - hbox->addWidget(load); - hbox->addWidget(save); - hbox->addWidget(transmit); - hbox->addWidget(get); - grid->addLayout(hbox, 2, 0, 1, 4); - this->setLayout(grid); - - connect(load, SIGNAL(clicked()), this, SLOT(loadFile())); - connect(save, SIGNAL(clicked()), this, SLOT(saveFile())); - connect(transmit, SIGNAL(clicked()), this, SLOT(send())); - connect(get, SIGNAL(clicked()), this, SLOT(request())); - - connect(aileron, SIGNAL(setpointChanged(int,uint16_t)), radio, SLOT(setAileron(int,uint16_t))); - connect(elevator, SIGNAL(setpointChanged(int,uint16_t)), radio, SLOT(setElevator(int,uint16_t))); - connect(rudder, SIGNAL(setpointChanged(int,uint16_t)), radio, SLOT(setRudder(int,uint16_t))); - connect(gyro, SIGNAL(setpointChanged(int,uint16_t)), radio, SLOT(setGyro(int,uint16_t))); - connect(pitch, SIGNAL(setpointChanged(int,uint16_t)), radio, SLOT(setPitch(int,uint16_t))); - connect(throttle, SIGNAL(setpointChanged(int,uint16_t)), radio, SLOT(setThrottle(int,uint16_t))); - setUASId(0); -} - - - -void RadioCalibrationWindow::setChannel(int ch, float raw) -{ - /** this expects a particular channel to function mapping - \todo allow run-time channel mapping - */ - switch (ch) { - case 0: - aileron->channelChanged(raw); - break; - case 1: - elevator->channelChanged(raw); - break; - case 2: - throttle->channelChanged(raw); - break; - case 3: - rudder->channelChanged(raw); - break; - case 4: - gyro->channelChanged(raw); - break; - case 5: - pitch->channelChanged(raw); - break; - - - } -} - -void RadioCalibrationWindow::saveFile() -{ - QString fileName(QGCFileDialog::getSaveFileName(this, - tr("Save RC Calibration"), - "settings/", - tr("XML Files (*.xml)"))); - if (fileName.isEmpty()) - return; - - QDomDocument *rcConfig = new QDomDocument(); - - QFile rcFile(fileName); - if (rcFile.exists()) { - rcFile.remove(); - } - if (!rcFile.open(QFile::WriteOnly | QFile::Text)) { - qDebug() << __FILE__ << __LINE__ << "could not open" << rcFile.fileName() << "for writing"; - return; - } - - QDomElement root; - rcConfig->appendChild(root=rcConfig->createElement("channels")); - QDomElement e; - QDomText t; - - // Aileron - e = rcConfig->createElement("threeSetpoint"); - e.setAttribute("name", "Aileron"); - e.setAttribute("number", "1"); - t = rcConfig->createTextNode(radio->toString(RadioCalibrationData::AILERON)); - e.appendChild(t); - root.appendChild(e); - // Elevator - e = rcConfig->createElement("threeSetpoint"); - e.setAttribute("name", "Elevator"); - e.setAttribute("number", "2"); - t = rcConfig->createTextNode(radio->toString(RadioCalibrationData::ELEVATOR)); - e.appendChild(t); - root.appendChild(e); - // Rudder - e = rcConfig->createElement("threeSetpoint"); - e.setAttribute("name", "Rudder"); - e.setAttribute("number", "4"); - t = rcConfig->createTextNode(radio->toString(RadioCalibrationData::RUDDER)); - e.appendChild(t); - root.appendChild(e); - // Gyro Mode/Gain - e = rcConfig->createElement("twoSetpoint"); - e.setAttribute("name", "Gyro"); - e.setAttribute("number", "5"); - t = rcConfig->createTextNode(radio->toString(RadioCalibrationData::GYRO)); - e.appendChild(t); - root.appendChild(e); - // Throttle - e = rcConfig->createElement("fiveSetpoint"); - e.setAttribute("name", "Throttle"); - e.setAttribute("number", "3"); - t = rcConfig->createTextNode(radio->toString(RadioCalibrationData::THROTTLE)); - e.appendChild(t); - root.appendChild(e); - // Pitch - e = rcConfig->createElement("fiveSetpoint"); - e.setAttribute("name", "Pitch"); - e.setAttribute("number", "6"); - t = rcConfig->createTextNode(radio->toString(RadioCalibrationData::PITCH)); - e.appendChild(t); - root.appendChild(e); - - - QTextStream out(&rcFile); - const int IndentSize = 4; - rcConfig->save(out, IndentSize); - rcFile.close(); - -} - -void RadioCalibrationWindow::loadFile() -{ - QString fileName(QGCFileDialog::getOpenFileName(this, - tr("Load RC Calibration"), - "settings/", - tr("XML Files (*.xml)"))); - - if (fileName.isEmpty()) - return; - - QFile rcFile(fileName); - if (!rcFile.exists()) { - return; - } - - if (!rcFile.open(QIODevice::ReadOnly)) { - return; - } - - QDomDocument *rcConfig = new QDomDocument(); - - QString errorStr; - int errorLine; - int errorColumn; - - if (!rcConfig->setContent(&rcFile, true, &errorStr, &errorLine, - &errorColumn)) { - qDebug() << "Error reading XML Parameter File on line: " << errorLine << errorStr; - return; - } - - rcFile.close(); - QDomElement root = rcConfig->documentElement(); - if (root.tagName() != "channels") { - qDebug() << __FILE__ << __LINE__ << "This is not a Radio Calibration xml file"; - return; - } - - - QPointer newRadio = new RadioCalibrationData(); - QDomElement child = root.firstChildElement(); - while (!child.isNull()) { - parseSetpoint(child, newRadio); - child = child.nextSiblingElement(); - } - - receive(newRadio); - - delete newRadio; - delete rcConfig; -} - -void RadioCalibrationWindow::parseSetpoint(const QDomElement &setpoint, const QPointer& newRadio) -{ - QVector setpoints; - QStringList setpointList = setpoint.text().split(",", QString::SkipEmptyParts); - foreach (QString setpoint, setpointList) - setpoints << setpoint.trimmed().toFloat(); - -// qDebug() << __FILE__ << __LINE__ << ": " << setpoint.tagName() << ": " << setpoint.attribute("name") ; - if (setpoint.tagName() == "threeSetpoint") { - if (setpoints.isEmpty()) - setpoints << 0 << 0 << 0; - for (int i=0; i<3; ++i) { - if (setpoint.attribute("name").toUpper() == "AILERON") - newRadio->setAileron(i, setpoints[i]); - else if(setpoint.attribute("name").toUpper() == "ELEVATOR") - newRadio->setElevator(i, setpoints[i]); - else if(setpoint.attribute("name").toUpper() == "RUDDER") - newRadio->setRudder(i, setpoints[i]); - } - } else if (setpoint.tagName() == "twoSetpoint") { - if (setpoints.isEmpty()) - setpoints << 0 << 0; - for (int i=0; i<2; ++i) { - if (setpoint.attribute("name").toUpper() == "GYRO") - newRadio->setGyro(i, setpoints[i]); - } - } else if (setpoint.tagName() == "fiveSetpoint") { - if (setpoints.isEmpty()) - setpoints << 0 << 0 << 0 << 0 << 0; - for (int i=0; i<5; ++i) { - if (setpoint.attribute("name").toUpper() == "PITCH") - newRadio->setPitch(i, setpoints[i]); - else if (setpoint.attribute("name").toUpper() == "THROTTLE") - newRadio->setThrottle(i, setpoints[i]); - } - } -} - -void RadioCalibrationWindow::send() -{ - qDebug() << __FILE__ << __LINE__ << "uasId = " << uasId; -#ifdef MAVLINK_ENABLED_UALBERTA - UAS *uas = dynamic_cast(UASManager::instance()->getUASForId(uasId)); - if (uas) { - mavlink_message_t msg; - mavlink_msg_radio_calibration_pack(uasId, 0, &msg, - (*radio)[RadioCalibrationData::AILERON], - (*radio)[RadioCalibrationData::ELEVATOR], - (*radio)[RadioCalibrationData::RUDDER], - (*radio)[RadioCalibrationData::GYRO], - (*radio)[RadioCalibrationData::PITCH], - (*radio)[RadioCalibrationData::THROTTLE]); - uas->sendMessage(msg); - } -#endif -} - -void RadioCalibrationWindow::request() -{ - // FIXME MAVLINKV10PORTINGNEEDED -// qDebug() << __FILE__ << __LINE__ << "READ FROM UAV"; -// UAS *uas = dynamic_cast(UASManager::instance()->getUASForId(uasId)); -// if (uas) { -// mavlink_message_t msg; -// mavlink_msg_action_pack(uasId, 0, &msg, 0, 0, ::MAV_ACTION_CALIBRATE_RC); -// uas->sendMessage(msg); -// } -} - -void RadioCalibrationWindow::receive(const QPointer& radio) -{ - if (radio) { - if (this->radio) - delete this->radio; - this->radio = new RadioCalibrationData(*radio); - - aileron->set((*radio)(RadioCalibrationData::AILERON)); - elevator->set((*radio)(RadioCalibrationData::ELEVATOR)); - rudder->set((*radio)(RadioCalibrationData::RUDDER)); - gyro->set((*radio)(RadioCalibrationData::GYRO)); - pitch->set((*radio)(RadioCalibrationData::PITCH)); - throttle->set((*radio)(RadioCalibrationData::THROTTLE)); - } -} diff --git a/src/ui/RadioCalibration/RadioCalibrationWindow.h b/src/ui/RadioCalibration/RadioCalibrationWindow.h deleted file mode 100644 index fe246ecf376b72284df4531df3c75faef5cb8825..0000000000000000000000000000000000000000 --- a/src/ui/RadioCalibration/RadioCalibrationWindow.h +++ /dev/null @@ -1,93 +0,0 @@ -/*===================================================================== - -QGroundControl Open Source Ground Control Station - -(c) 2009, 2010 QGROUNDCONTROL PROJECT - -This file is part of the QGROUNDCONTROL project - - QGROUNDCONTROL is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - QGROUNDCONTROL is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with QGROUNDCONTROL. If not, see . - -======================================================================*/ - -/** - * @file - * @brief Main window for radio calibration - * @author Bryan Godbolt - */ - -#ifndef RADIOCALIBRATIONWINDOW_H -#define RADIOCALIBRATIONWINDOW_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "AirfoilServoCalibrator.h" -#include "SwitchCalibrator.h" -#include "CurveCalibrator.h" - -#include "UAS.h" -#include "UASManager.h" -#include "RadioCalibrationData.h" - -/** - @brief Main window for radio calibration - @author Bryan Godbolt - */ -class RadioCalibrationWindow : public QWidget -{ - Q_OBJECT - -public: - explicit RadioCalibrationWindow(QWidget *parent = 0); - -public slots: - void setChannel(int ch, float raw); - void loadFile(); - void saveFile(); - void send(); - void request(); - void receive(const QPointer& radio); - void setUASId(int id) { - this->uasId = id; - } - - -protected: - AirfoilServoCalibrator *aileron; - AirfoilServoCalibrator *elevator; - AirfoilServoCalibrator *rudder; - SwitchCalibrator *gyro; - CurveCalibrator *pitch; - CurveCalibrator *throttle; - int uasId; - QPointer radio; - QSignalMapper mapper; - - void parseSetpoint(const QDomElement& setpoint, const QPointer& radio); -}; - -#endif // RADIOCALIBRATIONWINDOW_H diff --git a/src/ui/RadioCalibration/SwitchCalibrator.cc b/src/ui/RadioCalibration/SwitchCalibrator.cc deleted file mode 100644 index 695dddfc3e518f12d88a8e2c275458649abecf18..0000000000000000000000000000000000000000 --- a/src/ui/RadioCalibration/SwitchCalibrator.cc +++ /dev/null @@ -1,57 +0,0 @@ -#include "SwitchCalibrator.h" - -SwitchCalibrator::SwitchCalibrator(QString titleString, QWidget *parent) : - AbstractCalibrator(parent), - defaultPulseWidth(new QLabel()), - toggledPulseWidth(new QLabel()) -{ - /* Add title label*/ - QLabel *title = new QLabel(titleString); - QGridLayout *grid = new QGridLayout(); - grid->addWidget(title, 0, 0, 1, 3); - - /* Add current Pulse Width Display */ - QLabel *pulseWidthTitle = new QLabel(tr("Pulse Width (us)")); - QHBoxLayout *pulseLayout = new QHBoxLayout(); - pulseLayout->addWidget(pulseWidthTitle); - pulseLayout->addWidget(pulseWidth); - grid->addLayout(pulseLayout, 1, 0, 1, 3); - - QLabel *defaultPulseString = new QLabel(tr("Default Position")); - QPushButton *defaultButton = new QPushButton(tr("Set")); - grid->addWidget(defaultPulseString, 2, 0); - grid->addWidget(defaultPulseWidth, 2, 1); - grid->addWidget(defaultButton, 2, 2); - - QLabel *toggledPulseString = new QLabel(tr("Toggled Position")); - QPushButton *toggledButton = new QPushButton(tr("Set")); - grid->addWidget(toggledPulseString, 3, 0); - grid->addWidget(toggledPulseWidth, 3, 1); - grid->addWidget(toggledButton, 3, 2); - - this->setLayout(grid); - - connect(defaultButton, SIGNAL(clicked()), this, SLOT(setDefault())); - connect(toggledButton, SIGNAL(clicked()), this, SLOT(setToggled())); -} - - -void SwitchCalibrator::setDefault() -{ - defaultPulseWidth->setText(QString::number(logExtrema())); - emit setpointChanged(0, logExtrema()); -} - -void SwitchCalibrator::setToggled() -{ - toggledPulseWidth->setText(QString::number(logExtrema())); - emit setpointChanged(1, logExtrema()); -} - -void SwitchCalibrator::set(const QVector &data) -{ - if (data.size() == 2) { - defaultPulseWidth->setText(QString::number(data[0])); - toggledPulseWidth->setText(QString::number(data[1])); - } -} diff --git a/src/ui/RadioCalibration/SwitchCalibrator.h b/src/ui/RadioCalibration/SwitchCalibrator.h deleted file mode 100644 index c89978b55fbbaca8ff5b60ab800a1d51b5b44cc3..0000000000000000000000000000000000000000 --- a/src/ui/RadioCalibration/SwitchCalibrator.h +++ /dev/null @@ -1,64 +0,0 @@ -/*===================================================================== - -QGroundControl Open Source Ground Control Station - -(c) 2009, 2010 QGROUNDCONTROL PROJECT - -This file is part of the QGROUNDCONTROL project - - QGROUNDCONTROL is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - QGROUNDCONTROL is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with QGROUNDCONTROL. If not, see . - -======================================================================*/ - -/** - * @file - * @brief Calibration widget for 2 setpoint switch - * @author Bryan Godbolt - */ - -#ifndef SWITCHCALIBRATOR_H -#define SWITCHCALIBRATOR_H - -#include -#include -#include -#include -#include -#include - -#include "AbstractCalibrator.h" - -/** - @brief Calibration widget for 2 setpoint switch - @author Bryan Godbolt - */ -class SwitchCalibrator : public AbstractCalibrator -{ - Q_OBJECT -public: - explicit SwitchCalibrator(QString title=QString(), QWidget *parent = 0); - - void set(const QVector &data); - -protected slots: - void setDefault(); - void setToggled(); - -protected: - QLabel *defaultPulseWidth; - QLabel *toggledPulseWidth; - -}; - -#endif // SWITCHCALIBRATOR_H diff --git a/src/ui/UASControlParameters.ui b/src/ui/UASControlParameters.ui deleted file mode 100644 index 48bd71db22adda4f6b1572a04a291a5c690671a3..0000000000000000000000000000000000000000 --- a/src/ui/UASControlParameters.ui +++ /dev/null @@ -1,246 +0,0 @@ - - - UASControlParameters - - - - 0 - 0 - 204 - 246 - - - - - 200 - 150 - - - - - 267 - 16777215 - - - - Form - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 100 - 0 - - - - - 16777215 - 16777215 - - - - ---- - - - Qt::AlignCenter - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - 0 - - - - Commands - - - - - - - - Height (m) - - - - - - - 1500.000000000000000 - - - - - - - - - - - Airspeed (m/s) - - - - - - - 500.000000000000000 - - - - - - - - - - - Turn Rate (rad/s) - - - - - - - 180.000000000000000 - - - - - - - - - - - Set - - - - - - - Get - - - - - - - - - Qt::Vertical - - - - 20 - 27 - - - - - - - - - Passthrough - - - - - - - - Elevator - - - - - - - Rudder - - - - - - - Throttle - - - - - - - Ailerons - - - - - - - - - Set - - - - - - - Qt::Vertical - - - - 20 - 26 - - - - - - - - - - - - - diff --git a/src/ui/designer/QGCComboBox.cc b/src/ui/designer/QGCComboBox.cc index d034fca66aad4315f58b4318d7d90a39a9c0ce99..2a0747c0e43fb022a48130342bccf4c6014f972c 100644 --- a/src/ui/designer/QGCComboBox.cc +++ b/src/ui/designer/QGCComboBox.cc @@ -3,6 +3,7 @@ #include #include #include +#include #include "QGCComboBox.h" #include "ui_QGCComboBox.h" diff --git a/src/ui/designer/QGCCommandButton.cc b/src/ui/designer/QGCCommandButton.cc index d8a3748846d87bbb6bbaa1dcb5b43359ea22ffc4..70b892615ae37c7c56606833fd326a9490cb4080 100644 --- a/src/ui/designer/QGCCommandButton.cc +++ b/src/ui/designer/QGCCommandButton.cc @@ -1,4 +1,5 @@ #include +#include #include "QGCCommandButton.h" #include "ui_QGCCommandButton.h" diff --git a/src/ui/designer/QGCParamSlider.cc b/src/ui/designer/QGCParamSlider.cc index 502166bfcbb1f312cc9f015ae363e84d419c7d72..ba19fe473dd4b2dbc77586dc8d2e489ae5d82feb 100644 --- a/src/ui/designer/QGCParamSlider.cc +++ b/src/ui/designer/QGCParamSlider.cc @@ -3,6 +3,7 @@ #include #include #include +#include #include "QGCParamSlider.h" #include "ui_QGCParamSlider.h" diff --git a/src/ui/linechart/ChartPlot.h b/src/ui/linechart/ChartPlot.h index c5196ae8b506e3ba2cbd7efd8d3b32e80bd75c8b..2a44b93874547b5d9d12b209b0c0d362d27ee77f 100644 --- a/src/ui/linechart/ChartPlot.h +++ b/src/ui/linechart/ChartPlot.h @@ -3,6 +3,7 @@ #include #include +#include #include "MainWindow.h" #include "ScrollZoomer.h" diff --git a/src/ui/uas/UASActionsWidget.cpp b/src/ui/uas/UASActionsWidget.cpp deleted file mode 100644 index 96d08c7b0a997038bac275b24608c5d6222efc39..0000000000000000000000000000000000000000 --- a/src/ui/uas/UASActionsWidget.cpp +++ /dev/null @@ -1,120 +0,0 @@ -#include "UASActionsWidget.h" -#include -#include -UASActionsWidget::UASActionsWidget(QWidget *parent) : QWidget(parent) -{ - m_uas = 0; - ui.setupUi(this); - connect(ui.changeAltitudeButton,SIGNAL(clicked()),this,SLOT(changeAltitudeClicked())); - connect(ui.changeSpeedButton,SIGNAL(clicked()),this,SLOT(changeSpeedClicked())); - connect(ui.goToWaypointButton,SIGNAL(clicked()),this,SLOT(goToWaypointClicked())); - connect(ui.armDisarmButton,SIGNAL(clicked()),this,SLOT(armButtonClicked())); - connect(UASManager::instance(),SIGNAL(activeUASSet(UASInterface*)),this,SLOT(activeUASSet(UASInterface*))); - if (UASManager::instance()->getActiveUAS()) - { - activeUASSet(UASManager::instance()->getActiveUAS()); - } -} - -void UASActionsWidget::activeUASSet(UASInterface *uas) -{ - m_uas = uas; - if (uas) - { - connect(m_uas->getWaypointManager(),SIGNAL(waypointEditableListChanged()),this,SLOT(updateWaypointList())); - connect(m_uas->getWaypointManager(),SIGNAL(currentWaypointChanged(quint16)),this,SLOT(currentWaypointChanged(quint16))); - connect(m_uas,SIGNAL(armingChanged(bool)),this,SLOT(armingChanged(bool))); - armingChanged(m_uas->isArmed()); - } - updateWaypointList(); -} -void UASActionsWidget::armButtonClicked() -{ - if (m_uas) - { - if (m_uas->isArmed()) - { - ((UAS*)m_uas)->disarmSystem(); - } - else - { - ((UAS*)m_uas)->armSystem(); - } - } -} - -void UASActionsWidget::armingChanged(bool state) -{ - //TODO: - //Figure out why arm/disarm is in UAS.h and not part of the interface, and fix. - if (state) - { - ui.armDisarmButton->setText("DISARM\nCurrently Armed"); - } - else - { - ui.armDisarmButton->setText("ARM\nCurrently Disarmed"); - } - -} - -void UASActionsWidget::currentWaypointChanged(quint16 wpid) -{ - ui.currentWaypointLabel->setText("Current: " + QString::number(wpid)); -} - -void UASActionsWidget::updateWaypointList() -{ - ui.waypointComboBox->clear(); - if (m_uas) - { - for (int i=0;igetWaypointManager()->getWaypointEditableList().size();i++) - { - ui.waypointComboBox->addItem(QString::number(i)); - } - } -} - -UASActionsWidget::~UASActionsWidget() -{ -} -void UASActionsWidget::goToWaypointClicked() -{ - if (!m_uas) - { - return; - } - m_uas->getWaypointManager()->setCurrentWaypoint(ui.waypointComboBox->currentIndex()); -} - -void UASActionsWidget::changeAltitudeClicked() -{ - QMessageBox::information(0,"Error","No implemented yet."); -} - -void UASActionsWidget::changeSpeedClicked() -{ - if (!m_uas) - { - return; - } - if (m_uas->getSystemType() == MAV_TYPE_QUADROTOR) - { - m_uas->setParameter(1,"WP_SPEED_MAX",QVariant(((float)ui.altitudeSpinBox->value() * 100))); - return; - } - else if (m_uas->getSystemType() == MAV_TYPE_FIXED_WING) - { - QVariant variant; - if (m_uas->getParamManager()->getParameterValue(1,"ARSPD_ENABLE",variant)) - { - if (variant.toInt() == 1) - { - m_uas->setParameter(1,"TRIM_ARSPD_CN",QVariant(((float)ui.altitudeSpinBox->value() * 100))); - return; - } - - } - m_uas->setParameter(1,"TRIM_ARSPD_CN",QVariant(((float)ui.altitudeSpinBox->value() * 100))); - } -} diff --git a/src/ui/uas/UASActionsWidget.h b/src/ui/uas/UASActionsWidget.h deleted file mode 100644 index a6f256d79be2c3b744c85af48cefb878c39e3fbc..0000000000000000000000000000000000000000 --- a/src/ui/uas/UASActionsWidget.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef UASACTIONSWIDGET_H -#define UASACTIONSWIDGET_H - -#include -#include "ui_UASActionsWidget.h" -#include -#include -class UASActionsWidget : public QWidget -{ - Q_OBJECT - -public: - explicit UASActionsWidget(QWidget *parent = 0); - ~UASActionsWidget(); -private: - Ui::UASActionsWidget ui; - UASInterface *m_uas; -private slots: - void armButtonClicked(); - void armingChanged(bool state); - void currentWaypointChanged(quint16 wpid); - void updateWaypointList(); - void activeUASSet(UASInterface *uas); - void goToWaypointClicked(); - void changeAltitudeClicked(); - void changeSpeedClicked(); -}; - -#endif // UASACTIONSWIDGET_H diff --git a/src/ui/uas/UASActionsWidget.ui b/src/ui/uas/UASActionsWidget.ui deleted file mode 100644 index ae22a05da05a86afd42db9e0b6c4134650a6cea6..0000000000000000000000000000000000000000 --- a/src/ui/uas/UASActionsWidget.ui +++ /dev/null @@ -1,154 +0,0 @@ - - - UASActionsWidget - - - - 0 - 0 - 321 - 363 - - - - Form - - - - 6 - - - - - Mission Controls - - - - 6 - - - 6 - - - - - - - - Current: - - - - - - - Go To Waypoint - - - - - - - Restart Mission - - - - - - - - - - - - Change Altitude - - - - - - - - - - - - - - Change Speed - - - - - - - - - - - - Auto Actions - - - - 6 - - - 6 - - - - - - - - - - - Execute Action - - - - - - - Set Mode - - - - - - - Auto - - - - - - - Manual - - - - - - - RTL - - - - - - - ARM - - - - - - - - - - - diff --git a/src/ui/uas/UASControlParameters.cpp b/src/ui/uas/UASControlParameters.cpp deleted file mode 100644 index 2f5c61d23f80676ef53fe6d5134eb4214d89371b..0000000000000000000000000000000000000000 --- a/src/ui/uas/UASControlParameters.cpp +++ /dev/null @@ -1,134 +0,0 @@ -#include "UASControlParameters.h" -#include "ui_UASControlParameters.h" - -#define CONTROL_MODE_LOCKED "MODE LOCKED" -#define CONTROL_MODE_MANUAL "MODE MANUAL" - -#define CONTROL_MODE_READY "MODE TEST3" -#define CONTROL_MODE_RC_TRAINING "RC SIMULATION" - -#define CONTROL_MODE_LOCKED_INDEX 1 -#define CONTROL_MODE_MANUAL_INDEX 2 -#define CONTROL_MODE_GUIDED_INDEX 3 -#define CONTROL_MODE_AUTO_INDEX 4 -#define CONTROL_MODE_TEST1_INDEX 5 -#define CONTROL_MODE_TEST2_INDEX 6 -#define CONTROL_MODE_TEST3_INDEX 7 -#define CONTROL_MODE_READY_INDEX 8 -#define CONTROL_MODE_RC_TRAINING_INDEX 9 - -UASControlParameters::UASControlParameters(QWidget *parent) : - QWidget(parent), - ui(new Ui::UASControlParameters) -{ - ui->setupUi(this); - - ui->btSetCtrl->setStatusTip(tr("Set Passthrough")); - - connect(ui->btGetCommands, SIGNAL(clicked()), this, SLOT(getCommands())); - - connect(ui->btSetCtrl, SIGNAL(clicked()), this, SLOT(setPassthrough())); -} - -UASControlParameters::~UASControlParameters() -{ - delete ui; -} - -void UASControlParameters::changedMode(int mode) -{ - QString modeTemp; - - switch (mode) { - case (uint8_t)MAV_MODE_PREFLIGHT: - modeTemp = "LOCKED MODE"; - break; - case (uint8_t)MAV_MODE_MANUAL_ARMED: - modeTemp = "A/MANUAL MODE"; - break; - case (uint8_t)MAV_MODE_MANUAL_DISARMED: - modeTemp = "D/MANUAL MODE"; - break; - default: - modeTemp = "UNKNOWN MODE"; - break; - } - - - if(modeTemp != this->mode) { - ui->lbMode->setStyleSheet("background-color: rgb(165, 42, 42)"); - } else { - ui->lbMode->setStyleSheet("background-color: rgb(85, 107, 47)"); - } -} - -void UASControlParameters::activeUasSet(UASInterface *uas) -{ - if(uas) { - connect(uas, SIGNAL(globalPositionChanged(UASInterface*,double,double,double,double,quint64)), this, SLOT(updateGlobalPosition(UASInterface*,double,double,double,double,quint64))); - connect(uas, SIGNAL(velocityChanged_NED(UASInterface*,double,double,double,quint64)), this, SLOT(speedChanged(UASInterface*,double,double,double,quint64))); - connect(uas, SIGNAL(attitudeChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateAttitude(UASInterface*,double,double,double,quint64))); - connect(uas, SIGNAL(modeChanged(int,QString,QString)), this, SLOT(updateMode(int,QString,QString))); - connect(uas, SIGNAL(thrustChanged(UASInterface*,double)), this, SLOT(thrustChanged(UASInterface*,double)) ); - - activeUAS= uas; - } -} - -void UASControlParameters::updateGlobalPosition(UASInterface * a, double b, double c, double aa, quint64 ab) -{ - Q_UNUSED(a); - Q_UNUSED(b); - Q_UNUSED(c); - Q_UNUSED(ab); - this->altitude=aa; -} - -void UASControlParameters::speedChanged(UASInterface* uas, double vx, double vy, double vz, quint64 time) -{ - Q_UNUSED(time); - Q_UNUSED(uas); - this->speed = sqrt(pow(vx, 2.0) + pow(vy, 2.0) + pow(vz, 2.0)); - //ui->sbAirSpeed->setValue(speed); -} - -void UASControlParameters::updateAttitude(UASInterface *uas, double roll, double pitch, double yaw, quint64 time) -{ - Q_UNUSED(uas); - Q_UNUSED(pitch); - Q_UNUSED(yaw); - Q_UNUSED(time); - //ui->sbTurnRate->setValue(roll); - this->roll = roll; -} - -void UASControlParameters::setCommands() -{ -} - -void UASControlParameters::getCommands() -{ - ui->sbAirSpeed->setValue(this->speed); - ui->sbHeight->setValue(this->altitude); - ui->sbTurnRate->setValue(this->roll); -} - -void UASControlParameters::setPassthrough() -{ -} - -void UASControlParameters::updateMode(int uas,QString mode,QString description) -{ - Q_UNUSED(uas); - Q_UNUSED(description); - this->mode = mode; - ui->lbMode->setText(this->mode); - - ui->lbMode->setStyleSheet("background-color: rgb(85, 107, 47)"); -} - -void UASControlParameters::thrustChanged(UASInterface *uas, double throttle) -{ - Q_UNUSED(uas); - this->throttle= throttle; -} diff --git a/src/ui/uas/UASControlParameters.h b/src/ui/uas/UASControlParameters.h deleted file mode 100644 index 4cd221809b196cdb0fbfc930a3c0bbb207907602..0000000000000000000000000000000000000000 --- a/src/ui/uas/UASControlParameters.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef UASCONTROLPARAMETERS_H -#define UASCONTROLPARAMETERS_H - -#include -#include "UASManager.h" -#include -#include - -namespace Ui -{ -class UASControlParameters; -} - -class UASControlParameters : public QWidget -{ - Q_OBJECT - -public: - explicit UASControlParameters(QWidget *parent = 0); - ~UASControlParameters(); - -public slots: - void changedMode(int mode); - void activeUasSet(UASInterface* uas); - void updateGlobalPosition(UASInterface*,double,double,double,quint64); - void speedChanged(UASInterface*,double,double,double,quint64); - void updateAttitude(UASInterface* uas, double roll, double pitch, double yaw, quint64 time); - void setCommands(); - void getCommands(); - - void setPassthrough(); - void updateMode(int uas,QString mode,QString description); - void thrustChanged(UASInterface* uas,double throttle); - -private: - Ui::UASControlParameters *ui; - QTimer* refreshTimerGet; - UASInterface* activeUAS; - double speed; - double roll; - double altitude; - double throttle; - QString mode; - QString REDcolorStyle; - QPointer radio; - LinkInterface* hilLink; -}; - -#endif // UASCONTROLPARAMETERS_H