diff --git a/qgroundcontrol.pro b/qgroundcontrol.pro index d71b44f8fd600ab25c337b22a60050a6add0a0de..a2b9126e674be807eaef4575c0f93da4e60c3628 100644 --- a/qgroundcontrol.pro +++ b/qgroundcontrol.pro @@ -3,9 +3,9 @@ # from http://github.com/pixhawk/qmapcontrol/ # over bundled version in lib directory # Version from GIT repository is preferred -include ( "../qmapcontrol/QMapControl/QMapControl.pri" ) #{ +#include ( "../qmapcontrol/QMapControl/QMapControl.pri" ) #{ # Include bundled version if necessary -#include(lib/QMapControl/QMapControl.pri) +include(lib/QMapControl/QMapControl.pri) #message("Including bundled QMapControl version as FALLBACK. This is fine on Linux and MacOS, but not the best choice in Windows") diff --git a/src/Waypoint.cc b/src/Waypoint.cc index f58321c75646d42858746e9eab1ba79d6feaabcc..bf947d4ad28e5246afa37f77bdb5ad3495bb5cc0 100644 --- a/src/Waypoint.cc +++ b/src/Waypoint.cc @@ -26,29 +26,21 @@ This file is part of the PIXHAWK project * @brief Waypoint class * * @author Benjamin Knecht + * @author Petri Tanskanen * */ #include "Waypoint.h" -Waypoint::Waypoint(QString name, int id, double x, double y, double z, double yaw, bool autocontinue, bool current) +Waypoint::Waypoint(quint16 id, float x, float y, float z, float yaw, bool autocontinue, bool current) { this->id = id; - this->x = x; this->y = y; this->z = z; - this->yaw = yaw; this->autocontinue = autocontinue; this->current = current; - - this->name = name; -} - -int Waypoint::getId() -{ - return id; } Waypoint::~Waypoint() @@ -56,27 +48,27 @@ Waypoint::~Waypoint() } -void Waypoint::setName(QString name) +void Waypoint::setId(quint16 id) { - this->name = name; + this->id = id; } -void Waypoint::setX(double x) +void Waypoint::setX(float x) { this->x = x; } -void Waypoint::setY(double y) +void Waypoint::setY(float y) { this->y = y; } -void Waypoint::setZ(double z) +void Waypoint::setZ(float z) { this->z = z; } -void Waypoint::setYaw(double yaw) +void Waypoint::setYaw(float yaw) { this->yaw = yaw; } diff --git a/src/Waypoint.h b/src/Waypoint.h index efa5abe1021969aefd1366ed524755dff380f6a3..36698b16fc837dd7d7ce239facc7cd55b611c023 100644 --- a/src/Waypoint.h +++ b/src/Waypoint.h @@ -26,6 +26,7 @@ This file is part of the PIXHAWK project * @brief Waypoint class * * @author Benjamin Knecht + * @author Petri Tanskanen * */ @@ -38,35 +39,36 @@ This file is part of the PIXHAWK project class Waypoint : public QObject { Q_OBJECT + public: - Waypoint(QString name, int id = 0, double x = 0.0f, double y = 0.0f, double z = 0.0f, double yaw = 0.0f, bool autocontinue = false, bool current = false); + Waypoint(quint16 id = 0, float x = 0.0f, float y = 0.0f, float z = 0.0f, float yaw = 0.0f, bool autocontinue = false, bool current = false); ~Waypoint(); - int getId(); - - int id; - - double x; - double y; - double z; - - double yaw; + quint16 getId() const { return id; } + float getX() const { return x; } + float getY() const { return y; } + float getZ() const { return z; } + float getYaw() const { return yaw; } + bool getAutoContinue() const { return autocontinue; } + bool getCurrent() const { return current; } + +private: + quint16 id; + float x; + float y; + float z; + float yaw; bool autocontinue; bool current; - QString name; - - public slots: - void setName(QString name); - void setX(double x); - void setY(double y); - void setZ(double z); - void setYaw(double yaw); + void setId(quint16 id); + void setX(float x); + void setY(float y); + void setZ(float z); + void setYaw(float yaw); void setAutocontinue(bool autoContinue); void setCurrent(bool current); - - }; #endif // WAYPOINT_H diff --git a/src/uas/UASWaypointManager.cc b/src/uas/UASWaypointManager.cc index 38f7151d22dcce214f078ec16b24611c70c3f3ca..b589341b836badfccff968962c99a8a872d9d17d 100644 --- a/src/uas/UASWaypointManager.cc +++ b/src/uas/UASWaypointManager.cc @@ -15,22 +15,13 @@ void UASWaypointManager::handleWaypointCount(quint8 systemId, quint8 compId, qui { if (current_state == WP_GETLIST && systemId == current_partner_systemid && compId == current_partner_compid) { - qDebug() << "handleWaypointCount"; + qDebug() << "got waypoint count (" << count << ") from ID " << systemId; current_count = count; - - mavlink_message_t message; - mavlink_waypoint_request_t wpr; - - wpr.target_system = uas.getUASID(); - wpr.target_component = MAV_COMP_ID_WAYPOINTPLANNER; - wpr.seq = 0; - current_wp_id = 0; current_state = WP_GETLIST_GETWPS; - mavlink_msg_waypoint_request_encode(uas.mavlink->getSystemId(), uas.mavlink->getComponentId(), &message, &wpr); - uas.sendMessage(message); + sendWaypointRequest(current_wp_id); } } @@ -38,7 +29,7 @@ void UASWaypointManager::handleWaypoint(quint8 systemId, quint8 compId, mavlink_ { if (systemId == current_partner_systemid && compId == current_partner_compid && current_state == WP_GETLIST_GETWPS && wp->seq == current_wp_id) { - qDebug() << "handleWaypoint"; + qDebug() << "got waypoint (" << wp->seq << ") from ID " << systemId; if(wp->seq == current_wp_id) { @@ -50,15 +41,7 @@ void UASWaypointManager::handleWaypoint(quint8 systemId, quint8 compId, mavlink_ if(current_wp_id < current_count) { - mavlink_message_t message; - mavlink_waypoint_request_t wpr; - - wpr.target_system = uas.getUASID(); - wpr.target_component = MAV_COMP_ID_WAYPOINTPLANNER; - wpr.seq = current_wp_id; - - mavlink_msg_waypoint_request_encode(uas.mavlink->getSystemId(), uas.mavlink->getComponentId(), &message, &wpr); - uas.sendMessage(message); + sendWaypointRequest(current_wp_id); } else { @@ -68,6 +51,10 @@ void UASWaypointManager::handleWaypoint(quint8 systemId, quint8 compId, mavlink_ current_wp_id = 0; current_partner_systemid = 0; current_partner_compid = 0; + + emit updateStatusString("done."); + + qDebug() << "got all waypoints from from ID " << systemId; } } else @@ -83,7 +70,7 @@ void UASWaypointManager::handleWaypointRequest(quint8 systemId, quint8 compId, m { qDebug() << "handleWaypointRequest"; - if (wpr->seq < 0) + if (wpr->seq < waypoint_buffer.count()) { //TODO: send waypoint } @@ -113,7 +100,6 @@ void UASWaypointManager::requestWaypoints() { if(current_state == WP_IDLE) { - qDebug() << "requestWaypoints"; mavlink_message_t message; mavlink_waypoint_request_list_t wprl; @@ -125,27 +111,80 @@ void UASWaypointManager::requestWaypoints() current_partner_systemid = uas.getUASID(); current_partner_compid = MAV_COMP_ID_WAYPOINTPLANNER; + qDebug() << "sent waypoint list request to ID " << wprl.target_system; + + const QString str = QString("requesting waypoint list..."); + emit updateStatusString(str); + mavlink_msg_waypoint_request_list_encode(uas.mavlink->getSystemId(), uas.mavlink->getComponentId(), &message, &wprl); - uas.sendMessage(message); + uas.sendMessage(message); } } -void UASWaypointManager::sendWaypoints(void) +void UASWaypointManager::sendWaypoints(const QVector &list) { - mavlink_message_t message; - mavlink_waypoint_count_t wpc; + if (current_state == WP_IDLE) + { + current_count = list.count(); + current_state = WP_SENDLIST; + current_wp_id = 0; - wpc.target_system = uas.getUASID(); - wpc.target_component = MAV_COMP_ID_WAYPOINTPLANNER; - wpc.count = 0; //TODO + //copy waypoint data to local buffer + for (int i=0; i < current_count; i++) + { + waypoint_buffer.push_back(new mavlink_waypoint_t); + mavlink_waypoint_t *cur_d = waypoint_buffer.back(); + memset(cur_d, 0, sizeof(mavlink_waypoint_t)); //initialize with zeros + const Waypoint *cur_s = list.at(i); + + cur_d->autocontinue = cur_s->getAutoContinue(); + cur_d->current = cur_s->getCurrent(); + cur_d->seq = i; + cur_d->x = cur_s->getX(); + cur_d->y = cur_s->getY(); + cur_d->z = cur_s->getZ(); + cur_d->yaw = cur_s->getYaw(); + } - mavlink_msg_waypoint_count_encode(uas.mavlink->getSystemId(), uas.mavlink->getComponentId(), &message, &wpc); - uas.sendMessage(message); + //send the waypoint count to UAS (this starts the send transaction) + mavlink_message_t message; + mavlink_waypoint_count_t wpc; + + wpc.target_system = uas.getUASID(); + wpc.target_component = MAV_COMP_ID_WAYPOINTPLANNER; + wpc.count = current_count; + + qDebug() << "sent waypoint count (" << wpc.count << ") to ID " << wpc.target_system; + + const QString str = QString("start transmitting waypoints..."); + emit updateStatusString(str); + + mavlink_msg_waypoint_count_encode(uas.mavlink->getSystemId(), uas.mavlink->getComponentId(), &message, &wpc); + uas.sendMessage(message); + } + else + { + //we're in another transaction, ignore command + qDebug() << "UASWaypointManager::sendWaypoints() doing something else ignoring command"; + } } -void UASWaypointManager::getWaypoint(quint16 seq) +void UASWaypointManager::sendWaypointRequest(quint16 seq) { + mavlink_message_t message; + mavlink_waypoint_request_t wpr; + + wpr.target_system = uas.getUASID(); + wpr.target_component = MAV_COMP_ID_WAYPOINTPLANNER; + wpr.seq = seq; + + mavlink_msg_waypoint_request_encode(uas.mavlink->getSystemId(), uas.mavlink->getComponentId(), &message, &wpr); + uas.sendMessage(message); + + qDebug() << "sent waypoint request (" << wpr.seq << ") to ID " << wpr.target_system; + const QString str = QString("retrieving waypoint ID %1 of %2 total").arg(wpr.seq).arg(current_count); + emit updateStatusString(str); } void UASWaypointManager::waypointChanged(Waypoint*) diff --git a/src/uas/UASWaypointManager.h b/src/uas/UASWaypointManager.h index f370e1bd05f6b7e15068d9658c0acd1181095163..26e6be1a34af860560ea49eb15853e35d97d0d3d 100644 --- a/src/uas/UASWaypointManager.h +++ b/src/uas/UASWaypointManager.h @@ -2,6 +2,7 @@ #define UASWAYPOINTMANAGER_H #include +#include #include "Waypoint.h" #include class UAS; @@ -26,26 +27,29 @@ public: void handleWaypointRequest(quint8 systemId, quint8 compId, mavlink_waypoint_request_t *wpr); private: - void getWaypoint(quint16 seq); + void sendWaypointRequest(quint16 seq); public slots: void clearWaypointList(); void currentWaypointChanged(int); void removeWaypointId(int); void requestWaypoints(); - void sendWaypoints(void); + void sendWaypoints(const QVector &list); void waypointChanged(Waypoint*); signals: - void waypointUpdated(int,int,double,double,double,double,bool,bool); + void waypointUpdated(int,int,double,double,double,double,bool,bool); ///< Adds a waypoint to the waypoint list widget + void updateStatusString(const QString &); ///< updates the current status string private: - UAS &uas; - quint16 current_wp_id; ///< The last used waypoint ID - quint16 current_count; - WaypointState current_state; ///< The current state - quint8 current_partner_systemid; - quint8 current_partner_compid; + UAS &uas; ///< Reference to the corresponding UAS + 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 + WaypointState current_state; ///< The current protocol state + quint8 current_partner_systemid; ///< The current protocol communication target system + quint8 current_partner_compid; ///< The current protocol communication target component + + QVector waypoint_buffer; ///< communication buffer for waypoints }; #endif // UASWAYPOINTMANAGER_H diff --git a/src/ui/WaypointList.cc b/src/ui/WaypointList.cc index dc39bd9dd36770f7353782b604026ded420ae36c..f790905f5beebce12360ec6291523fb4ff122129 100644 --- a/src/ui/WaypointList.cc +++ b/src/ui/WaypointList.cc @@ -27,6 +27,7 @@ This file is part of the PIXHAWK project * * @author Lorenz Meier * @author Benjamin Knecht + * @author Petri Tanskanen * */ @@ -74,6 +75,9 @@ WaypointList::WaypointList(QWidget *parent, UASInterface* uas) : connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(setUAS(UASInterface*))); connect(transmitDelay, SIGNAL(timeout()), this, SLOT(reenableTransmit())); + // STATUS LABEL + updateStatusLabel(""); + // SET UAS AFTER ALL SIGNALS/SLOTS ARE CONNECTED setUAS(uas); } @@ -83,6 +87,11 @@ WaypointList::~WaypointList() delete m_ui; } +void WaypointList::updateStatusLabel(const QString &string) +{ + m_ui->statusLabel->setText(string); +} + void WaypointList::setUAS(UASInterface* uas) { if (this->uas == NULL && uas != NULL) @@ -95,10 +104,12 @@ void WaypointList::setUAS(UASInterface* uas) connect(this, SIGNAL(requestWaypoints()), &uas->getWaypointManager(), SLOT(requestWaypoints())); connect(this, SIGNAL(clearWaypointList()), &uas->getWaypointManager(), SLOT(clearWaypointList())); + connect(&uas->getWaypointManager(), SIGNAL(updateStatusString(const QString &)), this, SLOT(updateStatusLabel(const QString &))); + // This slot is not implemented in UAS: connect(this, SIGNAL(removeWaypointId(int)), uas, SLOT(removeWaypoint(Waypoint*))); - qDebug() << "Requesting waypoints"; - emit requestWaypoints(); + //qDebug() << "Requesting waypoints"; + //emit requestWaypoints(); } } @@ -114,7 +125,7 @@ void WaypointList::setWaypoint(int uasId, int id, double x, double y, double z, string = waypointNames.value(id); } - Waypoint* wp = new Waypoint(string, id, x, y, z, yaw, autocontinue, current); + Waypoint* wp = new Waypoint(id, x, y, z, yaw, autocontinue, current); addWaypoint(wp); } } @@ -122,7 +133,9 @@ void WaypointList::setWaypoint(int uasId, int id, double x, double y, double z, void WaypointList::waypointReached(UASInterface* uas, int waypointId) { Q_UNUSED(uas); - if (waypoints.size() > waypointId) + qDebug() << "Waypoint reached: " << waypointId; + + /*if (waypoints.size() > waypointId) { if (waypoints[waypointId]->autocontinue == true) { @@ -149,7 +162,7 @@ void WaypointList::waypointReached(UASInterface* uas, int waypointId) qDebug() << "NEW WAYPOINT SET"; } - } + }*/ } void WaypointList::transmit() @@ -160,12 +173,13 @@ void WaypointList::transmit() waypointNames.clear(); for(int i = 0; i < waypoints.size(); i++) { - Waypoint* wp = waypoints[i]; - waypointNames.insert(wp->id, wp->name); + //Waypoint* wp = waypoints[i]; + /*waypointNames.insert(wp->id, wp->name); emit waypointChanged(wp); if (wp->current) - emit currentWaypointChanged(wp->id); + emit currentWaypointChanged(wp->id);*/ } + while(waypoints.size()>0) { removeWaypoint(waypoints[0]); @@ -180,11 +194,11 @@ void WaypointList::add() { if (waypoints.size() > 0) { - addWaypoint(new Waypoint("New waypoint", waypoints.size(), 0.0, 0.1, -0.5, 0.0, false, false)); + addWaypoint(new Waypoint(waypoints.size(), 0.0, 0.1, -0.5, 0.0, false, false)); } else { - addWaypoint(new Waypoint("New waypoint", waypoints.size(), 0.0, 0.0, -0.5, 360.0, false, true)); + addWaypoint(new Waypoint(waypoints.size(), 0.0, 0.0, -0.5, 360.0, false, true)); } } } @@ -196,7 +210,7 @@ void WaypointList::addWaypoint(Waypoint* wp) removeWaypoint(wp); } - waypoints.insert(wp->id, wp); + waypoints.insert(wp->getId(), wp); if (!wpViews.contains(wp)) { @@ -231,17 +245,9 @@ void WaypointList::redrawList() } } -void WaypointList::debugOutputWaypoints() -{ - for (int i = 0; i < waypoints.size(); i++) - { - qDebug() << i << " " << waypoints[i]->name; - } -} - void WaypointList::moveUp(Waypoint* wp) { - int id = wp->id; + int id = wp->getId(); if (waypoints.size() > 1 && waypoints.size() > id) { Waypoint* temp = waypoints[id]; @@ -249,15 +255,15 @@ void WaypointList::moveUp(Waypoint* wp) { waypoints[id] = waypoints[id-1]; waypoints[id-1] = temp; - waypoints[id-1]->id = id-1; - waypoints[id]->id = id; + waypoints[id-1]->setId(id-1); + waypoints[id]->setId(id); } else { waypoints[id] = waypoints[waypoints.size()-1]; waypoints[waypoints.size()-1] = temp; - waypoints[waypoints.size()-1]->id = waypoints.size()-1; - waypoints[id]->id = id; + waypoints[waypoints.size()-1]->setId(waypoints.size()-1); + waypoints[id]->setId(id); } redrawList(); } @@ -265,7 +271,7 @@ void WaypointList::moveUp(Waypoint* wp) void WaypointList::moveDown(Waypoint* wp) { - int id = wp->id; + int id = wp->getId(); if (waypoints.size() > 1 && waypoints.size() > id) { Waypoint* temp = waypoints[id]; @@ -273,15 +279,15 @@ void WaypointList::moveDown(Waypoint* wp) { waypoints[id] = waypoints[id+1]; waypoints[id+1] = temp; - waypoints[id+1]->id = id+1; - waypoints[id]->id = id; + waypoints[id+1]->setId(id+1); + waypoints[id]->setId(id); } else { waypoints[id] = waypoints[0]; waypoints[0] = temp; - waypoints[0]->id = 0; - waypoints[id]->id = id; + waypoints[0]->setId(0); + waypoints[id]->setId(id); } redrawList(); } @@ -289,7 +295,7 @@ void WaypointList::moveDown(Waypoint* wp) void WaypointList::removeWaypointAndName(Waypoint* wp) { - waypointNames.remove(wp->id); + waypointNames.remove(wp->getId()); removeWaypoint(wp); } @@ -297,10 +303,10 @@ void WaypointList::removeWaypoint(Waypoint* wp) { // Delete from list if (wp != NULL){ - waypoints.remove(wp->id); - for(int i = wp->id; i < waypoints.size(); i++) + waypoints.remove(wp->getId()); + for(int i = wp->getId(); i < waypoints.size(); i++) { - waypoints[i]->id = i; + waypoints[i]->setId(i); } // Remove from view @@ -318,15 +324,15 @@ void WaypointList::setCurrentWaypoint(Waypoint* wp) { if (waypoints[i] == wp) { - waypoints[i]->current = true; + waypoints[i]->setCurrent(true); // Retransmit waypoint //uas->getWaypointManager().setWaypointActive(i); } else { - if (waypoints[i]->current) + if (waypoints[i]->getCurrent()) { - waypoints[i]->current = false; + waypoints[i]->setCurrent(false); WaypointView* widget = wpViews.find(waypoints[i]).value(); widget->removeCurrentCheck(); } @@ -361,7 +367,7 @@ void WaypointList::saveWaypoints() for (int i = 0; i < waypoints.size(); i++) { Waypoint* wp = waypoints[i]; - in << wp->name << "~" << wp->id << "~" << wp->x << "~" << wp->y << "~" << wp->z << "~" << wp->yaw << "~" << wp->autocontinue << "~" << wp->current << "\n"; + in << "~" << wp->getId() << "~" << wp->getX() << "~" << wp->getY() << "~" << wp->getZ() << "~" << wp->getYaw() << "~" << wp->getAutoContinue() << "~" << wp->getCurrent() << "\n"; in.flush(); } file.close(); @@ -384,7 +390,7 @@ void WaypointList::loadWaypoints() { QStringList wpParams = in.readLine().split("~"); if (wpParams.size() == 8) - addWaypoint(new Waypoint(wpParams[0], wpParams[1].toInt(), wpParams[2].toDouble(), wpParams[3].toDouble(), wpParams[4].toDouble(), wpParams[5].toDouble(), (wpParams[6].toInt() == 1 ? true : false), (wpParams[7].toInt() == 1 ? true : false))); + addWaypoint(new Waypoint(wpParams[1].toInt(), wpParams[2].toDouble(), wpParams[3].toDouble(), wpParams[4].toDouble(), wpParams[5].toDouble(), (wpParams[6].toInt() == 1 ? true : false), (wpParams[7].toInt() == 1 ? true : false))); } file.close(); } diff --git a/src/ui/WaypointList.h b/src/ui/WaypointList.h index 9c0e59973b426e756fc475253e69598825092acf..cde1a2891a341bda7a60bb181476496fc85ea94a 100644 --- a/src/ui/WaypointList.h +++ b/src/ui/WaypointList.h @@ -27,6 +27,7 @@ This file is part of the PIXHAWK project * * @author Lorenz Meier * @author Benjamin Knecht + * @author Petri Tanskanen * */ @@ -66,6 +67,9 @@ public slots: void moveDown(Waypoint* wp); void setCurrentWaypoint(Waypoint* wp); + /** @brief sets statusLabel string */ + void updateStatusLabel(const QString &string); + //To be moved to UASWaypointManager (?) void setWaypoint(int uasId, int id, double x, double y, double z, double yaw, bool autocontinue, bool current); void addWaypoint(Waypoint* wp); diff --git a/src/ui/WaypointList.ui b/src/ui/WaypointList.ui index 1b37aaa47d995814848698984b8b4528f336bcc0..c70a5e79b4129004b7259809d315fd0a421742dc 100644 --- a/src/ui/WaypointList.ui +++ b/src/ui/WaypointList.ui @@ -6,8 +6,8 @@ 0 0 - 419 - 206 + 476 + 218 @@ -19,14 +19,14 @@ Form - + 4 4 - + true @@ -36,8 +36,8 @@ 0 0 - 409 - 158 + 466 + 148 @@ -54,66 +54,73 @@ - - - - Qt::Horizontal - - - - 127 - 20 - - - - - - + + - ... + Read - :/images/actions/list-add.svg:/images/actions/list-add.svg + :/images/status/software-update-available.svg:/images/status/software-update-available.svg - - + + - Save WPs + Write + + + + :/images/devices/network-wireless.svg:/images/devices/network-wireless.svg - - + + - Load WPs + TextLabel - - + + - Read + ... - :/images/status/software-update-available.svg:/images/status/software-update-available.svg + :/images/actions/list-add.svg:/images/actions/list-add.svg - - + + - Write + Load WPs - - - :/images/devices/network-wireless.svg:/images/devices/network-wireless.svg + + + + + + Save WPs + + + + Qt::Horizontal + + + + 127 + 20 + + + + diff --git a/src/ui/WaypointView.cc b/src/ui/WaypointView.cc index 8361aa7ffbfb8411dc40f9afc1db38e718cb4ec0..36acc291ca59316261c2be3cf998fae51f0c30fc 100644 --- a/src/ui/WaypointView.cc +++ b/src/ui/WaypointView.cc @@ -27,6 +27,7 @@ This file is part of the PIXHAWK project * * @author Lorenz Meier * @author Benjamin Knecht + * @author Petri Tanskanen * */ @@ -45,13 +46,13 @@ WaypointView::WaypointView(Waypoint* wp, QWidget* parent) : this->wp = wp; // Read values and set user interface - m_ui->name->setText(wp->name); - m_ui->xSpinBox->setValue(wp->x); - m_ui->ySpinBox->setValue(wp->y); - m_ui->zSpinBox->setValue(wp->z); - m_ui->yawSpinBox->setValue(wp->yaw); - m_ui->selectedBox->setChecked(wp->current); - m_ui->autoContinue->setChecked(wp->autocontinue); + m_ui->xSpinBox->setValue(wp->getX()); + m_ui->ySpinBox->setValue(wp->getY()); + m_ui->zSpinBox->setValue(wp->getZ()); + m_ui->yawSpinBox->setValue(wp->getYaw()); + m_ui->selectedBox->setChecked(wp->getCurrent()); + m_ui->autoContinue->setChecked(wp->getAutoContinue()); + m_ui->idLabel->setText(QString("%1").arg(wp->getId())); connect(m_ui->xSpinBox, SIGNAL(valueChanged(double)), wp, SLOT(setX(double))); connect(m_ui->ySpinBox, SIGNAL(valueChanged(double)), wp, SLOT(setY(double))); @@ -64,7 +65,6 @@ WaypointView::WaypointView(Waypoint* wp, QWidget* parent) : connect(m_ui->autoContinue, SIGNAL(stateChanged(int)), this, SLOT(setAutoContinue(int))); connect(m_ui->selectedBox, SIGNAL(clicked()), this, SLOT(setCurrent())); - connect(m_ui->name, SIGNAL(editingFinished()), this, SLOT(setText())); } void WaypointView::moveUp() @@ -86,9 +86,9 @@ void WaypointView::remove() void WaypointView::setAutoContinue(int state) { if (state == 0) - wp->autocontinue = false; + wp->setAutocontinue(false); else - wp->autocontinue = true; + wp->setAutocontinue(true); emit waypointUpdated(wp); } @@ -105,11 +105,6 @@ void WaypointView::setCurrent() m_ui->selectedBox->setCheckState(Qt::Checked); } -void WaypointView::setText() -{ - wp->name = m_ui->name->text(); -} - WaypointView::~WaypointView() { delete m_ui; diff --git a/src/ui/WaypointView.h b/src/ui/WaypointView.h index a24810efac86bc5c2aa8250cc77bba4e3b0c16c1..d10f8d1e53425447bf74509727104805f87a5b48 100644 --- a/src/ui/WaypointView.h +++ b/src/ui/WaypointView.h @@ -27,6 +27,7 @@ This file is part of the PIXHAWK project * * @author Lorenz Meier * @author Benjamin Knecht + * @author Petri Tanskanen * */ @@ -56,7 +57,7 @@ public slots: void remove(); void setAutoContinue(int); void setCurrent(); - void setText(); + //void setText(); protected: virtual void changeEvent(QEvent *e); diff --git a/src/ui/WaypointView.ui b/src/ui/WaypointView.ui index 12796da951e2af6f75393f044c908c44055af618..32d847b8c1c8235cd3d76635b883113cff8d8eb5 100644 --- a/src/ui/WaypointView.ui +++ b/src/ui/WaypointView.ui @@ -155,7 +155,7 @@ QProgressBar::chunk#thrustBar { - + 2 @@ -179,9 +179,9 @@ QProgressBar::chunk#thrustBar { - + - Name + TextLabel diff --git a/src/ui/watchdog/WatchdogControl.cc b/src/ui/watchdog/WatchdogControl.cc index 18a627ba4f3b670ac5620aade0432885f91de248..fd3350b68e56928a830934b87c0ac1916ff56201 100644 --- a/src/ui/watchdog/WatchdogControl.cc +++ b/src/ui/watchdog/WatchdogControl.cc @@ -58,7 +58,7 @@ void WatchdogControl::updateWatchdog(int systemId, int watchdogId, unsigned int // start the timeout timer //watchdog.timeoutTimer_.reset(); - qDebug() << "WATCHDOG RECEIVED"; + //qDebug() << "WATCHDOG RECEIVED"; //qDebug() << "<-- received mavlink_watchdog_heartbeat_t " << msg->sysid << " / " << payload.watchdog_id << " / " << payload.process_count << std::endl; }