From ea2fb98b4b7c1cc1a04b004efbd838750df497a0 Mon Sep 17 00:00:00 2001 From: pixhawk Date: Fri, 4 Jun 2010 16:24:50 +0200 Subject: [PATCH] waypoint changes --- src/uas/UAS.cc | 14 ++++++++++++-- src/uas/UAS.h | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/uas/UAS.cc b/src/uas/UAS.cc index c9d7fda8b..03d130b72 100644 --- a/src/uas/UAS.cc +++ b/src/uas/UAS.cc @@ -393,11 +393,20 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) case MAVLINK_MSG_ID_DEBUG: emit valueChanged(uasId, QString("debug ") + QString::number(mavlink_msg_debug_get_ind(&message)), mavlink_msg_debug_get_value(&message), MG::TIME::getGroundTimeNow()); break; + + case MAVLINK_MSG_ID_WAYPOINT_COUNT: + { + mavlink_waypoint_count_t wpc; + mavlink_msg_waypoint_count_decode(&message, &wpc); + waypointManager.handleWaypointCount(message.sysid, message.compid, wpc.count); + } + break; + case MAVLINK_MSG_ID_WAYPOINT: { mavlink_waypoint_t wp; mavlink_msg_waypoint_decode(&message, &wp); -// emit waypointUpdated(uasId, wp.id, wp.x, wp.y, wp.z, wp.yaw, wp.autocontinue, wp.active); + waypointManager.handleWaypoint(message.sysid, message.compid, &wp); } break; case MAVLINK_MSG_ID_WAYPOINT_REACHED: @@ -952,7 +961,8 @@ void UAS::receiveButton(int buttonIndex) // mavlink_msg_waypoint_request_list_pack(mavlink->getSystemId(), mavlink->getComponentId(), &msg, uasId, 25); // // Send message twice to increase chance of reception // sendMessage(msg); -// qDebug() << "UAS Request WPs"; + waypointManager.requestWaypoints(); + qDebug() << "UAS Request WPs"; } void UAS::setWaypoint(Waypoint* wp) diff --git a/src/uas/UAS.h b/src/uas/UAS.h index a7f179879..5dd1c37f4 100644 --- a/src/uas/UAS.h +++ b/src/uas/UAS.h @@ -79,6 +79,7 @@ public: /** @brief Get the links associated with this robot */ QList* getLinks(); +friend class UASWaypointManager; protected: int uasId; ///< Unique system ID int type; ///< UAS type (from type enum) -- 2.22.0