|
|
|
@ -91,11 +91,6 @@ WaypointList::~WaypointList()
@@ -91,11 +91,6 @@ WaypointList::~WaypointList()
|
|
|
|
|
delete m_ui; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void WaypointList::updateStatusLabel(const QString &string) |
|
|
|
|
{ |
|
|
|
|
m_ui->statusLabel->setText(string); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void WaypointList::updateLocalPosition(UASInterface* uas, double x, double y, double z, quint64 usec) |
|
|
|
|
{ |
|
|
|
|
Q_UNUSED(uas); |
|
|
|
@ -129,17 +124,86 @@ void WaypointList::setUAS(UASInterface* uas)
@@ -129,17 +124,86 @@ void WaypointList::setUAS(UASInterface* uas)
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void WaypointList::waypointReached(quint16 waypointId) |
|
|
|
|
void WaypointList::saveWaypoints() |
|
|
|
|
{ |
|
|
|
|
if (uas) |
|
|
|
|
{ |
|
|
|
|
QString fileName = QFileDialog::getSaveFileName(this, tr("Save File"), "./waypoints.txt", tr("Waypoint File (*.txt)")); |
|
|
|
|
uas->getWaypointManager().localSaveWaypoints(fileName); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void WaypointList::loadWaypoints() |
|
|
|
|
{ |
|
|
|
|
if (uas) |
|
|
|
|
{ |
|
|
|
|
QString fileName = QFileDialog::getOpenFileName(this, tr("Load File"), ".", tr("Waypoint File (*.txt)")); |
|
|
|
|
uas->getWaypointManager().localLoadWaypoints(fileName); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void WaypointList::transmit() |
|
|
|
|
{ |
|
|
|
|
if (uas) |
|
|
|
|
{ |
|
|
|
|
uas->getWaypointManager().writeWaypoints(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void WaypointList::read() |
|
|
|
|
{ |
|
|
|
|
if (uas) |
|
|
|
|
{ |
|
|
|
|
uas->getWaypointManager().readWaypoints(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void WaypointList::add() |
|
|
|
|
{ |
|
|
|
|
if (uas) |
|
|
|
|
{ |
|
|
|
|
const QVector<Waypoint *> &waypoints = uas->getWaypointManager().getWaypointList(); |
|
|
|
|
if (waypoints.size() > 0) |
|
|
|
|
{ |
|
|
|
|
Waypoint *last = waypoints.at(waypoints.size()-1); |
|
|
|
|
Waypoint *wp = new Waypoint(0, last->getX(), last->getY(), last->getZ(), last->getYaw(), last->getAutoContinue(), false, last->getOrbit(), last->getHoldTime()); |
|
|
|
|
uas->getWaypointManager().localAddWaypoint(wp); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
Waypoint *wp = new Waypoint(0, 1.1, 1.1, -0.8, 0.0, true, true, 0.15, 2000); |
|
|
|
|
uas->getWaypointManager().localAddWaypoint(wp); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void WaypointList::addCurrentPositonWaypoint() |
|
|
|
|
{ |
|
|
|
|
if (this->uas) |
|
|
|
|
if (uas) |
|
|
|
|
{ |
|
|
|
|
updateStatusLabel(QString("Waypoint %1 reached.").arg(waypointId)); |
|
|
|
|
const QVector<Waypoint *> &waypoints = uas->getWaypointManager().getWaypointList(); |
|
|
|
|
if (waypoints.size() > 0) |
|
|
|
|
{ |
|
|
|
|
Waypoint *last = waypoints.at(waypoints.size()-1); |
|
|
|
|
Waypoint *wp = new Waypoint(0, (qRound(mavX*100))/100., (qRound(mavY*100))/100., (qRound(mavZ*100))/100., (qRound(mavYaw*100))/100., last->getAutoContinue(), false, last->getOrbit(), last->getHoldTime()); |
|
|
|
|
uas->getWaypointManager().localAddWaypoint(wp); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
Waypoint *wp = new Waypoint(0, (qRound(mavX*100))/100., (qRound(mavY*100))/100., (qRound(mavZ*100))/100., (qRound(mavYaw*100))/100., true, true, 0.15, 2000); |
|
|
|
|
uas->getWaypointManager().localAddWaypoint(wp); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void WaypointList::updateStatusLabel(const QString &string) |
|
|
|
|
{ |
|
|
|
|
m_ui->statusLabel->setText(string); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void WaypointList::changeCurrentWaypoint(quint16 seq) |
|
|
|
|
{ |
|
|
|
|
if (this->uas) |
|
|
|
|
if (uas) |
|
|
|
|
{ |
|
|
|
|
uas->getWaypointManager().setCurrentWaypoint(seq); |
|
|
|
|
} |
|
|
|
@ -147,7 +211,7 @@ void WaypointList::changeCurrentWaypoint(quint16 seq)
@@ -147,7 +211,7 @@ void WaypointList::changeCurrentWaypoint(quint16 seq)
|
|
|
|
|
|
|
|
|
|
void WaypointList::currentWaypointChanged(quint16 seq) |
|
|
|
|
{ |
|
|
|
|
if (this->uas) |
|
|
|
|
if (uas) |
|
|
|
|
{ |
|
|
|
|
const QVector<Waypoint *> &waypoints = uas->getWaypointManager().getWaypointList(); |
|
|
|
|
|
|
|
|
@ -172,7 +236,7 @@ void WaypointList::currentWaypointChanged(quint16 seq)
@@ -172,7 +236,7 @@ void WaypointList::currentWaypointChanged(quint16 seq)
|
|
|
|
|
|
|
|
|
|
void WaypointList::waypointListChanged() |
|
|
|
|
{ |
|
|
|
|
if (this->uas) |
|
|
|
|
if (uas) |
|
|
|
|
{ |
|
|
|
|
const QVector<Waypoint *> &waypoints = uas->getWaypointManager().getWaypointList(); |
|
|
|
|
|
|
|
|
@ -203,6 +267,7 @@ void WaypointList::waypointListChanged()
@@ -203,6 +267,7 @@ void WaypointList::waypointListChanged()
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// then add/update the views for each waypoint in the list
|
|
|
|
|
for(int i = 0; i < waypoints.size(); i++) |
|
|
|
|
{ |
|
|
|
|
Waypoint *wp = waypoints[i]; |
|
|
|
@ -224,61 +289,6 @@ void WaypointList::waypointListChanged()
@@ -224,61 +289,6 @@ void WaypointList::waypointListChanged()
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void WaypointList::read() |
|
|
|
|
{ |
|
|
|
|
if (uas) |
|
|
|
|
{ |
|
|
|
|
uas->getWaypointManager().readWaypoints(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void WaypointList::transmit() |
|
|
|
|
{ |
|
|
|
|
if (uas) |
|
|
|
|
{ |
|
|
|
|
uas->getWaypointManager().writeWaypoints(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void WaypointList::add() |
|
|
|
|
{ |
|
|
|
|
// Only add waypoints if UAS is present
|
|
|
|
|
if (uas) |
|
|
|
|
{ |
|
|
|
|
const QVector<Waypoint *> &waypoints = uas->getWaypointManager().getWaypointList(); |
|
|
|
|
if (waypoints.size() > 0) |
|
|
|
|
{ |
|
|
|
|
Waypoint *last = waypoints.at(waypoints.size()-1); |
|
|
|
|
Waypoint *wp = new Waypoint(0, last->getX(), last->getY(), last->getZ(), last->getYaw(), last->getAutoContinue(), false, last->getOrbit(), last->getHoldTime()); |
|
|
|
|
uas->getWaypointManager().localAddWaypoint(wp); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
Waypoint *wp = new Waypoint(0, 1.1, 1.1, -0.8, 0.0, true, true, 0.15, 2000); |
|
|
|
|
uas->getWaypointManager().localAddWaypoint(wp); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void WaypointList::addCurrentPositonWaypoint() |
|
|
|
|
{ |
|
|
|
|
if (uas) |
|
|
|
|
{ |
|
|
|
|
const QVector<Waypoint *> &waypoints = uas->getWaypointManager().getWaypointList(); |
|
|
|
|
if (waypoints.size() > 0) |
|
|
|
|
{ |
|
|
|
|
Waypoint *last = waypoints.at(waypoints.size()-1); |
|
|
|
|
Waypoint *wp = new Waypoint(0, (qRound(mavX*100))/100., (qRound(mavY*100))/100., (qRound(mavZ*100))/100., (qRound(mavYaw*100))/100., last->getAutoContinue(), false, last->getOrbit(), last->getHoldTime()); |
|
|
|
|
uas->getWaypointManager().localAddWaypoint(wp); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
Waypoint *wp = new Waypoint(0, (qRound(mavX*100))/100., (qRound(mavY*100))/100., (qRound(mavZ*100))/100., (qRound(mavYaw*100))/100., true, true, 0.15, 2000); |
|
|
|
|
uas->getWaypointManager().localAddWaypoint(wp); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void WaypointList::moveUp(Waypoint* wp) |
|
|
|
|
{ |
|
|
|
|
if (uas) |
|
|
|
@ -342,21 +352,3 @@ void WaypointList::changeEvent(QEvent *e)
@@ -342,21 +352,3 @@ void WaypointList::changeEvent(QEvent *e)
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void WaypointList::saveWaypoints() |
|
|
|
|
{ |
|
|
|
|
if (uas) |
|
|
|
|
{ |
|
|
|
|
QString fileName = QFileDialog::getSaveFileName(this, tr("Save File"), "./waypoints.txt", tr("Waypoint File (*.txt)")); |
|
|
|
|
uas->getWaypointManager().localSaveWaypoints(fileName); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void WaypointList::loadWaypoints() |
|
|
|
|
{ |
|
|
|
|
if (uas) |
|
|
|
|
{ |
|
|
|
|
QString fileName = QFileDialog::getOpenFileName(this, tr("Load File"), ".", tr("Waypoint File (*.txt)")); |
|
|
|
|
uas->getWaypointManager().localLoadWaypoints(fileName); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|