Commit a8417079 authored by LM's avatar LM

Merge branch 'v10release' of github.com:pixhawk/qgroundcontrol into v10release

parents e0bd2a74 c0691261
...@@ -172,8 +172,7 @@ FORMS += src/ui/MainWindow.ui \ ...@@ -172,8 +172,7 @@ FORMS += src/ui/MainWindow.ui \
src/ui/Linechart.ui \ src/ui/Linechart.ui \
src/ui/UASView.ui \ src/ui/UASView.ui \
src/ui/ParameterInterface.ui \ src/ui/ParameterInterface.ui \
src/ui/WaypointList.ui \ src/ui/WaypointList.ui \
src/ui/WaypointView.ui \
src/ui/ObjectDetectionView.ui \ src/ui/ObjectDetectionView.ui \
src/ui/JoystickWidget.ui \ src/ui/JoystickWidget.ui \
src/ui/DebugConsole.ui \ src/ui/DebugConsole.ui \
...@@ -209,7 +208,9 @@ FORMS += src/ui/MainWindow.ui \ ...@@ -209,7 +208,9 @@ FORMS += src/ui/MainWindow.ui \
src/ui/mission/QGCMissionConditionWidget.ui \ src/ui/mission/QGCMissionConditionWidget.ui \
src/ui/map/QGCMapTool.ui \ src/ui/map/QGCMapTool.ui \
src/ui/map/QGCMapToolBar.ui \ src/ui/map/QGCMapToolBar.ui \
src/ui/QGCMAVLinkInspector.ui src/ui/QGCMAVLinkInspector.ui \
src/ui/WaypointViewOnlyView.ui \
src/ui/WaypointEditableView.ui
INCLUDEPATH += src \ INCLUDEPATH += src \
src/ui \ src/ui \
src/ui/linechart \ src/ui/linechart \
...@@ -255,8 +256,7 @@ HEADERS += src/MG.h \ ...@@ -255,8 +256,7 @@ HEADERS += src/MG.h \
src/comm/UDPLink.h \ src/comm/UDPLink.h \
src/ui/ParameterInterface.h \ src/ui/ParameterInterface.h \
src/ui/WaypointList.h \ src/ui/WaypointList.h \
src/Waypoint.h \ src/Waypoint.h \
src/ui/WaypointView.h \
src/ui/ObjectDetectionView.h \ src/ui/ObjectDetectionView.h \
src/input/JoystickInput.h \ src/input/JoystickInput.h \
src/ui/JoystickWidget.h \ src/ui/JoystickWidget.h \
...@@ -322,7 +322,10 @@ HEADERS += src/MG.h \ ...@@ -322,7 +322,10 @@ HEADERS += src/MG.h \
src/QGCGeo.h \ src/QGCGeo.h \
src/ui/QGCToolBar.h \ src/ui/QGCToolBar.h \
src/ui/QGCMAVLinkInspector.h \ src/ui/QGCMAVLinkInspector.h \
src/ui/MAVLinkDecoder.h src/ui/MAVLinkDecoder.h \
src/ui/WaypointViewOnlyView.h \
src/ui/WaypointViewOnlyView.h \
src/ui/WaypointEditableView.h
# Google Earth is only supported on Mac OS and Windows with Visual Studio Compiler # Google Earth is only supported on Mac OS and Windows with Visual Studio Compiler
macx|win32-msvc2008|win32-msvc2010::HEADERS += src/ui/map3D/QGCGoogleEarthView.h macx|win32-msvc2008|win32-msvc2010::HEADERS += src/ui/map3D/QGCGoogleEarthView.h
...@@ -384,7 +387,6 @@ SOURCES += src/main.cc \ ...@@ -384,7 +387,6 @@ SOURCES += src/main.cc \
src/ui/ParameterInterface.cc \ src/ui/ParameterInterface.cc \
src/ui/WaypointList.cc \ src/ui/WaypointList.cc \
src/Waypoint.cc \ src/Waypoint.cc \
src/ui/WaypointView.cc \
src/ui/ObjectDetectionView.cc \ src/ui/ObjectDetectionView.cc \
src/input/JoystickInput.cc \ src/input/JoystickInput.cc \
src/ui/JoystickWidget.cc \ src/ui/JoystickWidget.cc \
...@@ -447,7 +449,9 @@ SOURCES += src/main.cc \ ...@@ -447,7 +449,9 @@ SOURCES += src/main.cc \
src/ui/map/QGCMapToolBar.cc \ src/ui/map/QGCMapToolBar.cc \
src/ui/QGCToolBar.cc \ src/ui/QGCToolBar.cc \
src/ui/QGCMAVLinkInspector.cc \ src/ui/QGCMAVLinkInspector.cc \
src/ui/MAVLinkDecoder.cc src/ui/MAVLinkDecoder.cc \
src/ui/WaypointViewOnlyView.cc \
src/ui/WaypointEditableView.cc
# Enable Google Earth only on Mac OS and Windows with Visual Studio compiler # Enable Google Earth only on Mac OS and Windows with Visual Studio compiler
macx|win32-msvc2008|win32-msvc2010::SOURCES += src/ui/map3D/QGCGoogleEarthView.cc macx|win32-msvc2008|win32-msvc2010::SOURCES += src/ui/map3D/QGCGoogleEarthView.cc
......
...@@ -206,7 +206,7 @@ void Waypoint::setFrame(MAV_FRAME frame) ...@@ -206,7 +206,7 @@ void Waypoint::setFrame(MAV_FRAME frame)
void Waypoint::setAutocontinue(bool autoContinue) void Waypoint::setAutocontinue(bool autoContinue)
{ {
if (this->autocontinue != autocontinue) { if (this->autocontinue != autoContinue) {
this->autocontinue = autoContinue; this->autocontinue = autoContinue;
emit changed(this); emit changed(this);
} }
......
...@@ -28,59 +28,59 @@ ...@@ -28,59 +28,59 @@
#include "SerialLink.h" #include "SerialLink.h"
UAS::UAS(MAVLinkProtocol* protocol, int id) : UASInterface(), UAS::UAS(MAVLinkProtocol* protocol, int id) : UASInterface(),
uasId(id), uasId(id),
startTime(QGC::groundTimeMilliseconds()), startTime(QGC::groundTimeMilliseconds()),
commStatus(COMM_DISCONNECTED), commStatus(COMM_DISCONNECTED),
name(""), name(""),
autopilot(-1), autopilot(-1),
links(new QList<LinkInterface*>()), links(new QList<LinkInterface*>()),
unknownPackets(), unknownPackets(),
mavlink(protocol), mavlink(protocol),
waypointManager(*this), waypointManager(this),
thrustSum(0), thrustSum(0),
thrustMax(10), thrustMax(10),
startVoltage(0), startVoltage(0),
warnVoltage(9.5f), warnVoltage(9.5f),
warnLevelPercent(20.0f), warnLevelPercent(20.0f),
currentVoltage(12.0f), currentVoltage(12.0f),
lpVoltage(12.0f), lpVoltage(12.0f),
batteryRemainingEstimateEnabled(true), batteryRemainingEstimateEnabled(true),
mode(-1), mode(-1),
status(-1), status(-1),
navMode(-1), navMode(-1),
onboardTimeOffset(0), onboardTimeOffset(0),
controlRollManual(true), controlRollManual(true),
controlPitchManual(true), controlPitchManual(true),
controlYawManual(true), controlYawManual(true),
controlThrustManual(true), controlThrustManual(true),
manualRollAngle(0), manualRollAngle(0),
manualPitchAngle(0), manualPitchAngle(0),
manualYawAngle(0), manualYawAngle(0),
manualThrust(0), manualThrust(0),
receiveDropRate(0), receiveDropRate(0),
sendDropRate(0), sendDropRate(0),
lowBattAlarm(false), lowBattAlarm(false),
positionLock(false), positionLock(false),
localX(0.0), localX(0.0),
localY(0.0), localY(0.0),
localZ(0.0), localZ(0.0),
latitude(0.0), latitude(0.0),
longitude(0.0), longitude(0.0),
altitude(0.0), altitude(0.0),
roll(0.0), roll(0.0),
pitch(0.0), pitch(0.0),
yaw(0.0), yaw(0.0),
statusTimeout(new QTimer(this)), statusTimeout(new QTimer(this)),
paramsOnceRequested(false), paramsOnceRequested(false),
airframe(QGC_AIRFRAME_EASYSTAR), airframe(QGC_AIRFRAME_EASYSTAR),
attitudeKnown(false), attitudeKnown(false),
paramManager(NULL), paramManager(NULL),
attitudeStamped(false), attitudeStamped(false),
lastAttitude(0), lastAttitude(0),
simulation(new QGCFlightGearLink(this)), simulation(new QGCFlightGearLink(this)),
isLocalPositionKnown(false), isLocalPositionKnown(false),
isGlobalPositionKnown(false), isGlobalPositionKnown(false),
systemIsArmed(false) systemIsArmed(false)
{ {
color = UASInterface::getNextColor(); color = UASInterface::getNextColor();
setBatterySpecs(QString("9V,9.5V,12.6V")); setBatterySpecs(QString("9V,9.5V,12.6V"));
......
This diff is collapsed.
...@@ -64,7 +64,7 @@ private: ...@@ -64,7 +64,7 @@ private:
}; ///< The possible states for the waypoint protocol }; ///< The possible states for the waypoint protocol
public: public:
UASWaypointManager(UAS&); ///< Standard constructor. UASWaypointManager(UAS* uas=NULL); ///< Standard constructor
/** @name Received message handlers */ /** @name Received message handlers */
/*@{*/ /*@{*/
...@@ -79,15 +79,20 @@ public: ...@@ -79,15 +79,20 @@ public:
/** @name Remote operations */ /** @name Remote operations */
/*@{*/ /*@{*/
void clearWaypointList(); ///< Sends the waypoint clear all message to the MAV void clearWaypointList(); ///< Sends the waypoint clear all message to the MAV
void readWaypoints(); ///< Requests the MAV's current waypoint list
void readWaypoints(bool read_to_edit=false); ///< Requests the MAV's current waypoint list.
void writeWaypoints(); ///< Sends the waypoint list to the MAV void writeWaypoints(); ///< Sends the waypoint list to the MAV
int setCurrentWaypoint(quint16 seq); ///< Changes the current waypoint and sends the sequence number of the waypoint that should get the new target waypoint to the UAS int setCurrentWaypoint(quint16 seq); ///< Sends the sequence number of the waypoint that should get the new target waypoint to the UAS
int setCurrentEditable(quint16 seq); ///< Changes the current waypoint in edit tab
/*@}*/ /*@}*/
/** @name Waypoint list operations */ /** @name Waypoint list operations */
/*@{*/ /*@{*/
const QVector<Waypoint *> &getWaypointList(void) { const QVector<Waypoint *> &getWaypointEditableList(void) {
return waypoints; ///< Returns a const reference to the waypoint list. return waypointsEditable; ///< Returns a const reference to the waypoint list.
}
const QVector<Waypoint *> &getWaypointViewOnlyList(void) {
return waypointsViewOnly; ///< Returns a const reference to the waypoint list.
} }
const QVector<Waypoint *> getGlobalFrameWaypointList(); ///< Returns a global waypoint list const QVector<Waypoint *> getGlobalFrameWaypointList(); ///< Returns a global waypoint list
const QVector<Waypoint *> getGlobalFrameAndNavTypeWaypointList(); ///< Returns a global waypoint list containing only waypoints suitable for navigation. Actions and other mission items are filtered out. const QVector<Waypoint *> getGlobalFrameAndNavTypeWaypointList(); ///< Returns a global waypoint list containing only waypoints suitable for navigation. Actions and other mission items are filtered out.
...@@ -104,7 +109,7 @@ public: ...@@ -104,7 +109,7 @@ public:
int getLocalFrameCount(); ///< Get the count of local waypoints in the list int getLocalFrameCount(); ///< Get the count of local waypoints in the list
/*@}*/ /*@}*/
UAS& getUAS() { UAS* getUAS() {
return this->uas; ///< Returns the owning UAS return this->uas; ///< Returns the owning UAS
} }
...@@ -124,21 +129,26 @@ public slots: ...@@ -124,21 +129,26 @@ public slots:
void timeout(); ///< Called by the timer if a response times out. Handles send retries. void timeout(); ///< Called by the timer if a response times out. Handles send retries.
/** @name Waypoint list operations */ /** @name Waypoint list operations */
/*@{*/ /*@{*/
void addWaypoint(Waypoint *wp, bool enforceFirstActive=true); ///< adds a new waypoint to the end of the list and changes its sequence number accordingly void addWaypointEditable(Waypoint *wp, bool enforceFirstActive=true); ///< adds a new waypoint to the end of the editable list and changes its sequence number accordingly
void addWaypointViewOnly(Waypoint *wp); ///< adds a new waypoint to the end of the view-only list and changes its sequence number accordingly
Waypoint* createWaypoint(bool enforceFirstActive=true); ///< Creates a waypoint Waypoint* createWaypoint(bool enforceFirstActive=true); ///< Creates a waypoint
int removeWaypoint(quint16 seq); ///< locally remove the specified waypoint from the storage int removeWaypoint(quint16 seq); ///< locally remove the specified waypoint from the storage
void moveWaypoint(quint16 cur_seq, quint16 new_seq); ///< locally move a waypoint from its current position cur_seq to a new position new_seq void moveWaypoint(quint16 cur_seq, quint16 new_seq); ///< locally move a waypoint from its current position cur_seq to a new position new_seq
void saveWaypoints(const QString &saveFile); ///< saves the local waypoint list to saveFile void saveWaypoints(const QString &saveFile); ///< saves the local waypoint list to saveFile
void loadWaypoints(const QString &loadFile); ///< loads a waypoint list from loadFile void loadWaypoints(const QString &loadFile); ///< loads a waypoint list from loadFile
void notifyOfChange(Waypoint* wp); ///< Notifies manager to changes to a waypoint void notifyOfChangeEditable(Waypoint* wp); ///< Notifies manager to changes to an editable waypoint
void notifyOfChangeViewOnly(Waypoint* wp); ///< Notifies manager to changes to a viewonly waypoint, e.g. some widget wants to change "current"
/*@}*/ /*@}*/
void handleLocalPositionChanged(UASInterface* mav, double x, double y, double z, quint64 time); void handleLocalPositionChanged(UASInterface* mav, double x, double y, double z, quint64 time);
void handleGlobalPositionChanged(UASInterface* mav, double lat, double lon, double alt, quint64 time); void handleGlobalPositionChanged(UASInterface* mav, double lat, double lon, double alt, quint64 time);
signals: signals:
void waypointListChanged(void); ///< emits signal that the waypoint list has been changed void waypointEditableListChanged(void); ///< emits signal that the list of editable waypoints has been changed
void waypointListChanged(int uasid); ///< Emits signal that list has been changed void waypointEditableListChanged(int uasid); ///< emits signal that the list of editable waypoints has been changed
void waypointChanged(int uasid, Waypoint* wp); ///< emits signal that waypoint has been changed void waypointEditableChanged(int uasid, Waypoint* wp); ///< emits signal that a single editable waypoint has been changed
void waypointViewOnlyListChanged(void); ///< emits signal that the list of editable waypoints has been changed
void waypointViewOnlyListChanged(int uasid); ///< emits signal that the list of editable waypoints has been changed
void waypointViewOnlyChanged(int uasid, Waypoint* wp); ///< emits signal that a single editable waypoint has been changed
void currentWaypointChanged(quint16); ///< emits the new current waypoint sequence number void currentWaypointChanged(quint16); ///< emits the new current waypoint sequence number
void updateStatusString(const QString &); ///< emits the current status string void updateStatusString(const QString &); ///< emits the current status string
void waypointDistanceChanged(double distance); ///< Distance to next waypoint changed (in meters) void waypointDistanceChanged(double distance); ///< Distance to next waypoint changed (in meters)
...@@ -147,18 +157,22 @@ signals: ...@@ -147,18 +157,22 @@ signals:
void readGlobalWPFromUAS(bool value); ///< emits signal when finish to read Global WP from UAS void readGlobalWPFromUAS(bool value); ///< emits signal when finish to read Global WP from UAS
private: private:
UAS &uas; ///< Reference to the corresponding UAS UAS* uas; ///< Reference to the corresponding UAS
quint32 current_retries; ///< The current number of retries left quint32 current_retries; ///< The current number of retries left
quint16 current_wp_id; ///< The last used waypoint ID in the current protocol transaction quint16 current_wp_id; ///< The last used waypoint ID in the current protocol transaction
quint16 current_count; ///< The number of waypoints in the current protocol transaction quint16 current_count; ///< The number of waypoints in the current protocol transaction
WaypointState current_state; ///< The current protocol state WaypointState current_state; ///< The current protocol state
quint8 current_partner_systemid; ///< The current protocol communication target system quint8 current_partner_systemid; ///< The current protocol communication target system
quint8 current_partner_compid; ///< The current protocol communication target component quint8 current_partner_compid; ///< The current protocol communication target component
bool read_to_edit; ///< If true, after readWaypoints() incoming waypoints will be copied both to "edit"-tab and "view"-tab. Otherwise, only to "view"-tab.
QVector<Waypoint *> waypoints; ///< local waypoint list (main storage) QVector<Waypoint *> waypointsViewOnly; ///< local copy of current waypoint list on MAV
Waypoint* currentWaypoint; ///< The currently used waypoint QVector<Waypoint *> waypointsEditable; ///< local editable waypoint list
Waypoint* currentWaypointEditable; ///< The currently used waypoint
QVector<mavlink_mission_item_t *> waypoint_buffer; ///< buffer for waypoints during communication QVector<mavlink_mission_item_t *> waypoint_buffer; ///< buffer for waypoints during communication
QTimer protocol_timer; ///< Timer to catch timeouts QTimer protocol_timer; ///< Timer to catch timeouts
bool standalone; ///< If standalone is set, do not write to UAS
int uasid;
}; };
#endif // UASWAYPOINTMANAGER_H #endif // UASWAYPOINTMANAGER_H
...@@ -954,7 +954,7 @@ void HSIDisplay::drawWaypoints(QPainter& painter) ...@@ -954,7 +954,7 @@ void HSIDisplay::drawWaypoints(QPainter& painter)
{ {
if (uas) if (uas)
{ {
const QVector<Waypoint*>& list = uas->getWaypointManager()->getWaypointList(); const QVector<Waypoint*>& list = uas->getWaypointManager()->getWaypointEditableList();
QColor color; QColor color;
painter.setBrush(Qt::NoBrush); painter.setBrush(Qt::NoBrush);
......
...@@ -15,10 +15,12 @@ QGCWaypointListMulti::QGCWaypointListMulti(QWidget *parent) : ...@@ -15,10 +15,12 @@ QGCWaypointListMulti::QGCWaypointListMulti(QWidget *parent) :
void QGCWaypointListMulti::systemDeleted(QObject* uas) void QGCWaypointListMulti::systemDeleted(QObject* uas)
{ {
UASInterface* mav = dynamic_cast<UASInterface*>(uas); UASInterface* mav = dynamic_cast<UASInterface*>(uas);
if (mav) { if (mav)
{
int id = mav->getUASID(); int id = mav->getUASID();
WaypointList* list = lists.value(id, NULL); WaypointList* list = lists.value(id, NULL);
if (list) { if (list)
{
delete list; delete list;
lists.remove(id); lists.remove(id);
} }
......
...@@ -41,14 +41,13 @@ SerialConfigurationWindow::SerialConfigurationWindow(LinkInterface* link, QWidge ...@@ -41,14 +41,13 @@ SerialConfigurationWindow::SerialConfigurationWindow(LinkInterface* link, QWidge
{ {
SerialLinkInterface* serialLink = dynamic_cast<SerialLinkInterface*>(link); SerialLinkInterface* serialLink = dynamic_cast<SerialLinkInterface*>(link);
if(serialLink != 0) { if(serialLink != 0)
{
serialLink->loadSettings(); serialLink->loadSettings();
this->link = serialLink; this->link = serialLink;
// Setup the user interface according to link type // Setup the user interface according to link type
ui.setupUi(this); ui.setupUi(this);
//this->setVisible(false);
//this->hide();
// Create action to open this menu // Create action to open this menu
// Create configuration action for this link // Create configuration action for this link
...@@ -154,10 +153,10 @@ SerialConfigurationWindow::SerialConfigurationWindow(LinkInterface* link, QWidge ...@@ -154,10 +153,10 @@ SerialConfigurationWindow::SerialConfigurationWindow(LinkInterface* link, QWidge
// Display the widget // Display the widget
this->window()->setWindowTitle(tr("Serial Communication Settings")); this->window()->setWindowTitle(tr("Serial Communication Settings"));
//this->show(); }
} else { else
{
qDebug() << "Link is NOT a serial link, can't open configuration window"; qDebug() << "Link is NOT a serial link, can't open configuration window";
} }
} }
...@@ -220,9 +219,12 @@ void SerialConfigurationWindow::setupPortList() ...@@ -220,9 +219,12 @@ void SerialConfigurationWindow::setupPortList()
void SerialConfigurationWindow::enableFlowControl(bool flow) void SerialConfigurationWindow::enableFlowControl(bool flow)
{ {
if(flow) { if(flow)
{
link->setFlowType(1); link->setFlowType(1);
} else { }
else
{
link->setFlowType(0); link->setFlowType(0);
} }
} }
......
...@@ -17,15 +17,15 @@ ...@@ -17,15 +17,15 @@
#include <cmath> #include <cmath>
#include <qmath.h> #include <qmath.h>
#include "WaypointView.h" #include "WaypointEditableView.h"
#include "ui_WaypointView.h" #include "ui_WaypointEditableView.h"
#include "ui_QGCCustomWaypointAction.h" #include "ui_QGCCustomWaypointAction.h"
WaypointView::WaypointView(Waypoint* wp, QWidget* parent) : WaypointEditableView::WaypointEditableView(Waypoint* wp, QWidget* parent) :
QWidget(parent), QWidget(parent),
customCommand(new Ui_QGCCustomWaypointAction), customCommand(new Ui_QGCCustomWaypointAction),
viewMode(QGC_WAYPOINTVIEW_MODE_NAV), viewMode(QGC_WAYPOINTEDITABLEVIEW_MODE_NAV),
m_ui(new Ui::WaypointView) m_ui(new Ui::WaypointEditableView)
{ {
m_ui->setupUi(this); m_ui->setupUi(this);
...@@ -63,7 +63,8 @@ WaypointView::WaypointView(Waypoint* wp, QWidget* parent) : ...@@ -63,7 +63,8 @@ WaypointView::WaypointView(Waypoint* wp, QWidget* parent) :
updateValues(); updateValues();
// Check for mission frame // Check for mission frame
if (wp->getFrame() == MAV_FRAME_MISSION) { if (wp->getFrame() == MAV_FRAME_MISSION)
{
m_ui->comboBox_action->setCurrentIndex(m_ui->comboBox_action->count()-1); m_ui->comboBox_action->setCurrentIndex(m_ui->comboBox_action->count()-1);
} }
...@@ -102,24 +103,24 @@ WaypointView::WaypointView(Waypoint* wp, QWidget* parent) : ...@@ -102,24 +103,24 @@ WaypointView::WaypointView(Waypoint* wp, QWidget* parent) :
connect(customCommand->param7SpinBox, SIGNAL(valueChanged(double)), wp, SLOT(setParam7(double))); connect(customCommand->param7SpinBox, SIGNAL(valueChanged(double)), wp, SLOT(setParam7(double)));
} }
void WaypointView::moveUp() void WaypointEditableView::moveUp()
{ {
emit moveUpWaypoint(wp); emit moveUpWaypoint(wp);
} }
void WaypointView::moveDown() void WaypointEditableView::moveDown()
{ {
emit moveDownWaypoint(wp); emit moveDownWaypoint(wp);
} }
void WaypointView::remove() void WaypointEditableView::remove()
{ {
emit removeWaypoint(wp); emit removeWaypoint(wp);
deleteLater(); deleteLater();
} }
void WaypointView::changedAutoContinue(int state) void WaypointEditableView::changedAutoContinue(int state)
{ {
if (state == 0) if (state == 0)
wp->setAutocontinue(false); wp->setAutocontinue(false);
...@@ -127,7 +128,7 @@ void WaypointView::changedAutoContinue(int state) ...@@ -127,7 +128,7 @@ void WaypointView::changedAutoContinue(int state)
wp->setAutocontinue(true); wp->setAutocontinue(true);
} }
void WaypointView::updateActionView(int action) void WaypointEditableView::updateActionView(int action)
{ {
// Remove stretch item at index 17 (m_ui->removeSpacer) // Remove stretch item at index 17 (m_ui->removeSpacer)
m_ui->horizontalLayout->takeAt(17); m_ui->horizontalLayout->takeAt(17);
...@@ -231,7 +232,7 @@ void WaypointView::updateActionView(int action) ...@@ -231,7 +232,7 @@ void WaypointView::updateActionView(int action)
/** /**
* @param index The index of the combo box of the action entry, NOT the action ID * @param index The index of the combo box of the action entry, NOT the action ID
*/ */
void WaypointView::changedAction(int index) void WaypointEditableView::changedAction(int index)
{ {
// set waypoint action // set waypoint action
int actionIndex = m_ui->comboBox_action->itemData(index).toUInt(); int actionIndex = m_ui->comboBox_action->itemData(index).toUInt();
...@@ -252,7 +253,7 @@ void WaypointView::changedAction(int index) ...@@ -252,7 +253,7 @@ void WaypointView::changedAction(int index)
case MAV_CMD_NAV_LOITER_UNLIM: case MAV_CMD_NAV_LOITER_UNLIM:
case MAV_CMD_NAV_LOITER_TURNS: case MAV_CMD_NAV_LOITER_TURNS:
case MAV_CMD_NAV_LOITER_TIME: case MAV_CMD_NAV_LOITER_TIME:
changeViewMode(QGC_WAYPOINTVIEW_MODE_NAV); changeViewMode(QGC_WAYPOINTEDITABLEVIEW_MODE_NAV);
// Update frame view // Update frame view
updateFrameView(m_ui->comboBox_frame->currentIndex()); updateFrameView(m_ui->comboBox_frame->currentIndex());
// Update view // Update view
...@@ -261,23 +262,23 @@ void WaypointView::changedAction(int index) ...@@ -261,23 +262,23 @@ void WaypointView::changedAction(int index)
case MAV_CMD_ENUM_END: case MAV_CMD_ENUM_END:
default: default:
// Switch to mission frame // Switch to mission frame
changeViewMode(QGC_WAYPOINTVIEW_MODE_DIRECT_EDITING); changeViewMode(QGC_WAYPOINTEDITABLEVIEW_MODE_DIRECT_EDITING);
break; break;
} }
} }
void WaypointView::changeViewMode(QGC_WAYPOINTVIEW_MODE mode) void WaypointEditableView::changeViewMode(QGC_WAYPOINTEDITABLEVIEW_MODE mode)
{ {
viewMode = mode; viewMode = mode;
switch (mode) { switch (mode) {
case QGC_WAYPOINTVIEW_MODE_NAV: case QGC_WAYPOINTEDITABLEVIEW_MODE_NAV:
case QGC_WAYPOINTVIEW_MODE_CONDITION: case QGC_WAYPOINTEDITABLEVIEW_MODE_CONDITION:
// Hide everything, show condition widget // Hide everything, show condition widget
// TODO // TODO
case QGC_WAYPOINTVIEW_MODE_DO: case QGC_WAYPOINTEDITABLEVIEW_MODE_DO:
break; break;
case QGC_WAYPOINTVIEW_MODE_DIRECT_EDITING: case QGC_WAYPOINTEDITABLEVIEW_MODE_DIRECT_EDITING:
// Hide almost everything // Hide almost everything
m_ui->orbitSpinBox->hide(); m_ui->orbitSpinBox->hide();
m_ui->takeOffAngleSpinBox->hide(); m_ui->takeOffAngleSpinBox->hide();
...@@ -307,7 +308,7 @@ void WaypointView::changeViewMode(QGC_WAYPOINTVIEW_MODE mode) ...@@ -307,7 +308,7 @@ void WaypointView::changeViewMode(QGC_WAYPOINTVIEW_MODE mode)
} }
void WaypointView::updateFrameView(int frame) void WaypointEditableView::updateFrameView(int frame)
{ {
switch(frame) { switch(frame) {
case MAV_FRAME_GLOBAL: case MAV_FRAME_GLOBAL:
...@@ -338,7 +339,7 @@ void WaypointView::updateFrameView(int frame) ...@@ -338,7 +339,7 @@ void WaypointView::updateFrameView(int frame)
} }
} }
void WaypointView::deleted(QObject* waypoint) void WaypointEditableView::deleted(QObject* waypoint)
{ {
Q_UNUSED(waypoint); Q_UNUSED(waypoint);
// if (waypoint == this->wp) // if (waypoint == this->wp)
...@@ -347,7 +348,7 @@ void WaypointView::deleted(QObject* waypoint) ...@@ -347,7 +348,7 @@ void WaypointView::deleted(QObject* waypoint)
// } // }
} }
void WaypointView::changedFrame(int index) void WaypointEditableView::changedFrame(int index)
{ {
// set waypoint action // set waypoint action
MAV_FRAME frame = (MAV_FRAME)m_ui->comboBox_frame->itemData(index).toUInt(); MAV_FRAME frame = (MAV_FRAME)m_ui->comboBox_frame->itemData(index).toUInt();
...@@ -356,19 +357,35 @@ void WaypointView::changedFrame(int index) ...@@ -356,19 +357,35 @@ void WaypointView::changedFrame(int index)
updateFrameView(frame); updateFrameView(frame);
} }
void WaypointView::changedCurrent(int state) void WaypointEditableView::changedCurrent(int state)
{ {
if (state == 0) { //m_ui->selectedBox->blockSignals(true);
m_ui->selectedBox->setChecked(true); if (state == 0)
m_ui->selectedBox->setCheckState(Qt::Checked); {
wp->setCurrent(false); if (wp->getCurrent() == true) //User clicked on the waypoint, that is already current
} else { {
qDebug() << "Editable " << wp->getId() << " changedCurrent: State 0, current true" ;
m_ui->selectedBox->setChecked(true);
m_ui->selectedBox->setCheckState(Qt::Checked);
}
else
{
qDebug() << "Editable " << wp->getId() << " changedCurrent: State 0, current false";
m_ui->selectedBox->setChecked(false);
m_ui->selectedBox->setCheckState(Qt::Unchecked);
//wp->setCurrent(false);
}
}
else
{
qDebug() << "Editable " << wp->getId() << " changedCurrent: State 2";
wp->setCurrent(true); wp->setCurrent(true);
emit changeCurrentWaypoint(wp->getId()); //the slot changeCurrentWaypoint() in WaypointList sets all other current flags to false emit changeCurrentWaypoint(wp->getId()); //the slot changeCurrentWaypoint() in WaypointList sets all other current flags to false
} }
//m_ui->selectedBox->blockSignals(false);
} }
void WaypointView::updateValues() void WaypointEditableView::updateValues()
{ {
// Check if we just lost the wp, delete the widget // Check if we just lost the wp, delete the widget
// accordingly // accordingly
...@@ -501,11 +518,11 @@ void WaypointView::updateValues() ...@@ -501,11 +518,11 @@ void WaypointView::updateValues()
// If action is unknown, set direct editing mode // If action is unknown, set direct editing mode
if (wp->getAction() < 0 || wp->getAction() > MAV_CMD_NAV_TAKEOFF) if (wp->getAction() < 0 || wp->getAction() > MAV_CMD_NAV_TAKEOFF)
{ {
changeViewMode(QGC_WAYPOINTVIEW_MODE_DIRECT_EDITING); changeViewMode(QGC_WAYPOINTEDITABLEVIEW_MODE_DIRECT_EDITING);
} }
else else
{ {
if (viewMode != QGC_WAYPOINTVIEW_MODE_DIRECT_EDITING) if (viewMode != QGC_WAYPOINTEDITABLEVIEW_MODE_DIRECT_EDITING)
{ {
// Action ID known, update // Action ID known, update
m_ui->comboBox_action->setCurrentIndex(action_index); m_ui->comboBox_action->setCurrentIndex(action_index);
...@@ -696,19 +713,19 @@ void WaypointView::updateValues() ...@@ -696,19 +713,19 @@ void WaypointView::updateValues()
// wp->blockSignals(false); // wp->blockSignals(false);
} }
void WaypointView::setCurrent(bool state) void WaypointEditableView::setCurrent(bool state)
{ {
m_ui->selectedBox->blockSignals(true); m_ui->selectedBox->blockSignals(true);
m_ui->selectedBox->setChecked(state); m_ui->selectedBox->setChecked(state);
m_ui->selectedBox->blockSignals(false); m_ui->selectedBox->blockSignals(false);
} }
WaypointView::~WaypointView() WaypointEditableView::~WaypointEditableView()
{ {
delete m_ui; delete m_ui;
} }
void WaypointView::changeEvent(QEvent *e) void WaypointEditableView::changeEvent(QEvent *e)
{ {
switch (e->type()) { switch (e->type()) {
case QEvent::LanguageChange: case QEvent::LanguageChange:
......
...@@ -30,33 +30,33 @@ This file is part of the QGROUNDCONTROL project ...@@ -30,33 +30,33 @@ This file is part of the QGROUNDCONTROL project
* *
*/ */
#ifndef WAYPOINTVIEW_H #ifndef WAYPOINTEDITABLEVIEW_H
#define WAYPOINTVIEW_H #define WAYPOINTEDITABLEVIEW_H
#include <QtGui/QWidget> #include <QtGui/QWidget>
#include "Waypoint.h" #include "Waypoint.h"
#include <iostream> #include <iostream>
enum QGC_WAYPOINTVIEW_MODE { enum QGC_WAYPOINTEDITABLEVIEW_MODE {
QGC_WAYPOINTVIEW_MODE_NAV, QGC_WAYPOINTEDITABLEVIEW_MODE_NAV,
QGC_WAYPOINTVIEW_MODE_CONDITION, QGC_WAYPOINTEDITABLEVIEW_MODE_CONDITION,
QGC_WAYPOINTVIEW_MODE_DO, QGC_WAYPOINTEDITABLEVIEW_MODE_DO,
QGC_WAYPOINTVIEW_MODE_DIRECT_EDITING QGC_WAYPOINTEDITABLEVIEW_MODE_DIRECT_EDITING
}; };
namespace Ui namespace Ui
{ {
class WaypointView; class WaypointEditableView;
} }
class Ui_QGCCustomWaypointAction; class Ui_QGCCustomWaypointAction;
class WaypointView : public QWidget class WaypointEditableView : public QWidget
{ {
Q_OBJECT Q_OBJECT
Q_DISABLE_COPY(WaypointView) Q_DISABLE_COPY(WaypointEditableView)
public: public:
explicit WaypointView(Waypoint* wp, QWidget* parent); explicit WaypointEditableView(Waypoint* wp, QWidget* parent);
virtual ~WaypointView(); virtual ~WaypointEditableView();
public: public:
void setCurrent(bool state); void setCurrent(bool state);
...@@ -76,7 +76,7 @@ public slots: ...@@ -76,7 +76,7 @@ public slots:
void updateValues(void); void updateValues(void);
protected slots: protected slots:
void changeViewMode(QGC_WAYPOINTVIEW_MODE mode); void changeViewMode(QGC_WAYPOINTEDITABLEVIEW_MODE mode);
protected: protected:
virtual void changeEvent(QEvent *e); virtual void changeEvent(QEvent *e);
...@@ -84,18 +84,18 @@ protected: ...@@ -84,18 +84,18 @@ protected:
// Special widgets extendending the // Special widgets extendending the
// waypoint view to mission capabilities // waypoint view to mission capabilities
Ui_QGCCustomWaypointAction* customCommand; Ui_QGCCustomWaypointAction* customCommand;
QGC_WAYPOINTVIEW_MODE viewMode; QGC_WAYPOINTEDITABLEVIEW_MODE viewMode;
private: private:
Ui::WaypointView *m_ui; Ui::WaypointEditableView *m_ui;
signals: signals:
void moveUpWaypoint(Waypoint*); void moveUpWaypoint(Waypoint*);
void moveDownWaypoint(Waypoint*); void moveDownWaypoint(Waypoint*);
void removeWaypoint(Waypoint*); void removeWaypoint(Waypoint*);
void currentWaypointChanged(quint16); //void currentWaypointChanged(quint16); //unused
void changeCurrentWaypoint(quint16); void changeCurrentWaypoint(quint16);
void setYaw(double); void setYaw(double);
}; };
#endif // WAYPOINTVIEW_H #endif // WAYPOINTEDITABLEVIEW_H
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>WaypointView</class> <class>WaypointEditableView</class>
<widget class="QWidget" name="WaypointView"> <widget class="QWidget" name="WaypointEditableView">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
...@@ -604,7 +604,7 @@ Time to stay at this position before advancing</string> ...@@ -604,7 +604,7 @@ Time to stay at this position before advancing</string>
<string/> <string/>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../../mavground.qrc"> <iconset resource="../../qgroundcontrol.qrc">
<normaloff>:/images/actions/go-up.svg</normaloff>:/images/actions/go-up.svg</iconset> <normaloff>:/images/actions/go-up.svg</normaloff>:/images/actions/go-up.svg</iconset>
</property> </property>
</widget> </widget>
...@@ -630,7 +630,7 @@ Time to stay at this position before advancing</string> ...@@ -630,7 +630,7 @@ Time to stay at this position before advancing</string>
<string/> <string/>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../../mavground.qrc"> <iconset resource="../../qgroundcontrol.qrc">
<normaloff>:/images/actions/go-down.svg</normaloff>:/images/actions/go-down.svg</iconset> <normaloff>:/images/actions/go-down.svg</normaloff>:/images/actions/go-down.svg</iconset>
</property> </property>
</widget> </widget>
...@@ -653,7 +653,7 @@ Time to stay at this position before advancing</string> ...@@ -653,7 +653,7 @@ Time to stay at this position before advancing</string>
<string/> <string/>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../../mavground.qrc"> <iconset resource="../../qgroundcontrol.qrc">
<normaloff>:/images/actions/list-remove.svg</normaloff>:/images/actions/list-remove.svg</iconset> <normaloff>:/images/actions/list-remove.svg</normaloff>:/images/actions/list-remove.svg</iconset>
</property> </property>
</widget> </widget>
...@@ -664,7 +664,7 @@ Time to stay at this position before advancing</string> ...@@ -664,7 +664,7 @@ Time to stay at this position before advancing</string>
</layout> </layout>
</widget> </widget>
<resources> <resources>
<include location="../../mavground.qrc"/> <include location="../../qgroundcontrol.qrc"/>
</resources> </resources>
<connections/> <connections/>
</ui> </ui>
This diff is collapsed.
...@@ -40,8 +40,8 @@ This file is part of the QGROUNDCONTROL project ...@@ -40,8 +40,8 @@ This file is part of the QGROUNDCONTROL project
#include <QTimer> #include <QTimer>
#include "Waypoint.h" #include "Waypoint.h"
#include "UASInterface.h" #include "UASInterface.h"
#include "WaypointView.h" #include "WaypointEditableView.h"
#include "WaypointViewOnlyView.h"
namespace Ui namespace Ui
{ {
...@@ -69,10 +69,14 @@ public slots: ...@@ -69,10 +69,14 @@ public slots:
void loadWaypoints(); void loadWaypoints();
/** @brief Transmit the local waypoint list to the UAS */ /** @brief Transmit the local waypoint list to the UAS */
void transmit(); void transmit();
/** @brief Read the remote waypoint list */ /** @brief Read the remote waypoint list to both tabs */
void read(); void read();
/** @brief Add a waypoint */ /** @brief Read the remote waypoint list to "view"-tab only*/
void add(); void refresh();
/** @brief Add a waypoint to "edit"-tab */
void addEditable();
/** @brief Add a waypoint to "view"-tab */
// void addViewOnly();
/** @brief Add a waypoint at the current MAV position */ /** @brief Add a waypoint at the current MAV position */
void addCurrentPositionWaypoint(); void addCurrentPositionWaypoint();
/** @brief Add a waypoint by mouse click over the map */ /** @brief Add a waypoint by mouse click over the map */
...@@ -82,12 +86,18 @@ public slots: ...@@ -82,12 +86,18 @@ public slots:
void updateStatusLabel(const QString &string); void updateStatusLabel(const QString &string);
/** @brief The user wants to change the current waypoint */ /** @brief The user wants to change the current waypoint */
void changeCurrentWaypoint(quint16 seq); void changeCurrentWaypoint(quint16 seq);
/** @brief The waypoint planner changed the current waypoint */ /** @brief Current waypoint in edit-tab was changed, so the list must be updated (to contain only one waypoint checked as "current") */
void currentWaypointChanged(quint16 seq); void currentWaypointEditableChanged(quint16 seq);
/** @brief The waypoint manager informs that one waypoint was changed */ /** @brief Current waypoint on UAV was changed, update view-tab */
void updateWaypoint(int uas, Waypoint* wp); void currentWaypointViewOnlyChanged(quint16 seq);
/** @brief The waypoint manager informs that the waypoint list was changed */ /** @brief The waypoint manager informs that one editable waypoint was changed */
void waypointListChanged(void); void updateWaypointEditable(int uas, Waypoint* wp);
/** @brief The waypoint manager informs that one viewonly waypoint was changed */
void updateWaypointViewOnly(int uas, Waypoint* wp);
/** @brief The waypoint manager informs that the editable waypoint list was changed */
void waypointEditableListChanged(void);
/** @brief The waypoint manager informs that the waypoint list on the MAV was changed */
void waypointViewOnlyListChanged(void);
// /** @brief The MapWidget informs that a waypoint global was changed on the map */ // /** @brief The MapWidget informs that a waypoint global was changed on the map */
// void waypointGlobalChanged(const QPointF coordinate, const int indexWP); // void waypointGlobalChanged(const QPointF coordinate, const int indexWP);
...@@ -115,8 +125,10 @@ protected: ...@@ -115,8 +125,10 @@ protected:
virtual void changeEvent(QEvent *e); virtual void changeEvent(QEvent *e);
protected: protected:
QMap<Waypoint*, WaypointView*> wpViews; QMap<Waypoint*, WaypointEditableView*> wpEditableViews;
QVBoxLayout* listLayout; QMap<Waypoint*, WaypointViewOnlyView*> wpViewOnlyViews;
QVBoxLayout* viewOnlyListLayout;
QVBoxLayout* editableListLayout;
UASInterface* uas; UASInterface* uas;
double mavX; double mavX;
double mavY; double mavY;
......
This diff is collapsed.
#include <QDebug>
#include "WaypointViewOnlyView.h"
#include "ui_WaypointViewOnlyView.h"
WaypointViewOnlyView::WaypointViewOnlyView(Waypoint* wp, QWidget *parent) :
QWidget(parent),
m_ui(new Ui::WaypointViewOnlyView)
{
m_ui->setupUi(this);
this->wp = wp;
updateValues();
connect(m_ui->current, SIGNAL(stateChanged(int)), this, SLOT(changedCurrent(int)));
connect(m_ui->autoContinue, SIGNAL(stateChanged(int)),this, SLOT(changedAutoContinue(int)));
}
void WaypointViewOnlyView::changedAutoContinue(int state)
{
bool new_value = false;
if (state != 0)
{
new_value = true;
}
m_ui->autoContinue->blockSignals(true);
m_ui->autoContinue->setChecked(state);
m_ui->autoContinue->blockSignals(false);
wp->setAutocontinue(new_value);
emit changeAutoContinue(wp->getId(),new_value);
}
void WaypointViewOnlyView::changedCurrent(int state)
{
qDebug() << "Trof: WaypointViewOnlyView::changedCurrent(" << state << ") ID:" << wp->getId();
m_ui->current->blockSignals(true);
if (state == 0)
{
/*
m_ui->current->setStyleSheet("");
*/
if (wp->getCurrent() == true) //User clicked on the waypoint, that is already current
{
m_ui->current->setChecked(true);
m_ui->current->setCheckState(Qt::Checked);
}
else
{
m_ui->current->setChecked(false);
m_ui->current->setCheckState(Qt::Unchecked);
wp->setCurrent(false);
}
}
else
{
/*
FIXME: The checkbox should turn gray to indicate, that set_current request has been sent to UAV. It should become blue (checked) after receiving set_current_ack from waypointplanner.
m_ui->current->setStyleSheet("*::indicator { \
border: 1px solid #777777; \
border-radius: 2px; \
color: #999999; \
width: 10px; \
height: 10px; \
}");
*/
wp->setCurrent(true);
emit changeCurrentWaypoint(wp->getId()); //the slot changeCurrentWaypoint() in WaypointList sets all other current flags to false
}
m_ui->current->blockSignals(false);
}
void WaypointViewOnlyView::setCurrent(bool state)
{
m_ui->current->blockSignals(true);
m_ui->current->setChecked(state);
m_ui->current->blockSignals(false);
}
void WaypointViewOnlyView::updateValues()
{
qDebug() << "Trof: WaypointViewOnlyView::updateValues() ID:" << wp->getId();
// Check if we just lost the wp, delete the widget
// accordingly
if (!wp)
{
deleteLater();
return;
}
// Update style
QColor backGroundColor = QGC::colorBackground;
static int lastId = -1;
int currId = wp->getId() % 2;
if (currId != lastId)
{
// qDebug() << "COLOR ID: " << currId;
if (currId == 1)
{
backGroundColor = QColor("#252528").lighter(150);
}
else
{
backGroundColor = QColor("#252528").lighter(250);
}
// Update color based on id
QString groupBoxStyle = QString("QGroupBox {padding: 0px; margin: 0px; border: 0px; background-color: %1; min-height: 12px; }").arg(backGroundColor.name());
QString labelStyle = QString("QWidget {background-color: %1; color: #DDDDDF; border-color: #EEEEEE; }").arg(backGroundColor.name());
QString displayBarStyle = QString("QWidget {background-color: %1; color: #DDDDDF; border: none; }").arg(backGroundColor.name());
QString checkBoxStyle = QString("QCheckBox {background-color: %1; color: #454545; border-color: #EEEEEE; }").arg(backGroundColor.name());
m_ui->autoContinue->setStyleSheet(checkBoxStyle);
m_ui->current->setStyleSheet(checkBoxStyle);
m_ui->idLabel->setStyleSheet(labelStyle);
m_ui->displayBar->setStyleSheet(displayBarStyle);
m_ui->groupBox->setStyleSheet(groupBoxStyle);
lastId = currId;
}
// update frame
m_ui->idLabel->setText(QString("%1").arg(wp->getId()));
if (m_ui->current->isChecked() != wp->getCurrent())
{
m_ui->current->blockSignals(true);
m_ui->current->setChecked(wp->getCurrent());
m_ui->current->blockSignals(false);
}
if (m_ui->autoContinue->isChecked() != wp->getAutoContinue())
{
m_ui->autoContinue->blockSignals(true);
m_ui->autoContinue->setChecked(wp->getAutoContinue());
m_ui->autoContinue->blockSignals(false);
}
switch (wp->getAction())
{
case MAV_CMD_NAV_WAYPOINT:
{
if (wp->getParam1()>0)
{
m_ui->displayBar->setText(QString("Go to <b>(%1, %2, %3)</b> and wait there for %4 sec; yaw: %5; rad: %6").arg(wp->getX()).arg(wp->getY()).arg(wp->getZ()).arg(wp->getParam1()).arg(wp->getParam4()).arg(wp->getParam2()));
}
else
{
m_ui->displayBar->setText(QString("Go to <b>(%1, %2, %3)</b>; yaw: %4; rad: %5").arg(wp->getX()).arg(wp->getY()).arg(wp->getZ()).arg(wp->getParam4()).arg(wp->getParam2()));
}
break;
}
case MAV_CMD_NAV_LAND:
{
m_ui->displayBar->setText(QString("LAND. Go to (%1, %2, %3) and descent; yaw: %4").arg(wp->getX()).arg(wp->getY()).arg(wp->getZ()).arg(wp->getParam4()));
break;
}
case MAV_CMD_NAV_TAKEOFF:
{
m_ui->displayBar->setText(QString("TAKEOFF. Go to (%1, %2, %3); yaw: %4").arg(wp->getX()).arg(wp->getY()).arg(wp->getZ()).arg(wp->getParam4()));
break;
}
case MAV_CMD_DO_JUMP:
{
if (wp->getParam2()>0)
{
m_ui->displayBar->setText(QString("Jump to waypoint %1. Jumps left: %2").arg(wp->getParam1()).arg(wp->getParam2()));
}
else
{
m_ui->displayBar->setText(QString("No jumps left. Proceed to next waypoint."));
}
break;
}
case MAV_CMD_CONDITION_DELAY:
{
m_ui->displayBar->setText(QString("Delay: %1 sec").arg(wp->getParam1()));
break;
}
case 237: //MAV_CMD_DO_START_SEARCH
{
m_ui->displayBar->setText(QString("Start searching for pattern. Success when got more than %2 detections with confidence %1").arg(wp->getParam1()).arg(wp->getParam2()));
break;
}
case 238: //MAV_CMD_DO_FINISH_SEARCH
{
m_ui->displayBar->setText(QString("Check if search was successful. yes -> jump to %1, no -> jump to %2. Jumps left: %3").arg(wp->getParam1()).arg(wp->getParam2()).arg(wp->getParam3()));
break;
}
case 240: //MAV_CMD_DO_SWEEP
{
m_ui->displayBar->setText(QString("Sweep. Corners: (%1,%2) and (%3,%4); z: %5; scan radius: %6").arg(wp->getParam3()).arg(wp->getParam4()).arg(wp->getParam5()).arg(wp->getParam6()).arg(wp->getParam7()).arg(wp->getParam1()));
break;
}
default:
{
m_ui->displayBar->setText(QString("Unknown Command ID (%1) : %2, %3, %4, %5, %6, %7, %8").arg(wp->getAction()).arg(wp->getParam1()).arg(wp->getParam2()).arg(wp->getParam3()).arg(wp->getParam4()).arg(wp->getParam5()).arg(wp->getParam6()).arg(wp->getParam7()));
break;
}
}
}
WaypointViewOnlyView::~WaypointViewOnlyView()
{
delete m_ui;
}
#ifndef WAYPOINTVIEWONLYVIEW_H
#define WAYPOINTVIEWONLYVIEW_H
#include <QtGui/QWidget>
#include "Waypoint.h"
#include <iostream>
namespace Ui {
class WaypointViewOnlyView;
}
class WaypointViewOnlyView : public QWidget
{
Q_OBJECT
public:
explicit WaypointViewOnlyView(Waypoint* wp, QWidget *parent = 0);
~WaypointViewOnlyView();
public slots:
void changedCurrent(int state);
void changedAutoContinue(int state);
void updateValues(void);
void setCurrent(bool state);
signals:
void changeCurrentWaypoint(quint16);
void changeAutoContinue(quint16, bool);
protected:
Waypoint* wp;
private:
Ui::WaypointViewOnlyView *m_ui;
};
#endif // WAYPOINTVIEWONLYVIEW_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>WaypointViewOnlyView</class>
<widget class="QWidget" name="WaypointViewOnlyView">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>381</width>
<height>40</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="title">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="flat">
<bool>false</bool>
</property>
<property name="checkable">
<bool>false</bool>
</property>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,1,100,1">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="current">
<property name="toolTip">
<string>Currently executed waypoint</string>
</property>
<property name="statusTip">
<string>Currently executed waypoint</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="idLabel">
<property name="text">
<string>ID</string>
</property>
</widget>
</item>
<item>
<widget class="QTextBrowser" name="displayBar">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>31</height>
</size>
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="autoContinue">
<property name="toolTip">
<string>Automatically continue after this waypoint</string>
</property>
<property name="statusTip">
<string>Automatically continue after this waypoint</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
...@@ -164,7 +164,7 @@ void QGCMapWidget::mouseDoubleClickEvent(QMouseEvent* event) ...@@ -164,7 +164,7 @@ void QGCMapWidget::mouseDoubleClickEvent(QMouseEvent* event)
wp->setLongitude(pos.Lng()); wp->setLongitude(pos.Lng());
wp->setAltitude(0); wp->setAltitude(0);
// wp->blockSignals(false); // wp->blockSignals(false);
// currWPManager->notifyOfChange(wp); // currWPManager->notifyOfChangeEditable(wp);
} }
} }
OPMapWidget::mouseDoubleClickEvent(event); OPMapWidget::mouseDoubleClickEvent(event);
...@@ -190,10 +190,10 @@ void QGCMapWidget::activeUASSet(UASInterface* uas) ...@@ -190,10 +190,10 @@ void QGCMapWidget::activeUASSet(UASInterface* uas)
if (currWPManager) if (currWPManager)
{ {
// Disconnect the waypoint manager / data storage from the UI // Disconnect the waypoint manager / data storage from the UI
disconnect(currWPManager, SIGNAL(waypointListChanged(int)), this, SLOT(updateWaypointList(int))); disconnect(currWPManager, SIGNAL(waypointEditableListChanged(int)), this, SLOT(updateWaypointList(int)));
disconnect(currWPManager, SIGNAL(waypointChanged(int, Waypoint*)), this, SLOT(updateWaypoint(int,Waypoint*))); disconnect(currWPManager, SIGNAL(waypointEditableChanged(int, Waypoint*)), this, SLOT(updateWaypoint(int,Waypoint*)));
disconnect(this, SIGNAL(waypointCreated(Waypoint*)), currWPManager, SLOT(addWaypoint(Waypoint*))); disconnect(this, SIGNAL(waypointCreated(Waypoint*)), currWPManager, SLOT(addWaypointEditable(Waypoint*)));
disconnect(this, SIGNAL(waypointChanged(Waypoint*)), currWPManager, SLOT(notifyOfChange(Waypoint*))); disconnect(this, SIGNAL(waypointChanged(Waypoint*)), currWPManager, SLOT(notifyOfChangeEditable(Waypoint*)));
} }
if (uas) if (uas)
...@@ -201,10 +201,10 @@ void QGCMapWidget::activeUASSet(UASInterface* uas) ...@@ -201,10 +201,10 @@ void QGCMapWidget::activeUASSet(UASInterface* uas)
currWPManager = uas->getWaypointManager(); currWPManager = uas->getWaypointManager();
// Connect the waypoint manager / data storage to the UI // Connect the waypoint manager / data storage to the UI
connect(currWPManager, SIGNAL(waypointListChanged(int)), this, SLOT(updateWaypointList(int))); connect(currWPManager, SIGNAL(waypointEditableListChanged(int)), this, SLOT(updateWaypointList(int)));
connect(currWPManager, SIGNAL(waypointChanged(int, Waypoint*)), this, SLOT(updateWaypoint(int,Waypoint*))); connect(currWPManager, SIGNAL(waypointEditableChanged(int, Waypoint*)), this, SLOT(updateWaypoint(int,Waypoint*)));
connect(this, SIGNAL(waypointCreated(Waypoint*)), currWPManager, SLOT(addWaypoint(Waypoint*))); connect(this, SIGNAL(waypointCreated(Waypoint*)), currWPManager, SLOT(addWaypointEditable(Waypoint*)));
connect(this, SIGNAL(waypointChanged(Waypoint*)), currWPManager, SLOT(notifyOfChange(Waypoint*))); connect(this, SIGNAL(waypointChanged(Waypoint*)), currWPManager, SLOT(notifyOfChangeEditable(Waypoint*)));
updateSelectedSystem(uas->getUASID()); updateSelectedSystem(uas->getUASID());
followUAVID = uas->getUASID(); followUAVID = uas->getUASID();
......
...@@ -278,7 +278,7 @@ Pixhawk3DWidget::insertWaypoint(void) ...@@ -278,7 +278,7 @@ Pixhawk3DWidget::insertWaypoint(void)
if (wp) { if (wp) {
wp->setFrame(frame); wp->setFrame(frame);
uas->getWaypointManager()->addWaypoint(wp); uas->getWaypointManager()->addWaypointEditable(wp);
} }
} }
} }
...@@ -294,7 +294,7 @@ Pixhawk3DWidget::setWaypoint(void) ...@@ -294,7 +294,7 @@ Pixhawk3DWidget::setWaypoint(void)
{ {
if (uas) { if (uas) {
const QVector<Waypoint *> waypoints = const QVector<Waypoint *> waypoints =
uas->getWaypointManager()->getWaypointList(); uas->getWaypointManager()->getWaypointEditableList();
Waypoint* waypoint = waypoints.at(selectedWpIndex); Waypoint* waypoint = waypoints.at(selectedWpIndex);
if (frame == MAV_FRAME_GLOBAL) { if (frame == MAV_FRAME_GLOBAL) {
...@@ -341,7 +341,7 @@ Pixhawk3DWidget::setWaypointAltitude(void) ...@@ -341,7 +341,7 @@ Pixhawk3DWidget::setWaypointAltitude(void)
if (uas) { if (uas) {
bool ok; bool ok;
const QVector<Waypoint *> waypoints = const QVector<Waypoint *> waypoints =
uas->getWaypointManager()->getWaypointList(); uas->getWaypointManager()->getWaypointEditableList();
Waypoint* waypoint = waypoints.at(selectedWpIndex); Waypoint* waypoint = waypoints.at(selectedWpIndex);
double altitude = waypoint->getZ(); double altitude = waypoint->getZ();
...@@ -367,7 +367,7 @@ Pixhawk3DWidget::clearAllWaypoints(void) ...@@ -367,7 +367,7 @@ Pixhawk3DWidget::clearAllWaypoints(void)
{ {
if (uas) { if (uas) {
const QVector<Waypoint *> waypoints = const QVector<Waypoint *> waypoints =
uas->getWaypointManager()->getWaypointList(); uas->getWaypointManager()->getWaypointEditableList();
for (int i = waypoints.size() - 1; i >= 0; --i) { for (int i = waypoints.size() - 1; i >= 0; --i) {
uas->getWaypointManager()->removeWaypoint(i); uas->getWaypointManager()->removeWaypoint(i);
} }
......
...@@ -209,9 +209,9 @@ void QGCGoogleEarthView::addUAS(UASInterface* uas) ...@@ -209,9 +209,9 @@ void QGCGoogleEarthView::addUAS(UASInterface* uas)
connect(uas, SIGNAL(globalPositionChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateGlobalPosition(UASInterface*,double,double,double,quint64))); connect(uas, SIGNAL(globalPositionChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateGlobalPosition(UASInterface*,double,double,double,quint64)));
// Receive waypoint updates // Receive waypoint updates
// Connect the waypoint manager / data storage to the UI // Connect the waypoint manager / data storage to the UI
connect(uas->getWaypointManager(), SIGNAL(waypointListChanged(int)), this, SLOT(updateWaypointList(int))); connect(uas->getWaypointManager(), SIGNAL(waypointEditableListChanged(int)), this, SLOT(updateWaypointList(int)));
connect(uas->getWaypointManager(), SIGNAL(waypointChanged(int, Waypoint*)), this, SLOT(updateWaypoint(int,Waypoint*))); connect(uas->getWaypointManager(), SIGNAL(waypointEditableChanged(int, Waypoint*)), this, SLOT(updateWaypoint(int,Waypoint*)));
//connect(this, SIGNAL(waypointCreated(Waypoint*)), uas->getWaypointManager(), SLOT(addWaypoint(Waypoint*))); //connect(this, SIGNAL(waypointCreated(Waypoint*)), uas->getWaypointManager(), SLOT(addWaypointEditable(Waypoint*)));
// TODO Update waypoint list on UI changes here // TODO Update waypoint list on UI changes here
} }
...@@ -722,7 +722,7 @@ void QGCGoogleEarthView::updateState() ...@@ -722,7 +722,7 @@ void QGCGoogleEarthView::updateState()
wp->setLatitude(latitude); wp->setLatitude(latitude);
wp->setLongitude(longitude); wp->setLongitude(longitude);
wp->setAltitude(altitude); wp->setAltitude(altitude);
mav->getWaypointManager()->notifyOfChange(wp); mav->getWaypointManager()->notifyOfChangeEditable(wp);
} }
} }
} }
......
...@@ -73,7 +73,7 @@ WaypointGroupNode::update(MAV_FRAME frame, UASInterface *uas) ...@@ -73,7 +73,7 @@ WaypointGroupNode::update(MAV_FRAME frame, UASInterface *uas)
removeChild(0, getNumChildren()); removeChild(0, getNumChildren());
} }
const QVector<Waypoint *>& list = uas->getWaypointManager()->getWaypointList(); const QVector<Waypoint *>& list = uas->getWaypointManager()->getWaypointEditableList();
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
Waypoint* wp = list.at(i); Waypoint* wp = list.at(i);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment