|
|
|
@ -45,8 +45,6 @@ WaypointList::WaypointList(QWidget *parent, UASInterface* uas) :
@@ -45,8 +45,6 @@ WaypointList::WaypointList(QWidget *parent, UASInterface* uas) :
|
|
|
|
|
{ |
|
|
|
|
m_ui->setupUi(this); |
|
|
|
|
|
|
|
|
|
transmitDelay = new QTimer(this); |
|
|
|
|
|
|
|
|
|
listLayout = new QVBoxLayout(m_ui->listWidget); |
|
|
|
|
listLayout->setSpacing(6); |
|
|
|
|
listLayout->setMargin(0); |
|
|
|
@ -73,7 +71,6 @@ WaypointList::WaypointList(QWidget *parent, UASInterface* uas) :
@@ -73,7 +71,6 @@ WaypointList::WaypointList(QWidget *parent, UASInterface* uas) :
|
|
|
|
|
connect(m_ui->loadButton, SIGNAL(clicked()), this, SLOT(loadWaypoints())); |
|
|
|
|
|
|
|
|
|
connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(setUAS(UASInterface*))); |
|
|
|
|
connect(transmitDelay, SIGNAL(timeout()), this, SLOT(reenableTransmit())); |
|
|
|
|
|
|
|
|
|
// STATUS LABEL
|
|
|
|
|
updateStatusLabel(""); |
|
|
|
@ -97,14 +94,14 @@ void WaypointList::setUAS(UASInterface* uas)
@@ -97,14 +94,14 @@ void WaypointList::setUAS(UASInterface* uas)
|
|
|
|
|
if (this->uas == NULL && uas != NULL) |
|
|
|
|
{ |
|
|
|
|
this->uas = uas; |
|
|
|
|
|
|
|
|
|
connect(&uas->getWaypointManager(), SIGNAL(updateStatusString(const QString &)), this, SLOT(updateStatusLabel(const QString &))); |
|
|
|
|
connect(&uas->getWaypointManager(), SIGNAL(waypointUpdated(int,quint16,double,double,double,double,bool,bool)), this, SLOT(setWaypoint(int,quint16,double,double,double,double,bool,bool))); |
|
|
|
|
//connect(this, SIGNAL(waypointChanged(Waypoint*)), &uas->getWaypointManager(), SLOT(setWaypoint(Waypoint*)));
|
|
|
|
|
//connect(this, SIGNAL(currentWaypointChanged(int)), &uas->getWaypointManager(), SLOT(setWaypointActive(quint16)));
|
|
|
|
|
connect(&uas->getWaypointManager(), SIGNAL(currentWaypointChanged(quint16)), this, SLOT(currentWaypointChanged(quint16))); |
|
|
|
|
|
|
|
|
|
connect(this, SIGNAL(sendWaypoints(const QVector<Waypoint*> &)), &uas->getWaypointManager(), SLOT(sendWaypoints(const QVector<Waypoint*> &))); |
|
|
|
|
connect(this, SIGNAL(requestWaypoints()), &uas->getWaypointManager(), SLOT(requestWaypoints())); |
|
|
|
|
connect(this, SIGNAL(clearWaypointList()), &uas->getWaypointManager(), SLOT(clearWaypointList())); |
|
|
|
|
|
|
|
|
|
connect(&uas->getWaypointManager(), SIGNAL(updateStatusString(const QString &)), this, SLOT(updateStatusLabel(const QString &))); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -112,7 +109,6 @@ void WaypointList::setWaypoint(int uasId, quint16 id, double x, double y, double
@@ -112,7 +109,6 @@ void WaypointList::setWaypoint(int uasId, quint16 id, double x, double y, double
|
|
|
|
|
{ |
|
|
|
|
if (uasId == this->uas->getUASID()) |
|
|
|
|
{ |
|
|
|
|
transmitDelay->start(1000); |
|
|
|
|
Waypoint* wp = new Waypoint(id, x, y, z, yaw, autocontinue, current); |
|
|
|
|
addWaypoint(wp); |
|
|
|
|
} |
|
|
|
@ -123,34 +119,30 @@ void WaypointList::waypointReached(UASInterface* uas, quint16 waypointId)
@@ -123,34 +119,30 @@ void WaypointList::waypointReached(UASInterface* uas, quint16 waypointId)
|
|
|
|
|
Q_UNUSED(uas); |
|
|
|
|
qDebug() << "Waypoint reached: " << waypointId; |
|
|
|
|
|
|
|
|
|
/*if (waypoints.size() > waypointId)
|
|
|
|
|
{ |
|
|
|
|
if (waypoints[waypointId]->autocontinue == true) |
|
|
|
|
{ |
|
|
|
|
updateStatusLabel(QString("Waypoint %1 reached.").arg(waypointId)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for(int i = 0; i < waypoints.size(); i++) |
|
|
|
|
void WaypointList::currentWaypointChanged(quint16 seq) |
|
|
|
|
{ |
|
|
|
|
if (seq < waypoints.size()) |
|
|
|
|
{ |
|
|
|
|
if (i == waypointId+1) |
|
|
|
|
for(int i = 0; i < waypoints.size(); i++) |
|
|
|
|
{ |
|
|
|
|
waypoints[i]->current = true; |
|
|
|
|
WaypointView* widget = wpViews.find(waypoints[i]).value(); |
|
|
|
|
widget->setCurrent(); |
|
|
|
|
|
|
|
|
|
if (waypoints[i]->getId() == seq) |
|
|
|
|
{ |
|
|
|
|
waypoints[i]->setCurrent(true); |
|
|
|
|
widget->setCurrent(true); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
if (waypoints[i]->current) |
|
|
|
|
{ |
|
|
|
|
waypoints[i]->current = false; |
|
|
|
|
WaypointView* widget = wpViews.find(waypoints[i]).value(); |
|
|
|
|
widget->removeCurrentCheck(); |
|
|
|
|
} |
|
|
|
|
waypoints[i]->setCurrent(false); |
|
|
|
|
widget->setCurrent(false); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
redrawList(); |
|
|
|
|
|
|
|
|
|
qDebug() << "NEW WAYPOINT SET"; |
|
|
|
|
} |
|
|
|
|
}*/ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void WaypointList::read() |
|
|
|
@ -160,16 +152,13 @@ void WaypointList::read()
@@ -160,16 +152,13 @@ void WaypointList::read()
|
|
|
|
|
removeWaypoint(waypoints[0]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
redrawList(); |
|
|
|
|
emit requestWaypoints(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void WaypointList::transmit() |
|
|
|
|
{ |
|
|
|
|
transmitDelay->start(1000); |
|
|
|
|
m_ui->transmitButton->setEnabled(false); |
|
|
|
|
|
|
|
|
|
emit sendWaypoints(waypoints); |
|
|
|
|
//emit requestWaypoints(); FIXME
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void WaypointList::add() |
|
|
|
@ -179,17 +168,18 @@ void WaypointList::add()
@@ -179,17 +168,18 @@ void WaypointList::add()
|
|
|
|
|
{ |
|
|
|
|
if (waypoints.size() > 0) |
|
|
|
|
{ |
|
|
|
|
addWaypoint(new Waypoint(waypoints.size(), 0.0, 0.1, -0.5, 0.0, false, false)); |
|
|
|
|
addWaypoint(new Waypoint(waypoints.size(), 0.0, 0.0, -0.0, 0.0, false, false)); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
addWaypoint(new Waypoint(waypoints.size(), 0.0, 0.0, -0.5, 360.0, false, true)); |
|
|
|
|
addWaypoint(new Waypoint(waypoints.size(), 0.0, 0.0, -0.0, 0.0, false, true)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void WaypointList::addWaypoint(Waypoint* wp) |
|
|
|
|
{ |
|
|
|
|
waypoints.push_back(wp); |
|
|
|
|
if (!wpViews.contains(wp)) |
|
|
|
|
{ |
|
|
|
|
WaypointView* wpview = new WaypointView(wp, this); |
|
|
|
@ -198,8 +188,7 @@ void WaypointList::addWaypoint(Waypoint* wp)
@@ -198,8 +188,7 @@ void WaypointList::addWaypoint(Waypoint* wp)
|
|
|
|
|
connect(wpview, SIGNAL(moveDownWaypoint(Waypoint*)), this, SLOT(moveDown(Waypoint*))); |
|
|
|
|
connect(wpview, SIGNAL(moveUpWaypoint(Waypoint*)), this, SLOT(moveUp(Waypoint*))); |
|
|
|
|
connect(wpview, SIGNAL(removeWaypoint(Waypoint*)), this, SLOT(removeWaypoint(Waypoint*))); |
|
|
|
|
connect(wpview, SIGNAL(setCurrentWaypoint(Waypoint*)), this, SLOT(setCurrentWaypoint(Waypoint*))); |
|
|
|
|
//connect(wpview, SIGNAL(waypointUpdated(Waypoint*)), this, SIGNAL(waypointChanged(Waypoint*)));
|
|
|
|
|
connect(wpview, SIGNAL(currentWaypointChanged(quint16)), this, SLOT(currentWaypointChanged(quint16))); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -291,28 +280,6 @@ void WaypointList::removeWaypoint(Waypoint* wp)
@@ -291,28 +280,6 @@ void WaypointList::removeWaypoint(Waypoint* wp)
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void WaypointList::setCurrentWaypoint(Waypoint* wp) |
|
|
|
|
{ |
|
|
|
|
for(int i = 0; i < waypoints.size(); i++) |
|
|
|
|
{ |
|
|
|
|
if (waypoints[i] == wp) |
|
|
|
|
{ |
|
|
|
|
waypoints[i]->setCurrent(true); |
|
|
|
|
// Retransmit waypoint
|
|
|
|
|
//uas->getWaypointManager().setWaypointActive(i);
|
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
if (waypoints[i]->getCurrent()) |
|
|
|
|
{ |
|
|
|
|
waypoints[i]->setCurrent(false); |
|
|
|
|
WaypointView* widget = wpViews.find(waypoints[i]).value(); |
|
|
|
|
widget->removeCurrentCheck(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void WaypointList::changeEvent(QEvent *e) |
|
|
|
|
{ |
|
|
|
|
switch (e->type()) { |
|
|
|
@ -324,11 +291,6 @@ void WaypointList::changeEvent(QEvent *e)
@@ -324,11 +291,6 @@ void WaypointList::changeEvent(QEvent *e)
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void WaypointList::reenableTransmit() |
|
|
|
|
{ |
|
|
|
|
m_ui->transmitButton->setEnabled(true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void WaypointList::saveWaypoints() |
|
|
|
|
{ |
|
|
|
|
QString fileName = QFileDialog::getSaveFileName(this, tr("Save File"), "./waypoints.txt", tr("Waypoint File (*.txt)")); |
|
|
|
|