Commit ea098a0d authored by pixhawk's avatar pixhawk

Added a lot of "

view only" functions and renamed some of the old functions. This version compiles, but has a lot of bugs.
parent 26fc0ce0
This diff is collapsed.
......@@ -79,15 +79,19 @@ public:
/** @name Remote operations */
/*@{*/
void clearWaypointList(); ///< Sends the waypoint clear all message to the MAV
void readWaypoints(); ///< Requests the MAV's current waypoint list
void readWaypoints(bool read_to_edit=false); ///< Requests the MAV's current waypoint list.
void writeWaypoints(); ///< Sends the waypoint list to the MAV
int setCurrentWaypoint(quint16 seq); ///< Changes the current waypoint and sends the sequence number of the waypoint that should get the new target waypoint to the UAS
/*@}*/
/** @name Waypoint list operations */
/*@{*/
const QVector<Waypoint *> &getWaypointList(void) {
return waypoints; ///< Returns a const reference to the waypoint list.
const QVector<Waypoint *> &getWaypointEditableList(void) {
return waypointsEditable; ///< Returns a const reference to the waypoint list.
}
const QVector<Waypoint *> &getWaypointViewOnlyList(void) {
return waypointsViewOnly; ///< Returns a const reference to the waypoint list.
}
const QVector<Waypoint *> getGlobalFrameWaypointList(); ///< Returns a global waypoint list
const QVector<Waypoint *> getGlobalFrameAndNavTypeWaypointList(); ///< Returns a global waypoint list containing only waypoints suitable for navigation. Actions and other mission items are filtered out.
......@@ -125,6 +129,7 @@ public slots:
/** @name Waypoint list operations */
/*@{*/
void addWaypointEditable(Waypoint *wp, bool enforceFirstActive=true); ///< adds a new waypoint to the end of the editable list and changes its sequence number accordingly
void addWaypointViewOnly(Waypoint *wp); ///< adds a new waypoint to the end of the view-only list and changes its sequence number accordingly
Waypoint* createWaypoint(bool enforceFirstActive=true); ///< Creates a waypoint
int removeWaypoint(quint16 seq); ///< locally remove the specified waypoint from the storage
void moveWaypoint(quint16 cur_seq, quint16 new_seq); ///< locally move a waypoint from its current position cur_seq to a new position new_seq
......@@ -140,6 +145,9 @@ signals:
void waypointEditableListChanged(void); ///< emits signal that the list of editable waypoints has been changed
void waypointEditableListChanged(int uasid); ///< emits signal that the list of editable waypoints has been changed
void waypointEditableChanged(int uasid, Waypoint* wp); ///< emits signal that a single editable waypoint has been changed
void waypointViewOnlyListChanged(void); ///< emits signal that the list of editable waypoints has been changed
void waypointViewOnlyListChanged(int uasid); ///< emits signal that the list of editable waypoints has been changed
void waypointViewOnlyChanged(int uasid, Waypoint* wp); ///< emits signal that a single editable waypoint has been changed
void currentWaypointChanged(quint16); ///< emits the new current waypoint sequence number
void updateStatusString(const QString &); ///< emits the current status string
void waypointDistanceChanged(double distance); ///< Distance to next waypoint changed (in meters)
......@@ -155,9 +163,11 @@ private:
WaypointState current_state; ///< The current protocol state
quint8 current_partner_systemid; ///< The current protocol communication target system
quint8 current_partner_compid; ///< The current protocol communication target component
bool read_to_edit; ///< If true, after readWaypoints() incoming waypoints will be copied both to "edit"-tab and "view"-tab. Otherwise, only to "view"-tab.
QVector<Waypoint *> waypoints; ///< local waypoint list (main storage)
Waypoint* currentWaypoint; ///< The currently used waypoint
QVector<Waypoint *> waypointsViewOnly; ///< local copy of current waypoint list on MAV
QVector<Waypoint *> waypointsEditable; ///< local editable waypoint list
Waypoint* currentWaypointEditable; ///< The currently used waypoint
QVector<mavlink_mission_item_t *> waypoint_buffer; ///< buffer for waypoints during communication
QTimer protocol_timer; ///< Timer to catch timeouts
};
......
......@@ -954,7 +954,7 @@ void HSIDisplay::drawWaypoints(QPainter& painter)
{
if (uas)
{
const QVector<Waypoint*>& list = uas->getWaypointManager()->getWaypointList();
const QVector<Waypoint*>& list = uas->getWaypointManager()->getWaypointEditableList();
QColor color;
painter.setBrush(Qt::NoBrush);
......
This diff is collapsed.
......@@ -69,10 +69,14 @@ public slots:
void loadWaypoints();
/** @brief Transmit the local waypoint list to the UAS */
void transmit();
/** @brief Read the remote waypoint list */
/** @brief Read the remote waypoint list to both tabs */
void read();
/** @brief Add a waypoint */
void add();
/** @brief Read the remote waypoint list to "view"-tab only*/
void refresh();
/** @brief Add a waypoint to "edit"-tab */
void addEditable();
/** @brief Add a waypoint to "view"-tab */
void addViewOnly();
/** @brief Add a waypoint at the current MAV position */
void addCurrentPositionWaypoint();
/** @brief Add a waypoint by mouse click over the map */
......@@ -86,8 +90,10 @@ public slots:
void currentWaypointChanged(quint16 seq);
/** @brief The waypoint manager informs that one waypoint was changed */
void updateWaypoint(int uas, Waypoint* wp);
/** @brief The waypoint manager informs that the waypoint list was changed */
/** @brief The waypoint manager informs that the editable waypoint list was changed */
void waypointEditableListChanged(void);
/** @brief The waypoint manager informs that the waypoint list on the MAV was changed */
void waypointViewOnlyListChanged(void);
// /** @brief The MapWidget informs that a waypoint global was changed on the map */
// void waypointGlobalChanged(const QPointF coordinate, const int indexWP);
......@@ -115,8 +121,10 @@ protected:
virtual void changeEvent(QEvent *e);
protected:
QMap<Waypoint*, WaypointEditableView*> wpViews;
QVBoxLayout* listLayout;
QMap<Waypoint*, WaypointEditableView*> wpEditableViews;
QMap<Waypoint*, WaypointViewOnlyView*> wpViewOnlyViews;
QVBoxLayout* viewOnlyListLayout;
QVBoxLayout* editableListLayout;
UASInterface* uas;
double mavX;
double mavY;
......
......@@ -294,7 +294,7 @@ Pixhawk3DWidget::setWaypoint(void)
{
if (uas) {
const QVector<Waypoint *> waypoints =
uas->getWaypointManager()->getWaypointList();
uas->getWaypointManager()->getWaypointEditableList();
Waypoint* waypoint = waypoints.at(selectedWpIndex);
if (frame == MAV_FRAME_GLOBAL) {
......@@ -341,7 +341,7 @@ Pixhawk3DWidget::setWaypointAltitude(void)
if (uas) {
bool ok;
const QVector<Waypoint *> waypoints =
uas->getWaypointManager()->getWaypointList();
uas->getWaypointManager()->getWaypointEditableList();
Waypoint* waypoint = waypoints.at(selectedWpIndex);
double altitude = waypoint->getZ();
......@@ -367,7 +367,7 @@ Pixhawk3DWidget::clearAllWaypoints(void)
{
if (uas) {
const QVector<Waypoint *> waypoints =
uas->getWaypointManager()->getWaypointList();
uas->getWaypointManager()->getWaypointEditableList();
for (int i = waypoints.size() - 1; i >= 0; --i) {
uas->getWaypointManager()->removeWaypoint(i);
}
......
......@@ -73,7 +73,7 @@ WaypointGroupNode::update(MAV_FRAME frame, UASInterface *uas)
removeChild(0, getNumChildren());
}
const QVector<Waypoint *>& list = uas->getWaypointManager()->getWaypointList();
const QVector<Waypoint *>& list = uas->getWaypointManager()->getWaypointEditableList();
for (int i = 0; i < list.size(); i++) {
Waypoint* wp = list.at(i);
......
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