From 0303d34627e58a0a1a79cb38acda26f31e1d4069 Mon Sep 17 00:00:00 2001 From: pixhawk Date: Wed, 16 Jun 2010 17:32:03 +0200 Subject: [PATCH] worked on waypoints --- src/uas/UAS.cc | 1 + src/uas/UASWaypointManager.cc | 4 +++- src/uas/UASWaypointManager.h | 2 +- src/ui/WaypointList.cc | 13 ++++--------- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/uas/UAS.cc b/src/uas/UAS.cc index deadfb708..19b168616 100644 --- a/src/uas/UAS.cc +++ b/src/uas/UAS.cc @@ -428,6 +428,7 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) { mavlink_waypoint_t wp; mavlink_msg_waypoint_decode(&message, &wp); + qDebug() << "got waypoint (" << wp.seq << ") from ID " << message.sysid << " x=" << wp.x << " y=" << wp.y << " z=" << wp.z; if(wp.target_system == mavlink->getSystemId() && wp.target_component == mavlink->getComponentId()) { waypointManager.handleWaypoint(message.sysid, message.compid, &wp); diff --git a/src/uas/UASWaypointManager.cc b/src/uas/UASWaypointManager.cc index ec5db6b7b..8784eb39d 100644 --- a/src/uas/UASWaypointManager.cc +++ b/src/uas/UASWaypointManager.cc @@ -37,7 +37,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() << "got waypoint (" << wp->seq << ") from ID " << systemId; + qDebug() << "got waypoint (" << wp->seq << ") from ID " << systemId << " x=" << wp->x << " y=" << wp->y << " z=" << wp->z; if(wp->seq == current_wp_id) { @@ -170,6 +170,8 @@ void UASWaypointManager::sendWaypoints(const QVector &list) cur_d->autocontinue = cur_s->getAutoContinue(); cur_d->current = cur_s->getCurrent(); + cur_d->orbit = 0.1f; //FIXME + cur_d->type = 1; //FIXME cur_d->seq = i; cur_d->x = cur_s->getX(); cur_d->y = cur_s->getY(); diff --git a/src/uas/UASWaypointManager.h b/src/uas/UASWaypointManager.h index cced749d8..b5cad1706 100644 --- a/src/uas/UASWaypointManager.h +++ b/src/uas/UASWaypointManager.h @@ -40,7 +40,7 @@ public slots: signals: void waypointUpdated(int,quint16,double,double,double,double,bool,bool); ///< Adds a waypoint to the waypoint list widget - void updateStatusString(const QString &); ///< updates the current status string + void updateStatusString(const QString &); ///< updates the current status string private: UAS &uas; ///< Reference to the corresponding UAS diff --git a/src/ui/WaypointList.cc b/src/ui/WaypointList.cc index 5b608f028..5a7d4209e 100644 --- a/src/ui/WaypointList.cc +++ b/src/ui/WaypointList.cc @@ -160,6 +160,7 @@ void WaypointList::read() removeWaypoint(waypoints[0]); } + redrawList(); emit requestWaypoints(); } @@ -189,13 +190,6 @@ void WaypointList::add() void WaypointList::addWaypoint(Waypoint* wp) { - if (waypoints.contains(wp)) - { - removeWaypoint(wp); - } - - waypoints.insert(wp->getId(), wp); - if (!wpViews.contains(wp)) { WaypointView* wpview = new WaypointView(wp, this); @@ -205,7 +199,7 @@ void WaypointList::addWaypoint(Waypoint* wp) connect(wpview, SIGNAL(moveUpWaypoint(Waypoint*)), this, SLOT(moveUp(Waypoint*))); connect(wpview, SIGNAL(removeWaypoint(Waypoint*)), this, SLOT(removeWaypoint(Waypoint*))); connect(wpview, SIGNAL(setCurrentWaypoint(Waypoint*)), this, SLOT(setCurrentWaypoint(Waypoint*))); - connect(wpview, SIGNAL(waypointUpdated(Waypoint*)), this, SIGNAL(waypointChanged(Waypoint*))); + //connect(wpview, SIGNAL(waypointUpdated(Waypoint*)), this, SIGNAL(waypointChanged(Waypoint*))); } } @@ -280,7 +274,8 @@ void WaypointList::moveDown(Waypoint* wp) void WaypointList::removeWaypoint(Waypoint* wp) { // Delete from list - if (wp != NULL){ + if (wp != NULL) + { waypoints.remove(wp->getId()); for(int i = wp->getId(); i < waypoints.size(); i++) { -- 2.22.0