@@ -39,38 +39,53 @@ This file is part of the PIXHAWK project
...
@@ -39,38 +39,53 @@ This file is part of the PIXHAWK project
#include <mavlink.h>
#include <mavlink.h>
classUAS;
classUAS;
/**
* @brief Implementation of the MAVLINK waypoint protocol
*
* This class handles the communication with a waypoint manager on the MAV.
* All waypoints are stored in the QVector waypoints, modifications can be done with the WaypointList widget.
* Notice that currently the access to the internal waypoint storage is not guarded nor thread-safe. This works as long as no other widget alters the data.
*
* See http://qgroundcontrol.org/waypoint_protocol for more information about the protocol and the states.
*/
classUASWaypointManager:publicQObject
classUASWaypointManager:publicQObject
{
{
Q_OBJECT
Q_OBJECT
private:
private:
enumWaypointState{
enumWaypointState{
WP_IDLE=0,
WP_IDLE=0,///< Waiting for commands
WP_SENDLIST,
WP_SENDLIST,///< Initial state for sending waypoints to the MAV
WP_SENDLIST_SENDWPS,
WP_SENDLIST_SENDWPS,///< Sending waypoints
WP_GETLIST,
WP_GETLIST,///< Initial state for retrieving wayppoints from the MAV
WP_GETLIST_GETWPS
WP_GETLIST_GETWPS,///< Receiving waypoints
WP_CLEARLIST///< Clearing waypoint list on the MAV
};///< The possible states for the waypoint protocol
};///< The possible states for the waypoint protocol
public:
public:
UASWaypointManager(UAS&);
UASWaypointManager(UAS&);///< Standard constructor.
QVector<Waypoint*>&getWaypointList(void){returnwaypoints;}///< Returns a reference to the local waypoint list. Gives full access to the internal data structure - Subject to change: Public const access and friend access for the waypoint list widget.
private:
private:
voidsendWaypointRequest(quint16seq);
voidsendWaypointRequest(quint16seq);///< Requests a waypoint with sequence number seq
voidsendWaypoint(quint16seq);
voidsendWaypoint(quint16seq);///< Sends a waypoint with sequence number seq
voidsendWaypointAck(quint8type);///< Sends a waypoint ack
publicslots:
publicslots:
voidtimeout();
voidtimeout();///< Called by the timer if a response times out. Handles send retries.
voidclearWaypointList();
voidclearWaypointList();///< Sends the waypoint clear all message to the MAV
voidrequestWaypoints();
voidrequestWaypoints();///< Requests the MAV's current waypoint list
voidsendWaypoints();
voidsendWaypoints();///< Sends the local waypoint list to the MAV
signals:
signals:
voidwaypointUpdated(quint16,double,double,double,double,bool,bool,double,int);///< Adds a waypoint to the waypoint list widget
voidwaypointUpdated(quint16,double,double,double,double,bool,bool,double,int);///< Adds a waypoint to the waypoint list widget