Commit 2dea8976 authored by pixhawk's avatar pixhawk

Merge branch 'master' of pixhawk.ethz.ch:qgroundcontrol

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