From 9653a62ee5deb518d631ede1f78da4558db4e420 Mon Sep 17 00:00:00 2001 From: pixhawk Date: Wed, 21 Dec 2011 10:41:41 +0100 Subject: [PATCH 1/8] Changed labels --- src/ui/MainWindow.cc | 6 ++--- src/ui/WaypointList.ui | 72 ++++++++++++++++++++++++-------------------------- 2 files changed, 37 insertions(+), 41 deletions(-) diff --git a/src/ui/MainWindow.cc b/src/ui/MainWindow.cc index bfda0a0..d434ae3 100644 --- a/src/ui/MainWindow.cc +++ b/src/ui/MainWindow.cc @@ -1131,8 +1131,8 @@ void MainWindow::UASCreated(UASInterface* uas) // Connect the UAS to the full user interface - if (uas != NULL) - { + //if (uas != NULL) + //{ // The pilot, operator and engineer views were not available on startup, enable them now ui.actionPilotsView->setEnabled(true); ui.actionOperatorsView->setEnabled(true); @@ -1276,7 +1276,7 @@ void MainWindow::UASCreated(UASInterface* uas) } } - } + //} if (!ui.menuConnected_Systems->isEnabled()) ui.menuConnected_Systems->setEnabled(true); diff --git a/src/ui/WaypointList.ui b/src/ui/WaypointList.ui index a3cacae..b284df9 100644 --- a/src/ui/WaypointList.ui +++ b/src/ui/WaypointList.ui @@ -38,7 +38,7 @@ - 0 + 1 @@ -275,21 +275,6 @@ Onboard Waypoints - - 6 - - - 0 - - - 6 - - - 6 - - - 6 - @@ -300,37 +285,55 @@ 0 0 - 836 - 316 + 830 + 304 true - - - 4 - - - 8 - - - 4 - - - 4 - + true + + + 828 + 16777215 + + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> +<p align="center" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p> +<p align="center" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p> +<p align="center" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p> +<p align="center" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p> +<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:36pt;">MAV ##</span></p></body></html> + + + + + + + + + + + @@ -364,13 +367,6 @@ - - - - - - - From a02f9e652d7987df097a7ec218c87584b5330ebb Mon Sep 17 00:00:00 2001 From: pixhawk Date: Mon, 9 Jan 2012 14:33:34 +0100 Subject: [PATCH 2/8] Added a popup warning about using the offline mission editor --- src/ui/PopupMessage.cpp | 0 src/ui/WaypointList.cc | 8 ++++++++ src/ui/WaypointList.h | 1 + src/ui/WaypointList.ui | 36 ++---------------------------------- 4 files changed, 11 insertions(+), 34 deletions(-) create mode 100644 src/ui/PopupMessage.cpp diff --git a/src/ui/PopupMessage.cpp b/src/ui/PopupMessage.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/ui/WaypointList.cc b/src/ui/WaypointList.cc index 09db4ec..4565753 100644 --- a/src/ui/WaypointList.cc +++ b/src/ui/WaypointList.cc @@ -239,6 +239,14 @@ void WaypointList::addEditable() updateStatusLabel(tr("No UAV. Added default LOCAL (NED) waypoint")); wp = new Waypoint(0, 0, 0, -0.50, 0, 0.20, 0, 0,true, true, MAV_FRAME_LOCAL_NED, MAV_CMD_NAV_WAYPOINT); WPM->addWaypointEditable(wp); + //create a popup notifying the user about the limitations of offline editing + QMessageBox msgBox; + msgBox.setIcon(QMessageBox::Warning); + msgBox.setText("Offline editor!"); + msgBox.setInformativeText("You are using the offline mission editor. Please don't forget to save your mission plan before connecting the UAV, otherwise it will be lost."); + msgBox.setStandardButtons(QMessageBox::Ok); + msgBox.setDefaultButton(QMessageBox::Ok); + int ret = msgBox.exec(); } } diff --git a/src/ui/WaypointList.h b/src/ui/WaypointList.h index d773fa7..5c4a890 100644 --- a/src/ui/WaypointList.h +++ b/src/ui/WaypointList.h @@ -43,6 +43,7 @@ This file is part of the QGROUNDCONTROL project #include "WaypointEditableView.h" #include "WaypointViewOnlyView.h" #include "UnconnectedUASInfoWidget.h" +//#include "PopupMessage.h" namespace Ui diff --git a/src/ui/WaypointList.ui b/src/ui/WaypointList.ui index b284df9..04b69df 100644 --- a/src/ui/WaypointList.ui +++ b/src/ui/WaypointList.ui @@ -38,7 +38,7 @@ - 1 + 0 @@ -74,22 +74,7 @@ 316 - - - 0 - - - 4 - - - 8 - - - 4 - - - 4 - + @@ -304,23 +289,6 @@ 16777215 - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> -<p align="center" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p> -<p align="center" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p> -<p align="center" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p> -<p align="center" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p> -<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:36pt;">MAV ##</span></p></body></html> - - - - From abd33d09c8e942aeeede2ce707e419bc0c567a3f Mon Sep 17 00:00:00 2001 From: pixhawk Date: Mon, 9 Jan 2012 14:34:46 +0100 Subject: [PATCH 3/8] small cleanup --- src/ui/PopupMessage.cpp | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 src/ui/PopupMessage.cpp diff --git a/src/ui/PopupMessage.cpp b/src/ui/PopupMessage.cpp deleted file mode 100644 index e69de29..0000000 From 63a40d01b270f5c7e6ae6346daca980c909b53e3 Mon Sep 17 00:00:00 2001 From: pixhawk Date: Mon, 9 Jan 2012 14:52:28 +0100 Subject: [PATCH 4/8] Fixed a bug in moving mission elements up/down, that used to crash the QGC --- src/uas/UASWaypointManager.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/uas/UASWaypointManager.cc b/src/uas/UASWaypointManager.cc index e37bd25..44c86f6 100644 --- a/src/uas/UASWaypointManager.cc +++ b/src/uas/UASWaypointManager.cc @@ -426,6 +426,7 @@ void UASWaypointManager::moveWaypoint(quint16 cur_seq, quint16 new_seq) for (int i = cur_seq; i < new_seq; i++) { waypointsEditable[i] = waypointsEditable[i+1]; + waypointsEditable[i]->setId(i); } } else @@ -433,9 +434,11 @@ void UASWaypointManager::moveWaypoint(quint16 cur_seq, quint16 new_seq) for (int i = cur_seq; i > new_seq; i--) { waypointsEditable[i] = waypointsEditable[i-1]; + waypointsEditable[i]->setId(i); } } waypointsEditable[new_seq] = t; + waypointsEditable[new_seq]->setId(new_seq); emit waypointEditableListChanged(); emit waypointEditableListChanged(uasid); From 746fa1806c3a526d6726b91334819171b57a1d23 Mon Sep 17 00:00:00 2001 From: pixhawk Date: Mon, 9 Jan 2012 15:09:46 +0100 Subject: [PATCH 5/8] Improved the offline missionplan warning --- src/ui/WaypointList.cc | 44 ++++++++++++++++++++++++++++++-------------- src/ui/WaypointList.h | 1 + 2 files changed, 31 insertions(+), 14 deletions(-) diff --git a/src/ui/WaypointList.cc b/src/ui/WaypointList.cc index 4565753..0133a8b 100644 --- a/src/ui/WaypointList.cc +++ b/src/ui/WaypointList.cc @@ -47,6 +47,7 @@ WaypointList::WaypointList(QWidget *parent, UASInterface* uas) : mavY(0.0), mavZ(0.0), mavYaw(0.0), + showOfflineWarning(false), m_ui(new Ui::WaypointList) { @@ -104,15 +105,16 @@ WaypointList::WaypointList(QWidget *parent, UASInterface* uas) : } else { - qDebug() << "setUAS failed" ; + qDebug() << "setUAS failed. Creating an offline WaypointList"; // Hide buttons, which don't make sense without valid UAS m_ui->positionAddButton->hide(); m_ui->transmitButton->hide(); m_ui->readButton->hide(); - //FIXME: The whole "Onboard Waypoints"-tab should be hidden, instead of "refresh" button m_ui->refreshButton->hide(); + //FIXME: The whole "Onboard Waypoints"-tab should be hidden, instead of "refresh" button UnconnectedUASInfoWidget* inf = new UnconnectedUASInfoWidget(this); - viewOnlyListLayout->insertWidget(0, inf); + viewOnlyListLayout->insertWidget(0, inf); //insert a "NO UAV" info into the Onboard Tab + showOfflineWarning = true; WPM = new UASWaypointManager(NULL); } @@ -183,10 +185,20 @@ void WaypointList::saveWaypoints() void WaypointList::loadWaypoints() { - - QString fileName = QFileDialog::getOpenFileName(this, tr("Load File"), ".", tr("Waypoint File (*.txt)")); - WPM->loadWaypoints(fileName); - + //create a popup notifying the user about the limitations of offline editing + if (showOfflineWarning == true) + { + QMessageBox msgBox; + msgBox.setIcon(QMessageBox::Warning); + msgBox.setText("Offline editor!"); + msgBox.setInformativeText("You are using the offline mission editor. Please don't forget to save your mission plan before connecting the UAV, otherwise it will be lost."); + msgBox.setStandardButtons(QMessageBox::Ok); + msgBox.setDefaultButton(QMessageBox::Ok); + int ret = msgBox.exec(); + showOfflineWarning = false; + } + QString fileName = QFileDialog::getOpenFileName(this, tr("Load File"), ".", tr("Waypoint File (*.txt)")); + WPM->loadWaypoints(fileName); } void WaypointList::transmit() @@ -240,13 +252,17 @@ void WaypointList::addEditable() wp = new Waypoint(0, 0, 0, -0.50, 0, 0.20, 0, 0,true, true, MAV_FRAME_LOCAL_NED, MAV_CMD_NAV_WAYPOINT); WPM->addWaypointEditable(wp); //create a popup notifying the user about the limitations of offline editing - QMessageBox msgBox; - msgBox.setIcon(QMessageBox::Warning); - msgBox.setText("Offline editor!"); - msgBox.setInformativeText("You are using the offline mission editor. Please don't forget to save your mission plan before connecting the UAV, otherwise it will be lost."); - msgBox.setStandardButtons(QMessageBox::Ok); - msgBox.setDefaultButton(QMessageBox::Ok); - int ret = msgBox.exec(); + if (showOfflineWarning == true) + { + QMessageBox msgBox; + msgBox.setIcon(QMessageBox::Warning); + msgBox.setText("Offline editor!"); + msgBox.setInformativeText("You are using the offline mission editor. Please don't forget to save your mission plan before connecting the UAV, otherwise it will be lost."); + msgBox.setStandardButtons(QMessageBox::Ok); + msgBox.setDefaultButton(QMessageBox::Ok); + int ret = msgBox.exec(); + showOfflineWarning = false; + } } } diff --git a/src/ui/WaypointList.h b/src/ui/WaypointList.h index 5c4a890..01f6a71 100644 --- a/src/ui/WaypointList.h +++ b/src/ui/WaypointList.h @@ -141,6 +141,7 @@ protected: QPointF centerMapCoordinate; bool loadFileGlobalWP; bool readGlobalWP; + bool showOfflineWarning; private: Ui::WaypointList *m_ui; From cf178232679ca851eb84338a6190f704c5f6c73a Mon Sep 17 00:00:00 2001 From: pixhawk Date: Mon, 9 Jan 2012 16:57:11 +0100 Subject: [PATCH 6/8] Fixed some bugs that allowed to have multiple or no "current" mission elements in Edit list --- src/uas/UASWaypointManager.cc | 13 +++++++++++++ src/ui/WaypointList.cc | 4 ++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/uas/UASWaypointManager.cc b/src/uas/UASWaypointManager.cc index 44c86f6..3e78f4f 100644 --- a/src/uas/UASWaypointManager.cc +++ b/src/uas/UASWaypointManager.cc @@ -401,6 +401,19 @@ int UASWaypointManager::removeWaypoint(quint16 seq) if (seq < waypointsEditable.size()) { Waypoint *t = waypointsEditable[seq]; + + if (t->getCurrent() == true) //trying to remove the current waypoint + { + if (seq+1 < waypointsEditable.size()) // setting the next waypoint as current + { + waypointsEditable[seq+1]->setCurrent(true); + } + else if (seq-1 >= 0) //if deleting the last on the list, then setting the previous waypoint as current + { + waypointsEditable[seq-1]->setCurrent(true); + } + } + waypointsEditable.remove(seq); delete t; t = NULL; diff --git a/src/ui/WaypointList.cc b/src/ui/WaypointList.cc index 0133a8b..fa49cea 100644 --- a/src/ui/WaypointList.cc +++ b/src/ui/WaypointList.cc @@ -293,7 +293,7 @@ void WaypointList::addCurrentPositionWaypoint() yawGlobal = last->getYaw(); } // Create global frame waypoint per default - wp = new Waypoint(0, uas->getLatitude(), uas->getLongitude(), uas->getAltitude(), 0, acceptanceRadiusGlobal, holdTime, yawGlobal, true, true, MAV_FRAME_GLOBAL_RELATIVE_ALT, MAV_CMD_NAV_WAYPOINT); + wp = new Waypoint(0, uas->getLatitude(), uas->getLongitude(), uas->getAltitude(), 0, acceptanceRadiusGlobal, holdTime, yawGlobal, true, false, MAV_FRAME_GLOBAL_RELATIVE_ALT, MAV_CMD_NAV_WAYPOINT); WPM->addWaypointEditable(wp); updateStatusLabel(tr("Added GLOBAL, ALTITUDE OVER GROUND waypoint")); } @@ -307,7 +307,7 @@ void WaypointList::addCurrentPositionWaypoint() holdTime = last->getHoldTime(); } // Create local frame waypoint as second option - wp = new Waypoint(0, uas->getLocalX(), uas->getLocalY(), uas->getLocalZ(), uas->getYaw(), acceptanceRadiusLocal, holdTime, 0.0, true, true, MAV_FRAME_LOCAL_NED, MAV_CMD_NAV_WAYPOINT); + wp = new Waypoint(0, uas->getLocalX(), uas->getLocalY(), uas->getLocalZ(), uas->getYaw(), acceptanceRadiusLocal, holdTime, 0.0, true, false, MAV_FRAME_LOCAL_NED, MAV_CMD_NAV_WAYPOINT); WPM->addWaypointEditable(wp); updateStatusLabel(tr("Added LOCAL (NED) waypoint")); } From f724ddbeec6fd29838b7ef5792d6746a9e201ed3 Mon Sep 17 00:00:00 2001 From: pixhawk Date: Mon, 9 Jan 2012 19:19:21 +0100 Subject: [PATCH 7/8] Improved the visuals of the "Onboard Waypoints"-tab contents. Not yet complete. --- src/ui/WaypointList.ui | 18 +++++-- src/ui/WaypointViewOnlyView.ui | 120 ++++++++++++++++++++++++++--------------- 2 files changed, 91 insertions(+), 47 deletions(-) diff --git a/src/ui/WaypointList.ui b/src/ui/WaypointList.ui index 04b69df..2773693 100644 --- a/src/ui/WaypointList.ui +++ b/src/ui/WaypointList.ui @@ -260,6 +260,18 @@ Onboard Waypoints + + 6 + + + 0 + + + 6 + + + 6 + @@ -270,8 +282,8 @@ 0 0 - 830 - 304 + 836 + 316 @@ -285,7 +297,7 @@ - 828 + 16777215 16777215 diff --git a/src/ui/WaypointViewOnlyView.ui b/src/ui/WaypointViewOnlyView.ui index eb35191..aefdf75 100644 --- a/src/ui/WaypointViewOnlyView.ui +++ b/src/ui/WaypointViewOnlyView.ui @@ -6,43 +6,63 @@ 0 0 - 381 - 40 + 704 + 31 - + 0 0 + + + 200 + 31 + + Form - + QGroupBox { + border: 1px solid #EEEEEE; + border-radius: 5px; + padding: 0px 0px 0px 0px; +margin-top: 1ex; /* leave space at the top for the title */ + margin: 0px; +} + + QGroupBox::title { + subcontrol-origin: margin; + subcontrol-position: top center; /* position at the top center */ + margin: 0 3px 0px 3px; + padding: 0 3px 0px 0px; + font: bold 8px; + } - - - 0 - - - 2 - - + + 0 - - 2 - - + 0 - + true + + + 0 + 0 + + + + + @@ -55,24 +75,21 @@ false - + - 6 - - 2 - - 0 - - - 2 - - - 0 + + 4 + + + 0 + 0 + + Currently executed waypoint @@ -92,34 +109,49 @@ - + - + 0 0 - - - 16777215 - 31 - + + test 1 - - - 8 - + + + + + + Qt::Horizontal - - QFrame::NoFrame + + QSizePolicy::Expanding - - QFrame::Sunken + + + 79 + 17 + + + + + + + + v10 + + + 0 + 0 + + Automatically continue after this waypoint From e89983da70770f3c5efd2ffc9a1e900baa2620b5 Mon Sep 17 00:00:00 2001 From: pixhawk Date: Tue, 10 Jan 2012 18:33:52 +0100 Subject: [PATCH 8/8] Fixed some display bugs in editable waypoints --- src/ui/WaypointEditableView.cc | 59 +++++++++++++++++++++++++++--------------- 1 file changed, 38 insertions(+), 21 deletions(-) diff --git a/src/ui/WaypointEditableView.cc b/src/ui/WaypointEditableView.cc index 090ed35..ce47317 100644 --- a/src/ui/WaypointEditableView.cc +++ b/src/ui/WaypointEditableView.cc @@ -234,6 +234,7 @@ void WaypointEditableView::updateActionView(int action) */ void WaypointEditableView::changedAction(int index) { + MAV_FRAME cur_frame = (MAV_FRAME) m_ui->comboBox_frame->itemData(m_ui->comboBox_frame->currentIndex()).toUInt(); // set waypoint action int actionIndex = m_ui->comboBox_action->itemData(index).toUInt(); if (actionIndex < MAV_CMD_ENUM_END && actionIndex >= 0) { @@ -254,8 +255,8 @@ void WaypointEditableView::changedAction(int index) case MAV_CMD_NAV_LOITER_TURNS: case MAV_CMD_NAV_LOITER_TIME: changeViewMode(QGC_WAYPOINTEDITABLEVIEW_MODE_NAV); - // Update frame view - updateFrameView(m_ui->comboBox_frame->currentIndex()); + // Update frame view + updateFrameView(cur_frame); // Update view updateActionView(actionIndex); break; @@ -310,29 +311,45 @@ void WaypointEditableView::changeViewMode(QGC_WAYPOINTEDITABLEVIEW_MODE mode) void WaypointEditableView::updateFrameView(int frame) { + std::cerr << "update frame view: "<< frame << std::endl; + //int custom_index = m_ui->comboBox_action->findData(MAV_CMD_ENUM_END); switch(frame) { case MAV_FRAME_GLOBAL: case MAV_FRAME_GLOBAL_RELATIVE_ALT: - m_ui->posNSpinBox->hide(); - m_ui->posESpinBox->hide(); - m_ui->posDSpinBox->hide(); - m_ui->lonSpinBox->show(); - m_ui->latSpinBox->show(); - m_ui->altSpinBox->show(); - // Coordinate frame - m_ui->comboBox_frame->show(); - m_ui->customActionWidget->hide(); + if (viewMode != QGC_WAYPOINTEDITABLEVIEW_MODE_DIRECT_EDITING) + { + m_ui->posNSpinBox->hide(); + m_ui->posESpinBox->hide(); + m_ui->posDSpinBox->hide(); + m_ui->lonSpinBox->show(); + m_ui->latSpinBox->show(); + m_ui->altSpinBox->show(); + // Coordinate frame + m_ui->comboBox_frame->show(); + m_ui->customActionWidget->hide(); + } + else // do not hide customActionWidget if Command is set to "Other" + { + m_ui->customActionWidget->show(); + } break; case MAV_FRAME_LOCAL_NED: - m_ui->lonSpinBox->hide(); - m_ui->latSpinBox->hide(); - m_ui->altSpinBox->hide(); - m_ui->posNSpinBox->show(); - m_ui->posESpinBox->show(); - m_ui->posDSpinBox->show(); - // Coordinate frame - m_ui->comboBox_frame->show(); - m_ui->customActionWidget->hide(); + if (viewMode != QGC_WAYPOINTEDITABLEVIEW_MODE_DIRECT_EDITING) + { + m_ui->lonSpinBox->hide(); + m_ui->latSpinBox->hide(); + m_ui->altSpinBox->hide(); + m_ui->posNSpinBox->show(); + m_ui->posESpinBox->show(); + m_ui->posDSpinBox->show(); + // Coordinate frame + m_ui->comboBox_frame->show(); + m_ui->customActionWidget->hide(); + } + else // do not hide customActionWidget if Command is set to "Other" + { + m_ui->customActionWidget->show(); + } break; default: std::cerr << "unknown frame" << std::endl; @@ -526,7 +543,7 @@ void WaypointEditableView::updateValues() { // Action ID known, update m_ui->comboBox_action->setCurrentIndex(action_index); - updateActionView(action); + updateActionView(action); } } }