Commit d1eac7fe authored by Valentin Platzgummer's avatar Valentin Platzgummer

wima planer and wima controller edited

parent a0e0f804
......@@ -457,6 +457,7 @@ HEADERS += \
src/Wima/StateMachine.h \
src/Wima/WaypointManager/AreaInterface.h \
src/Wima/WaypointManager/DefaultManager.h \
src/Wima/WaypointManager/EmptyManager.h \
src/Wima/WaypointManager/GenericWaypointManager.h \
src/Wima/WaypointManager/RTLManager.h \
src/Wima/WaypointManager/Settings.h \
......@@ -519,6 +520,7 @@ SOURCES += \
src/Wima/StateMachine.cpp \
src/Wima/WaypointManager/AreaInterface.cpp \
src/Wima/WaypointManager/DefaultManager.cpp \
src/Wima/WaypointManager/EmptyManager.cpp \
src/Wima/WaypointManager/GenericWaypointManager.cpp \
src/Wima/WaypointManager/RTLManager.cpp \
src/Wima/WaypointManager/Settings.cpp \
......
......@@ -232,6 +232,11 @@
<file alias="QGroundControl/Controls/CircularSurveyMapVisual.qml">src/WimaView/CircularSurveyMapVisual.qml</file>
<file alias="QGroundControl/FlightDisplay/SmallValue.qml">src/FlightDisplay/SmallValue.qml</file>
<file alias="QGroundControl/Controls/ProgressIndicator.qml">src/WimaView/ProgressIndicator.qml</file>
<file alias="QGroundControl/Controls/WimaServiceAreaDataVisual.qml">src/WimaView/WimaServiceAreaDataVisual.qml</file>
<file alias="QGroundControl/Controls/WimaCorridorDataVisual.qml">src/WimaView/WimaCorridorDataVisual.qml</file>
<file alias="QGroundControl/Controls/WimaJoinedAreaDataVisual.qml">src/WimaView/WimaJoinedAreaDataVisual.qml</file>
<file alias="QGroundControl/Controls/WimaAreaNoVisual.qml">src/Wima/Snake/WimaAreaNoVisual.qml</file>
<file alias="QGroundControl/Controls/WimaMeasurementAreaDataVisual.qml">src/WimaView/WimaMeasurementAreaDataVisual.qml</file>
</qresource>
<qresource prefix="/json">
<file alias="APMMavlinkStreamRate.SettingsGroup.json">src/Settings/APMMavlinkStreamRate.SettingsGroup.json</file>
......
......@@ -59,8 +59,6 @@ FlightMap {
property bool _keepVehicleCentered: _mainIsMap ? false : true
property bool _wimaEnabled: wimaController.enableWimaController.value
property bool _showAllWimaItems: wimaController.showAllMissionItems.value
property bool _showCurrentWimaItems: wimaController.showCurrentMissionItems.value
function updateAirspace(reset) {
if(_airspaceEnabled) {
......@@ -200,109 +198,29 @@ FlightMap {
}
// Add wima Areas to the Map
MapItemView {
Repeater {
property bool _enableWima: wimaController.enableWimaController.value
model: _enableWima ? wimaController.visualItems : 0
delegate: MapPolygon{
path: object.path;
border.color: "black"
color: object.type === "WimaJoinedAreaData" ? "gray"
: object.type === "WimaServiceAreaData" ? "yellow"
: object.type === "WimaMeasurementAreaData" ? "green"
: "transparent"
opacity: 0.25
z: 0
delegate: WimaMapVisual{
map: flightMap
qgcView: flightMap.qgcView
visible: true
}
}
// Add mission items generated by wima planer to the map
// Add missionItems generated by wima planer to the map
// all Items
WimaPlanMapItems {
map: flightMap
largeMapView: _mainIsMap
missionItems: wimaController.missionItems
path: wimaController.waypointPath
showItems: _wimaEnabled && _showAllWimaItems
showItems: _wimaEnabled
zOrderWP: QGroundControl.zOrderWimaAllWaypointIndicators
zOrderLines: QGroundControl.zOrderWimaAllWaypointLines
color: "gray"
}
// current Items
WimaPlanMapItems {
map: flightMap
largeMapView: _mainIsMap
missionItems: wimaController.currentMissionItems
path: wimaController.currentWaypointPath
showItems: _wimaEnabled && _showCurrentWimaItems
zOrderWP: QGroundControl.zOrderWimaCurrentWaypointIndicators
zOrderLines: QGroundControl.zOrderWimaCurrentWaypointLines
color: "green"
}
// // Add Snake tile center points to the map
// MapItemView {
// id:progressView
// property bool _enable: wimaController.enableWimaController.value
// && wimaController.enableSnake.value
// property bool valid: wimaController.snakeTileCenterPoints.length
// === wimaController.nemoProgress.length
// model: _enable ? wimaController.snakeTileCenterPoints : 0
// delegate: ProgressIndicator{
// coordinate: modelData
// currentValue: getProgress()
// z: 1
// function getProgress() {
// var progress = 0
// if (progressView.valid){
// progress = wimaController.nemoProgress[index]
// }
// if (progress < 0)
// progress = 0
// if (progress > 100)
// progress = 100
// return progress
// }
// }
// }
// Add Snake tiles to the map
MapItemView {
id: tileView
property bool _enable: wimaController.enableWimaController.value
property bool valid: wimaController.snakeTileCenterPoints.length
=== wimaController.nemoProgress.length
model: _enable ? wimaController.snakeTiles : 0
delegate: MapPolygon{
path: object.path;
border.color: "black"
border.width: 1
color: getColor()
opacity: 0.6
z: 2
function getColor() {
var progress = 0
if (tileView.valid){
progress = wimaController.nemoProgress[index]
}
if (progress < 25)
return "transparent"
if (progress < 50)
return "orange"
if (progress < 75)
return "yellow"
if (progress < 100)
return "greenyellow"
return "limegreen"
}
}
}
// Add trajectory points to the map
MapItemView {
model: _mainIsMap ? _activeVehicle ? _activeVehicle.trajectoryPoints : 0 : 0
......
......@@ -171,11 +171,11 @@ Item {
id: mainColumn
spacing: ScreenTools.defaultFontPixelHeight * 0.3
SectionHeader{
id: vehicleHeader
text: qsTr("Vehicle")
}
GridLayout {
columns: 2
rowSpacing: ScreenTools.defaultFontPixelHeight * 0.5
......@@ -183,6 +183,17 @@ Item {
visible: vehicleHeader.checked
width: parent.width
QGCButton {
id: buttonUpload
text: qsTr("Upload")
onClicked: {
if (!planMasterController.offline) {
wimaController.upload()
}
}
Layout.fillWidth: true
}
QGCButton {
id: buttonRemoveFromVehicle
text: qsTr("Remove")
......@@ -194,6 +205,7 @@ Item {
id: buttonSmartRTL
text: qsTr("Smart RTL")
onClicked: wimaController.requestSmartRTL();
Layout.columnSpan: 2
Layout.fillWidth: true
}
......@@ -204,7 +216,32 @@ Item {
Layout.columnSpan: 2
Layout.fillWidth: true
}
}
GridLayout {
columns: 2
rowSpacing: ScreenTools.defaultFontPixelHeight * 0.5
columnSpacing: ScreenTools.defaultFontPixelHeight * 0.5
visible: vehicleHeader.checked
width: parent.width
QGCLabel {
text: qsTr("Speed")
Layout.fillWidth: true
}
FactTextField {
fact: wimaController.flightSpeed
Layout.fillWidth: true
}
QGCLabel {
text: qsTr("Altitude")
Layout.fillWidth: true
}
FactTextField {
fact: wimaController.altitude
Layout.fillWidth: true
}
// progess bar
Rectangle {
......@@ -223,7 +260,7 @@ Item {
Layout.columnSpan: 2
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: "Upload Complete"
text: "Done"
visible: false
Layout.fillWidth: true
}
......@@ -233,7 +270,6 @@ Item {
id: statsHeader
text: qsTr("Statistics")
}
GridLayout {
columns: 3
rowSpacing: ScreenTools.defaultFontPixelHeight * 0.5
......
......@@ -13,6 +13,7 @@ class WimaAreaData
public:
Q_PROPERTY(const QVariantList path READ path NOTIFY pathChanged)
Q_PROPERTY(QString type READ type CONSTANT)
Q_PROPERTY(QString mapVisualQML READ mapVisualQML CONSTANT)
WimaAreaData(QObject *parent = nullptr);
~WimaAreaData();
......@@ -23,6 +24,8 @@ public:
bool operator==(const WimaAreaData &data) const;
bool operator!=(const WimaAreaData &data) const;
virtual QString mapVisualQML(void) const = 0;
QVariantList path() const;
QGeoCoordinate center() const;
const QList<QGeoCoordinate> &coordinateList() const;
......
......@@ -2,22 +2,17 @@
const char *WimaCorridorData::typeString = "WimaCorridorData";
WimaCorridorData::WimaCorridorData(QObject *parent)
:WimaAreaData (parent)
{
WimaCorridorData::WimaCorridorData(QObject *parent) : WimaAreaData(parent) {}
}
WimaCorridorData::WimaCorridorData(const WimaCorridorData &other, QObject *parent)
: WimaAreaData (parent)
{
*this = other;
WimaCorridorData::WimaCorridorData(const WimaCorridorData &other,
QObject *parent)
: WimaAreaData(parent) {
*this = other;
}
WimaCorridorData::WimaCorridorData(const WimaCorridor &other, QObject *parent)
: WimaAreaData (parent)
{
*this = other;
: WimaAreaData(parent) {
*this = other;
}
/*!
......@@ -25,11 +20,10 @@ WimaCorridorData::WimaCorridorData(const WimaCorridor &other, QObject *parent)
*
* Assigns \a other to the invoking object.
*/
WimaCorridorData &WimaCorridorData::operator=(const WimaCorridorData &other)
{
this->assign(other);
WimaCorridorData &WimaCorridorData::operator=(const WimaCorridorData &other) {
this->assign(other);
return *this;
return *this;
}
/*!
......@@ -37,36 +31,34 @@ WimaCorridorData &WimaCorridorData::operator=(const WimaCorridorData &other)
*
* Assigns \a other to the invoking object.
*/
WimaCorridorData &WimaCorridorData::operator=(const WimaCorridor &other)
{
this->assign(other);
WimaCorridorData &WimaCorridorData::operator=(const WimaCorridor &other) {
this->assign(other);
return *this;
return *this;
}
QString WimaCorridorData::type() const
{
return this->typeString;
QString WimaCorridorData::mapVisualQML() const {
return QStringLiteral("WimaAreaDataVisual.qml");
}
void WimaCorridorData::assign(const WimaCorridorData &corridorData)
{
WimaAreaData::assign(corridorData);
}
QString WimaCorridorData::type() const { return this->typeString; }
void WimaCorridorData::assign(const WimaCorridor &corridor)
{
WimaAreaData::assign(corridor);
void WimaCorridorData::assign(const WimaCorridorData &corridorData) {
WimaAreaData::assign(corridorData);
}
void WimaCorridorData::assign(const WimaCorridor &corridor) {
WimaAreaData::assign(corridor);
}
/*!
* \class WimaAreaData::WimaCorridorData
* \brief Class to store and exchange data of a \c WimaCorridorData Object.
* Class to store and exchange data of a \c WimaCorridor Object. In contrast to \c WimaCorridor this class
* does not provied any interface to a grafical user interface, neiter it uses the QGC Fact System.
* It is designed to exchange data between the \c WimaPlaner and the \c WimaController class. And it
* is the derived from WimaAreaData.
* Class to store and exchange data of a \c WimaCorridor Object. In contrast to
* \c WimaCorridor this class does not provied any interface to a grafical user
* interface, neiter it uses the QGC Fact System. It is designed to exchange
* data between the \c WimaPlaner and the \c WimaController class. And it is the
* derived from WimaAreaData.
*
* \sa WimaCorridor, WimaAreaData
*/
......@@ -7,31 +7,30 @@
#include "QGeoCoordinate"
class WimaCorridorData : public WimaAreaData
{
Q_OBJECT
class WimaCorridorData : public WimaAreaData {
Q_OBJECT
public:
WimaCorridorData(QObject *parent = nullptr);
WimaCorridorData(const WimaCorridorData &other, QObject *parent = nullptr);
WimaCorridorData(const WimaCorridor &other, QObject *parent = nullptr);
WimaCorridorData &operator=(const WimaCorridorData &other);
WimaCorridorData &operator=(const WimaCorridor &other);
WimaCorridorData(QObject *parent = nullptr);
WimaCorridorData(const WimaCorridorData &other, QObject *parent = nullptr);
WimaCorridorData(const WimaCorridor &other, QObject *parent = nullptr);
WimaCorridorData &operator=(const WimaCorridorData &other);
WimaCorridorData &operator=(const WimaCorridor &other);
QString type() const;
WimaCorridorData *Clone() const {return new WimaCorridorData(*this);}
virtual QString mapVisualQML() const override;
static const char* typeString;
QString type() const;
WimaCorridorData *Clone() const { return new WimaCorridorData(*this); }
static const char *typeString;
signals:
public slots:
protected:
void assign(const WimaCorridorData &corridorData);
void assign(const WimaCorridor &corridor);
void assign(const WimaCorridorData &corridorData);
void assign(const WimaCorridor &corridor);
private:
};
......@@ -39,6 +39,10 @@ WimaJoinedAreaData &WimaJoinedAreaData::operator=(const WimaJoinedArea &other) {
return *this;
}
QString WimaJoinedAreaData::mapVisualQML() const {
return QStringLiteral("WimaJoinedAreaDataVisual.qml");
}
QString WimaJoinedAreaData::type() const { return this->typeString; }
void WimaJoinedAreaData::assign(const WimaJoinedAreaData &other) {
......
......@@ -7,26 +7,27 @@
#include "QGeoCoordinate"
class WimaJoinedAreaData : public WimaAreaData
{
Q_OBJECT
class WimaJoinedAreaData : public WimaAreaData {
Q_OBJECT
public:
WimaJoinedAreaData(QObject *parent = nullptr);
WimaJoinedAreaData(const WimaJoinedAreaData &other, QObject *parent = nullptr);
WimaJoinedAreaData(const WimaJoinedArea &other, QObject *parent = nullptr);
WimaJoinedAreaData &operator=(const WimaJoinedAreaData &other);
WimaJoinedAreaData &operator=(const WimaJoinedArea &other);
WimaJoinedAreaData(QObject *parent = nullptr);
WimaJoinedAreaData(const WimaJoinedAreaData &other,
QObject *parent = nullptr);
WimaJoinedAreaData(const WimaJoinedArea &other, QObject *parent = nullptr);
WimaJoinedAreaData &operator=(const WimaJoinedAreaData &other);
WimaJoinedAreaData &operator=(const WimaJoinedArea &other);
QString type() const;
WimaJoinedAreaData *Clone() const {return new WimaJoinedAreaData(*this);}
virtual QString mapVisualQML() const override;
static const char* typeString;
QString type() const;
WimaJoinedAreaData *Clone() const { return new WimaJoinedAreaData(*this); }
static const char *typeString;
protected:
void assign(const WimaJoinedAreaData &other);
void assign(const WimaJoinedArea &other);
void assign(const WimaJoinedAreaData &other);
void assign(const WimaJoinedArea &other);
private:
};
......@@ -30,6 +30,20 @@ operator!=(const WimaMeasurementAreaData &other) const {
return !(*this == other);
}
void WimaMeasurementAreaData::setTileData(const TileData &d) {
if (this->_tileData != d) {
this->_tileData = d;
emit tileDataChanged();
}
}
void WimaMeasurementAreaData::setProgress(const QVector<int> &d) {
if (this->_progress != d) {
this->_progress = d;
emit progressChanged();
}
}
/*!
* \overload operator=();
*
......@@ -54,6 +68,10 @@ operator=(const WimaMeasurementArea &other) {
return *this;
}
QString WimaMeasurementAreaData::mapVisualQML() const {
return QStringLiteral("WimaMeasurementAreaDataVisual.qml");
}
QString WimaMeasurementAreaData::type() const { return this->typeString; }
QmlObjectListModel *WimaMeasurementAreaData::tiles() {
......@@ -86,15 +104,15 @@ QVector<int> &WimaMeasurementAreaData::progress() { return this->_progress; }
void WimaMeasurementAreaData::assign(const WimaMeasurementAreaData &other) {
WimaAreaData::assign(other);
this->_tileData = other._tileData;
this->_progress = other._progress;
setTileData(other._tileData);
setProgress(other._progress);
}
void WimaMeasurementAreaData::assign(const WimaMeasurementArea &other) {
WimaAreaData::assign(other);
if (other.ready()) {
this->_tileData = other.tileData();
this->_progress = other.progress();
setTileData(other.tileData());
setProgress(other.progress());
} else {
qWarning()
<< "WimaMeasurementAreaData::assign(): WimaMeasurementArea not ready.";
......
......@@ -18,14 +18,23 @@ public:
WimaMeasurementAreaData &operator=(const WimaMeasurementAreaData &other);
WimaMeasurementAreaData &operator=(const WimaMeasurementArea &other);
Q_PROPERTY(QmlObjectListModel *tiles READ tiles NOTIFY tileDataChanged)
Q_PROPERTY(QVector<int> progress READ progress NOTIFY progressChanged)
virtual QString mapVisualQML() const override;
bool operator==(const WimaMeasurementAreaData &other) const;
bool operator!=(const WimaMeasurementAreaData &other) const;
// Property setters.
void setTileData(const TileData &d);
void setProgress(const QVector<int> &d);
// Property getters.
QString type() const;
WimaMeasurementAreaData *Clone() const {
return new WimaMeasurementAreaData(*this);
}
QmlObjectListModel *tiles();
const QmlObjectListModel *tiles() const;
const QVariantList &tileCenterPoints() const;
......@@ -37,6 +46,10 @@ public:
static const char *typeString;
signals:
void tileDataChanged();
void progressChanged();
protected:
void assign(const WimaMeasurementAreaData &other);
void assign(const WimaMeasurementArea &other);
......
......@@ -31,6 +31,10 @@ operator=(const WimaServiceArea &otherArea) {
return *this;
}
QString WimaServiceAreaData::mapVisualQML() const {
return QStringLiteral("WimaServiceAreaDataVisual.qml");
}
/*!
* \fn const QGeoCoordinate &WimaServiceAreaData::takeOffPosition() const
* Returns a constant reference to the takeOffPosition.
......
......@@ -17,6 +17,8 @@ public:
WimaServiceAreaData &operator=(const WimaServiceAreaData &otherData);
WimaServiceAreaData &operator=(const WimaServiceArea &otherArea);
virtual QString mapVisualQML() const override;
const QGeoCoordinate &depot() const;
QString type() const;
......
......@@ -9,6 +9,10 @@ SnakeTile::SnakeTile(const SnakeTile &other, QObject *parent)
SnakeTile::~SnakeTile() {}
QString SnakeTile::mapVisualQML() const {
return QStringLiteral("WimaAreaNoVisual.qml");
}
QString SnakeTile::type() const { return "Tile"; }
SnakeTile *SnakeTile::Clone() const { return new SnakeTile(*this); }
......
......@@ -9,6 +9,8 @@ public:
SnakeTile(const SnakeTile &other, QObject *parent = nullptr);
~SnakeTile();
virtual QString mapVisualQML() const override;
QString type() const override;
SnakeTile *Clone() const;
......
import QtQuick 2.3
Item {
id: _root
property var map ///< Map control to place item in
property var qgcView ///< QGCView to use for popping dialogs
Component.onCompleted: {
console.log("WimaAreaNoVisual.qml is a place holder and not meant to be instanciated.")
}
}
......@@ -253,7 +253,7 @@ void StateMachine::setState(STATE s) {
emit upToDateChanged();
}
if (surveyReady(oldState) != surveyReady(s)) {
emit surveyReady();
emit surveyReadyChanged();
}
qCDebug(WimaPlanerLog) << "StateMachine::setState():" << oldState << "->"
<< s;
......
#include "EmptyManager.h"
namespace WaypointManager {
WaypointManager::EmptyManager::EmptyManager(Settings &settings, AreaInterface &)
: ManagerBase(settings) {}
void WaypointManager::EmptyManager::clear() {}
bool WaypointManager::EmptyManager::update() {}
bool WaypointManager::EmptyManager::next() {}
bool WaypointManager::EmptyManager::previous() {}
bool WaypointManager::EmptyManager::reset() {}
} // namespace WaypointManager
#pragma once
#include <QGeoCoordinate>
#include <QVector>
#include "AreaInterface.h"
#include "GenericWaypointManager.h"
#include "QmlObjectListModel.h"
#include "Settings.h"
namespace WaypointManager {
typedef GenericWaypointManager<QGeoCoordinate, QVector, QmlObjectListModel,
Settings>
ManagerBase;
//!
//! \brief The EmptyManager is a place holder and does noting.
class EmptyManager : public ManagerBase {
public:
EmptyManager() = delete;
EmptyManager(Settings &settings, AreaInterface &);
void clear() override;
virtual bool update() override;
virtual bool next() override;
virtual bool previous() override;
virtual bool reset() override;
};
} // namespace WaypointManager
This diff is collapsed.
......@@ -18,7 +18,7 @@
#include "RoutingThread.h"
#include "Snake/NemoInterface.h"
#include "WaypointManager/DefaultManager.h"
#include "WaypointManager/EmptyManager.h"
#include "WaypointManager/RTLManager.h"
#include "utilities.h"
......@@ -42,42 +42,13 @@ public:
visualItemsChanged)
Q_PROPERTY(QmlObjectListModel *missionItems READ missionItems NOTIFY
missionItemsChanged)
Q_PROPERTY(QmlObjectListModel *currentMissionItems READ currentMissionItems
NOTIFY currentMissionItemsChanged)
Q_PROPERTY(
QVariantList waypointPath READ waypointPath NOTIFY waypointPathChanged)
Q_PROPERTY(QVariantList currentWaypointPath READ currentWaypointPath NOTIFY
currentWaypointPathChanged)
Q_PROPERTY(Fact *enableWimaController READ enableWimaController CONSTANT)
// Waypoint navigaton.
Q_PROPERTY(Fact *overlapWaypoints READ overlapWaypoints CONSTANT)
Q_PROPERTY(Fact *maxWaypointsPerPhase READ maxWaypointsPerPhase CONSTANT)
Q_PROPERTY(Fact *startWaypointIndex READ startWaypointIndex CONSTANT)
Q_PROPERTY(Fact *showAllMissionItems READ showAllMissionItems CONSTANT)
Q_PROPERTY(
Fact *showCurrentMissionItems READ showCurrentMissionItems CONSTANT)
// Waypoint settings.
Q_PROPERTY(Fact *flightSpeed READ flightSpeed CONSTANT)
Q_PROPERTY(Fact *altitude READ altitude CONSTANT)
Q_PROPERTY(Fact *arrivalReturnSpeed READ arrivalReturnSpeed CONSTANT)
// Waypoint statistics.
Q_PROPERTY(
double phaseDistance READ phaseDistance NOTIFY phaseDistanceChanged)
Q_PROPERTY(
double phaseDuration READ phaseDuration NOTIFY phaseDurationChanged)
// Snake
Q_PROPERTY(int nemoStatus READ nemoStatus NOTIFY nemoStatusChanged)
Q_PROPERTY(QString nemoStatusString READ nemoStatusString NOTIFY
nemoStatusStringChanged)
Q_PROPERTY(
QmlObjectListModel *snakeTiles READ snakeTiles NOTIFY snakeTilesChanged)
Q_PROPERTY(QVariantList snakeTileCenterPoints READ snakeTileCenterPoints
NOTIFY snakeTilesChanged)
Q_PROPERTY(
QVector<int> nemoProgress READ nemoProgress NOTIFY nemoProgressChanged)
// Property accessors
// Controllers.
PlanMasterController *masterController(void);
MissionController *missionController(void);
......@@ -86,31 +57,14 @@ public:
QGCMapPolygon joinedArea(void) const;
// Waypoints.
QmlObjectListModel *missionItems(void);
QmlObjectListModel *currentMissionItems(void);
QVariantList waypointPath(void);
QVariantList currentWaypointPath(void);
// Settings facts.
Fact *enableWimaController(void);
Fact *overlapWaypoints(void);
Fact *maxWaypointsPerPhase(void);
Fact *startWaypointIndex(void);
Fact *showAllMissionItems(void);
Fact *showCurrentMissionItems(void);
Fact *flightSpeed(void);
Fact *arrivalReturnSpeed(void);
Fact *altitude(void);
// Snake data.
QmlObjectListModel *snakeTiles(void);
QVariantList snakeTileCenterPoints(void);
QVector<int> nemoProgress(void);
int nemoStatus(void) const;
QString nemoStatusString(void) const;
bool uploadOverrideRequired(void) const;
bool vehicleHasLowBattery(void) const;
// Waypoint statistics.
double phaseDistance(void) const;
double phaseDuration(void) const;
// Property setters
void setMasterController(PlanMasterController *masterController);
......@@ -119,10 +73,6 @@ public:
// Member Methodes
Q_INVOKABLE WimaController *thisPointer();
// Waypoint navigation.
Q_INVOKABLE void nextPhase();
Q_INVOKABLE void previousPhase();
Q_INVOKABLE void resetPhase();
// Smart RTL.
Q_INVOKABLE void requestSmartRTL();
Q_INVOKABLE void initSmartRTL();
......@@ -137,15 +87,8 @@ public:
static const char *areaItemsName;
static const char *missionItemsName;
static const char *settingsGroup;
static const char *endWaypointIndexName;
static const char *enableWimaControllerName;
static const char *overlapWaypointsName;
static const char *maxWaypointsPerPhaseName;
static const char *startWaypointIndexName;
static const char *showAllMissionItemsName;
static const char *showCurrentMissionItemsName;
static const char *flightSpeedName;
static const char *arrivalReturnSpeedName;
static const char *altitudeName;
signals:
......@@ -156,42 +99,20 @@ signals:
void visualItemsChanged(void);
// Waypoints.
void missionItemsChanged(void);
void currentMissionItemsChanged(void);
void waypointPathChanged(void);
void currentWaypointPathChanged(void);
// Smart RTL.
void smartRTLRequestConfirm(void);
void smartRTLPathConfirm(void);
// Upload.
void forceUploadConfirm(void);
// Waypoint statistics.
void phaseDistanceChanged(void);
void phaseDurationChanged(void);
// Snake.
void snakeTilesChanged(void);
void nemoProgressChanged(void);
void nemoStatusChanged(void);
void nemoStatusStringChanged(void);
private slots:
// Waypoint navigation / helper.
bool _calcNextPhase(void);
void _recalcCurrentPhase(void);
bool _calcShortestPath(const QGeoCoordinate &start,
const QGeoCoordinate &destination,
QVector<QGeoCoordinate> &path);
// Slicing parameters
bool _setStartIndex(void);
void _updateOverlap(void);
void _updateMaxWaypoints(void);
// Waypoint settings.
void _updateflightSpeed(void);
void _updateArrivalReturnSpeed(void);
void _updateAltitude(void);
// Waypoint Statistics.
void _setPhaseDistance(double distance);
void _setPhaseDuration(double duration);
// SMART RTL
void _checkBatteryLevel(void);
bool _SRTLPrecondition(QString &errorString);
......@@ -219,7 +140,7 @@ private:
// Waypoint Managers.
WaypointManager::AreaInterface _areaInterface;
WaypointManager::Settings _WMSettings; // Waypoint Manager Settings
WaypointManager::DefaultManager _defaultWM;
WaypointManager::EmptyManager _emptyWM;
WaypointManager::RTLManager _rtlWM;
WaypointManager::ManagerBase *_currentWM;
using ManagerList = QList<WaypointManager::ManagerBase *>;
......@@ -230,34 +151,13 @@ private:
SettingsFact _enableWimaController; // enables or disables the wimaControler
// determines the number of overlapping waypoints between two consecutive
// mission phases
SettingsFact _overlapWaypoints;
// determines the maximum number waypoints per phase
SettingsFact _maxWaypointsPerPhase;
SettingsFact
_nextPhaseStartWaypointIndex; // index (displayed on the map, -1 to get
// index of item in _missionItems) of the
// mission item defining the first element
// of the next phase
SettingsFact
_showAllMissionItems; // bool value, Determines whether the mission items
// of the overall mission are displayed or not.
SettingsFact _showCurrentMissionItems; // bool value, Determines whether the
// mission items of the current mission
// phase are displayed or not.
SettingsFact _flightSpeed; // mission flight speed
SettingsFact _arrivalReturnSpeed; // arrival and return path speed
SettingsFact _altitude; // mission altitude
SettingsFact _flightSpeed; // mission flight speed
SettingsFact _altitude; // mission altitude
// Smart RTL.
QTimer _smartRTLTimer;
bool _lowBatteryHandlingTriggered;
// Waypoint statistics.
double _measurementPathLength; // the lenght of the phase in meters
using StatusMap = std::map<int, QString>;
static StatusMap _nemoStatusMap;
// Periodic tasks.
QTimer _eventTimer;
EventTicker _batteryLevelTicker;
......
......@@ -37,28 +37,28 @@ Item {
function _addTransectsComponent(){
if (!_transectsComponent){
_transectsComponent = visualTransectsComponent.createObject(map)
_transectsComponent = visualTransectsComponent.createObject(_root)
map.addMapItem(_transectsComponent)
}
}
function _addExitCoordinate(){
if (!_exitCoordinate){
_exitCoordinate = exitPointComponent.createObject(map)
_exitCoordinate = exitPointComponent.createObject(_root)
map.addMapItem(_exitCoordinate)
}
}
function _addEntryCoordinate(){
if (!_entryCoordinate){
_entryCoordinate = entryPointComponent.createObject(map)
_entryCoordinate = entryPointComponent.createObject(_root)
map.addMapItem(_entryCoordinate)
}
}
function _addRefPoint(){
if (!_refPoint){
_refPoint = refPointComponent.createObject(map)
_refPoint = refPointComponent.createObject(_root)
map.addMapItem(_refPoint)
}
}
......
import QtQuick 2.3
import QtQuick.Controls 1.2
import QtLocation 5.3
import QtPositioning 5.3
import QGroundControl 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.Palette 1.0
import QGroundControl.Controls 1.0
import QGroundControl.FlightMap 1.0
/// Wima Measurement Area Data visuals
Item {
id: _root
property var map ///< Map control to place item in
property var qgcView ///< QGCView to use for popping dialogs
property var areaItem: object
signal clicked(int sequenceNumber)
property var _polygonComponent
function _addPolygon(){
if(!_polygonComponent){
_polygonComponent = polygon.createObject(_root)
map.addMapItem(_polygonComponent)
}
}
function _destroyPolygon(){
if(_polygonComponent){
map.removeMapItem(_polygonComponent)
_polygonComponent.destroy()
}
}
Component.onCompleted: {
_addPolygon()
}
Component.onDestruction: {
_destroyPolygon()
}
// Polygon component.
Component{
id:polygon
MapPolygon {
path: object.path;
border.color: "black"
color: "blue"
opacity: 0.25
}
}
}
import QtQuick 2.3
import QtQuick.Controls 1.2
import QtLocation 5.3
import QtPositioning 5.3
import QGroundControl 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.Palette 1.0
import QGroundControl.Controls 1.0
import QGroundControl.FlightMap 1.0
/// Wima Measurement Area Data visuals
Item {
id: _root
property var map ///< Map control to place item in
property var qgcView ///< QGCView to use for popping dialogs
property var areaItem: object
signal clicked(int sequenceNumber)
property var _polygonComponent
function _addPolygon(){
if(!_polygonComponent){
_polygonComponent = polygon.createObject(_root)
map.addMapItem(_polygonComponent)
}
}
function _destroyPolygon(){
if(_polygonComponent){
map.removeMapItem(_polygonComponent)
_polygonComponent.destroy()
}
}
Component.onCompleted: {
_addPolygon()
}
Component.onDestruction: {
_destroyPolygon()
}
// Polygon component.
Component{
id:polygon
MapPolygon {
path: object.path;
border.color: "black"
color: "gray"
opacity: 0.25
}
}
}
import QtQuick 2.3
import QtQuick.Controls 1.2
import QtLocation 5.3
import QtPositioning 5.3
import QGroundControl 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.Palette 1.0
import QGroundControl.Controls 1.0
import QGroundControl.FlightMap 1.0
/// Wima Measurement Area Data visuals
Item {
id: _root
property var map ///< Map control to place item in
property var qgcView ///< QGCView to use for popping dialogs
property var areaItem: object
signal clicked(int sequenceNumber)
property var _polygonComponent
function _addPolygon(){
if(!_polygonComponent){
_polygonComponent = polygon.createObject(_root)
map.addMapItem(_polygonComponent)
}
}
function _destroyPolygon(){
if(_polygonComponent){
map.removeMapItem(_polygonComponent)
_polygonComponent.destroy()
}
}
Component.onCompleted: {
_addPolygon()
}
Component.onDestruction: {
_destroyPolygon()
}
// Add tiles.
Repeater {
id: progressRepeater
model: areaItem.tiles
Item{
property var _tileComponent
property int _progress: _root.areaItem.progress[index] ?
_root.areaItem.progress[index] : 0
Component.onCompleted: {
_tileComponent = tileComponent.createObject(map)
_tileComponent.polygon.path =
Qt.binding(function(){return object.path})
_tileComponent.polygon.opacity = 0.6
_tileComponent.polygon.border.color = "black"
_tileComponent.polygon.border.width = 1
_tileComponent.polygon.color =
Qt.binding(function(){return getColor(_progress)})
}
Component.onDestruction: {
_tileComponent.destroy()
}
}
}
// Polygon component.
Component{
id:polygon
MapPolygon {
path: object.path;
border.color: "black"
color: "green"
opacity: 0.25
}
}
// Tile component.
Component {
id: tileComponent
Item{
id: root
property MapPolygon polygon
MapPolygon{
id:mapPolygon
path: []
}
Component.onCompleted: {
polygon = mapPolygon
map.addMapItem(mapPolygon)
}
Component.onDestruction: {
map.removeMapItem(mapPolygon)
}
}
}
function getColor(progress) {
if (progress === 0)
return "transparent"
if (progress < 33)
return "orange"
if (progress < 66)
return "yellow"
if (progress < 100)
return "greenyellow"
return "limegreen"
}
}
import QtQuick 2.3
import QtQuick.Controls 1.2
import QtLocation 5.3
import QtPositioning 5.3
import QGroundControl 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.Palette 1.0
import QGroundControl.Controls 1.0
import QGroundControl.FlightMap 1.0
/// Wima Measurement Area Data visuals
Item {
id: _root
property var map ///< Map control to place item in
property var qgcView ///< QGCView to use for popping dialogs
property var areaItem: object
signal clicked(int sequenceNumber)
property var _polygonComponent
function _addPolygon(){
if(!_polygonComponent){
_polygonComponent = polygon.createObject(_root)
map.addMapItem(_polygonComponent)
}
}
function _destroyPolygon(){
if(_polygonComponent){
map.removeMapItem(_polygonComponent)
_polygonComponent.destroy()
}
}
Component.onCompleted: {
_addPolygon()
}
Component.onDestruction: {
_destroyPolygon()
}
// Polygon component.
Component{
id:polygon
MapPolygon {
path: object.path;
border.color: "black"
color: "yellow"
opacity: 0.25
}
}
}
......@@ -356,7 +356,8 @@ Rectangle {
QGCButton {
id: uploadButton
text: qsTr("Upload")
enabled: true
enabled: wimaPlaner ?
wimaPlaner.readyForSynchronization : false
onClicked: {
if (wimaPlaner){
if (wimaPlaner.readyForSynchronization) {
......
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