Commit 19f73a78 authored by pixhawk's avatar pixhawk

moved the local waypoint list into waypoint manager

parent 2438b8c8
......@@ -94,7 +94,7 @@ void UASWaypointManager::handleWaypoint(quint8 systemId, quint8 compId, mavlink_
if(wp->seq == current_wp_id)
{
//update the UI FIXME
emit waypointUpdated(uas.getUASID(), wp->seq, wp->x, wp->y, wp->z, wp->yaw, wp->autocontinue, wp->current, wp->orbit, wp->hold_time);
emit waypointUpdated(wp->seq, wp->x, wp->y, wp->z, wp->yaw, wp->autocontinue, wp->current, wp->orbit, wp->hold_time);
//get next waypoint
current_wp_id++;
......@@ -206,15 +206,15 @@ void UASWaypointManager::requestWaypoints()
}
}
void UASWaypointManager::sendWaypoints(const QVector<Waypoint*> &list)
void UASWaypointManager::sendWaypoints()
{
if (current_state == WP_IDLE)
{
if (list.count() > 0)
if (waypoints.count() > 0)
{
protocol_timer.start(PROTOCOL_TIMEOUT_MS);
current_count = list.count();
current_count = waypoints.count();
current_state = WP_SENDLIST;
current_wp_id = 0;
current_partner_systemid = uas.getUASID();
......@@ -233,7 +233,7 @@ void UASWaypointManager::sendWaypoints(const QVector<Waypoint*> &list)
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);
const Waypoint *cur_s = waypoints.at(i);
cur_d->autocontinue = cur_s->getAutoContinue();
cur_d->current = cur_s->getCurrent();
......
......@@ -60,6 +60,8 @@ public:
void handleWaypointReached(quint8 systemId, quint8 compId, mavlink_waypoint_reached_t *wpr);
void handleWaypointSetCurrent(quint8 systemId, quint8 compId, mavlink_waypoint_set_current_t *wpr);
QVector<Waypoint *> &getWaypointList(void) { return waypoints; }
private:
void sendWaypointRequest(quint16 seq);
void sendWaypoint(quint16 seq);
......@@ -68,12 +70,12 @@ public slots:
void timeout();
void clearWaypointList();
void requestWaypoints();
void sendWaypoints(const QVector<Waypoint *> &list);
void sendWaypoints();
signals:
void waypointUpdated(int,quint16,double,double,double,double,bool,bool,double,int); ///< Adds a waypoint to the waypoint list widget
void currentWaypointChanged(quint16); ///< emits the new current waypoint sequence number
void updateStatusString(const QString &); ///< emits the current status string
void waypointUpdated(quint16,double,double,double,double,bool,bool,double,int); ///< Adds a waypoint to the waypoint list widget
void currentWaypointChanged(quint16); ///< emits the new current waypoint sequence number
void updateStatusString(const QString &); ///< emits the current status string
private:
UAS &uas; ///< Reference to the corresponding UAS
......@@ -83,6 +85,7 @@ private:
quint8 current_partner_systemid; ///< The current protocol communication target system
quint8 current_partner_compid; ///< The current protocol communication target component
QVector<Waypoint *> waypoints; ///< local waypoint list
QVector<mavlink_waypoint_t *> waypoint_buffer; ///< communication buffer for waypoints
QTimer protocol_timer; ///< Timer to catch timeouts
};
......
This diff is collapsed.
......@@ -73,24 +73,21 @@ public slots:
void updateStatusLabel(const QString &string);
void currentWaypointChanged(quint16 seq);
//To be moved to UASWaypointManager (?)
void setWaypoint(int uasId, quint16 id, double x, double y, double z, double yaw, bool autocontinue, bool current, double orbit, int holdTime);
void setWaypoint(quint16 id, double x, double y, double z, double yaw, bool autocontinue, bool current, double orbit, int holdTime);
void addWaypoint(Waypoint* wp);
void removeWaypoint(Waypoint* wp);
void waypointReached(UASInterface* uas, quint16 waypointId);
void waypointReached(quint16 waypointId);
void updateLocalPosition(UASInterface*, double x, double y, double z, quint64 usec);
void updateAttitude(UASInterface*, double roll, double pitch, double yaw, quint64 usec);
signals:
void sendWaypoints(const QVector<Waypoint*> &);
void sendWaypoints();
void requestWaypoints();
void clearWaypointList();
protected:
virtual void changeEvent(QEvent *e);
QVector<Waypoint*> waypoints;
QMap<Waypoint*, WaypointView*> wpViews;
QVBoxLayout* listLayout;
UASInterface* uas;
......
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