Commit dedb0c51 authored by Valentin Platzgummer's avatar Valentin Platzgummer

nemo interface moved to wima planer

parent 529f7da8
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -273,7 +273,6 @@ FlightMap { ...@@ -273,7 +273,6 @@ FlightMap {
MapItemView { MapItemView {
id: tileView id: tileView
property bool _enable: wimaController.enableWimaController.value property bool _enable: wimaController.enableWimaController.value
&& wimaController.enableSnake.value
property bool valid: wimaController.snakeTileCenterPoints.length property bool valid: wimaController.snakeTileCenterPoints.length
=== wimaController.nemoProgress.length === wimaController.nemoProgress.length
model: _enable ? wimaController.snakeTiles : 0 model: _enable ? wimaController.snakeTiles : 0
......
...@@ -46,7 +46,6 @@ Item { ...@@ -46,7 +46,6 @@ Item {
// Use Settings to store menu appearance through different sessions. // Use Settings to store menu appearance through different sessions.
Settings { Settings {
property alias snakeHeaderChecker: snakeHeader.checked
property alias missionHeaderChecker: missionHeader.checked property alias missionHeaderChecker: missionHeader.checked
property alias navigateHeaderChecker: navigateHeader.checked property alias navigateHeaderChecker: navigateHeader.checked
property alias vehicleHeaderChecker: vehicleHeader.checked property alias vehicleHeaderChecker: vehicleHeader.checked
...@@ -98,7 +97,6 @@ Item { ...@@ -98,7 +97,6 @@ Item {
property var enableWimaFact: wimaController.enableWimaController property var enableWimaFact: wimaController.enableWimaController
property bool enableWimaBoolean: enableWimaFact.value property bool enableWimaBoolean: enableWimaFact.value
property var enableSnakeFact: wimaController.enableSnake
onAccept: { onAccept: {
if (enableWimaBoolean) { if (enableWimaBoolean) {
...@@ -108,7 +106,6 @@ Item { ...@@ -108,7 +106,6 @@ Item {
} else { } else {
enableWimaFact.value = true enableWimaFact.value = true
enableWimaMouseArea.enabled = false enableWimaMouseArea.enabled = false
enableSnakeCheckBox.checkedState = false;
timer.stop() timer.stop()
} }
} }
...@@ -176,56 +173,6 @@ Item { ...@@ -176,56 +173,6 @@ Item {
id: mainColumn id: mainColumn
spacing: ScreenTools.defaultFontPixelHeight * 0.3 spacing: ScreenTools.defaultFontPixelHeight * 0.3
SectionHeader{
id: snakeHeader
text: qsTr("Snake Settings")
}
Column {
visible: snakeHeader.checked
spacing: ScreenTools.defaultFontPixelHeight * 0.5
FactCheckBox {
id: enableSnakeCheckBox
text: wimaController.enableSnake.value ?
qsTr("Disable Snake")
: qsTr("Enable Snake")
fact: wimaController.enableSnake
}
// Spacer
Item {
height: 1
}
// Snake status and settings column.
GridLayout {
columns: 2
rowSpacing: ScreenTools.defaultFontPixelHeight * 0.5
columnSpacing: ScreenTools.defaultFontPixelHeight * 0.5
visible: wimaController.enableSnake.value
// Snake connection status.
QGCLabel {
property int index: wimaController.nemoStatus
property string statusString: wimaController.nemoStatusString
text: "Status: " + statusString
Layout.fillWidth: true
}
// Snake calculation status.
QGCLabel {
property bool _calcInProgress: wimaController.snakeCalcInProgress
text: _calcInProgress === true ?
qsTr("Calculation: In Progress")
: qsTr("Calculation: Idle")
Layout.fillWidth: true
}
}
}
SectionHeader{ SectionHeader{
id: missionHeader id: missionHeader
......
...@@ -143,7 +143,7 @@ Rectangle { ...@@ -143,7 +143,7 @@ Rectangle {
model: len model: len
delegate: QGCRadioButton { delegate: QGCRadioButton {
checked: index === variantRepeater.variant checked: index === variantRepeater.variant
text: variantRepeater.names[index] text: variantRepeater.names[index] ? variantRepeater.names[index]: ""
onCheckedChanged: { onCheckedChanged: {
if (checked){ if (checked){
......
This diff is collapsed.
...@@ -146,6 +146,8 @@ QmlObjectListModel *WimaMeasurementArea::tiles() { ...@@ -146,6 +146,8 @@ QmlObjectListModel *WimaMeasurementArea::tiles() {
return &this->_tileData.tiles; return &this->_tileData.tiles;
} }
QVector<int> WimaMeasurementArea::progress() { return this->_progress; }
const QmlObjectListModel *WimaMeasurementArea::tiles() const { const QmlObjectListModel *WimaMeasurementArea::tiles() const {
return &this->_tileData.tiles; return &this->_tileData.tiles;
} }
...@@ -226,6 +228,17 @@ bool WimaMeasurementArea::loadFromJson(const QJsonObject &json, ...@@ -226,6 +228,17 @@ bool WimaMeasurementArea::loadFromJson(const QJsonObject &json,
return false; return false;
} }
} }
bool WimaMeasurementArea::setProgress(const QVector<int> &p) {
if (!_calculating) {
if (p.size() == this->tiles()->count() && this->_progress != p) {
this->_progress = p;
emit progressChanged();
return true;
}
}
return false;
}
//! //!
//! \brief WimaMeasurementArea::doUpdate //! \brief WimaMeasurementArea::doUpdate
//! \pre WimaMeasurementArea::deferUpdate must be called first, don't call //! \pre WimaMeasurementArea::deferUpdate must be called first, don't call
...@@ -312,6 +325,8 @@ void WimaMeasurementArea::deferUpdate() { ...@@ -312,6 +325,8 @@ void WimaMeasurementArea::deferUpdate() {
this->_timer.stop(); this->_timer.stop();
} }
if (this->_tileData.size() > 0) { if (this->_tileData.size() > 0) {
this->_progress.clear();
emit this->progressChanged();
this->_tileData.clear(); this->_tileData.clear();
emit this->tilesChanged(); emit this->tilesChanged();
} }
......
...@@ -41,6 +41,7 @@ public: ...@@ -41,6 +41,7 @@ public:
Q_PROPERTY(Fact *showTiles READ showTiles CONSTANT) Q_PROPERTY(Fact *showTiles READ showTiles CONSTANT)
Q_PROPERTY(QmlObjectListModel *tiles READ tiles NOTIFY tilesChanged) Q_PROPERTY(QmlObjectListModel *tiles READ tiles NOTIFY tilesChanged)
Q_PROPERTY(int maxTiles READ maxTiles NOTIFY maxTilesChanged) Q_PROPERTY(int maxTiles READ maxTiles NOTIFY maxTilesChanged)
Q_PROPERTY(QVector<int> progress READ progress NOTIFY progressChanged)
// Overrides from WimaPolygon // Overrides from WimaPolygon
QString mapVisualQML(void) const; QString mapVisualQML(void) const;
...@@ -53,6 +54,7 @@ public: ...@@ -53,6 +54,7 @@ public:
Fact *minTransectLength(); Fact *minTransectLength();
Fact *showTiles(); Fact *showTiles();
QmlObjectListModel *tiles(); QmlObjectListModel *tiles();
QVector<int> progress();
const QmlObjectListModel *tiles() const; const QmlObjectListModel *tiles() const;
const QVariantList &tileCenterPoints() const; // List of QGeoCoordinate const QVariantList &tileCenterPoints() const; // List of QGeoCoordinate
const TileData &tileData() const; const TileData &tileData() const;
...@@ -80,8 +82,10 @@ public: ...@@ -80,8 +82,10 @@ public:
signals: signals:
void tilesChanged(); void tilesChanged();
void maxTilesChanged(); void maxTilesChanged();
void progressChanged();
public slots: public slots:
bool setProgress(const QVector<int> &p);
private slots: private slots:
void doUpdate(); void doUpdate();
...@@ -108,4 +112,6 @@ private: ...@@ -108,4 +112,6 @@ private:
TileData _tileData; TileData _tileData;
QFutureWatcher<DataPtr> _watcher; QFutureWatcher<DataPtr> _watcher;
bool _calculating; bool _calculating;
QVector<int> _progress;
}; };
This diff is collapsed.
...@@ -13,28 +13,48 @@ class NemoInterface : public QObject { ...@@ -13,28 +13,48 @@ class NemoInterface : public QObject {
using PImpl = std::unique_ptr<Impl>; using PImpl = std::unique_ptr<Impl>;
public: public:
enum class NemoStatus { enum class STATUS {
NotConnected = 0, NOT_CONNECTED = 0,
Connected = 1, HEARTBEAT_DETECTED = 1,
Timeout = -1, WEBSOCKET_DETECTED = 2,
InvalidHeartbeat = -2 TIMEOUT = -1,
INVALID_HEARTBEAT = -2
}; };
explicit NemoInterface(QObject *parent = nullptr); explicit NemoInterface(QObject *parent = nullptr);
~NemoInterface() override; ~NemoInterface() override;
void start(); Q_PROPERTY(int status READ status NOTIFY statusChanged)
void stop(); Q_PROPERTY(QString statusString READ statusString NOTIFY statusChanged)
Q_PROPERTY(QVector<int> progress READ progress NOTIFY progressChanged)
Q_PROPERTY(QString editorQml READ editorQml CONSTANT)
Q_PROPERTY(bool running READ running NOTIFY runningChanged)
Q_PROPERTY(bool holdProgress READ holdProgress WRITE setHoldProgress NOTIFY
holdProgressChanged)
void publishTileData(const TileData &tileData); Q_INVOKABLE void start();
Q_INVOKABLE void stop();
Q_INVOKABLE void publishTileData();
Q_INVOKABLE void requestProgress();
void setTileData(const TileData &tileData);
bool hasTileData(const TileData &tileData) const; bool hasTileData(const TileData &tileData) const;
void setAutoPublish(bool ap);
void setHoldProgress(bool hp);
NemoStatus status() const; int status() const;
STATUS statusEnum() const;
QString statusString() const;
QVector<int> progress() const; QVector<int> progress() const;
QString editorQml();
bool running();
bool holdProgress();
signals: signals:
void statusChanged(); void statusChanged();
void progressChanged(); void progressChanged();
void runningChanged();
void holdProgressChanged();
private: private:
PImpl pImpl; PImpl pImpl;
......
This diff is collapsed.
...@@ -67,12 +67,9 @@ public: ...@@ -67,12 +67,9 @@ public:
double phaseDuration READ phaseDuration NOTIFY phaseDurationChanged) double phaseDuration READ phaseDuration NOTIFY phaseDurationChanged)
// Snake // Snake
Q_PROPERTY(Fact *enableSnake READ enableSnake CONSTANT)
Q_PROPERTY(int nemoStatus READ nemoStatus NOTIFY nemoStatusChanged) Q_PROPERTY(int nemoStatus READ nemoStatus NOTIFY nemoStatusChanged)
Q_PROPERTY(QString nemoStatusString READ nemoStatusString NOTIFY Q_PROPERTY(QString nemoStatusString READ nemoStatusString NOTIFY
nemoStatusStringChanged) nemoStatusStringChanged)
Q_PROPERTY(bool snakeCalcInProgress READ snakeCalcInProgress NOTIFY
snakeCalcInProgressChanged)
Q_PROPERTY( Q_PROPERTY(
QmlObjectListModel *snakeTiles READ snakeTiles NOTIFY snakeTilesChanged) QmlObjectListModel *snakeTiles READ snakeTiles NOTIFY snakeTilesChanged)
Q_PROPERTY(QVariantList snakeTileCenterPoints READ snakeTileCenterPoints Q_PROPERTY(QVariantList snakeTileCenterPoints READ snakeTileCenterPoints
...@@ -102,15 +99,12 @@ public: ...@@ -102,15 +99,12 @@ public:
Fact *flightSpeed(void); Fact *flightSpeed(void);
Fact *arrivalReturnSpeed(void); Fact *arrivalReturnSpeed(void);
Fact *altitude(void); Fact *altitude(void);
// Snake settings facts.
Fact *enableSnake(void) { return &_enableSnake; }
// Snake data. // Snake data.
QmlObjectListModel *snakeTiles(void); QmlObjectListModel *snakeTiles(void);
QVariantList snakeTileCenterPoints(void); QVariantList snakeTileCenterPoints(void);
QVector<int> nemoProgress(void); QVector<int> nemoProgress(void);
int nemoStatus(void) const; int nemoStatus(void) const;
QString nemoStatusString(void) const; QString nemoStatusString(void) const;
bool snakeCalcInProgress(void) const;
bool uploadOverrideRequired(void) const; bool uploadOverrideRequired(void) const;
bool vehicleHasLowBattery(void) const; bool vehicleHasLowBattery(void) const;
...@@ -153,8 +147,6 @@ public: ...@@ -153,8 +147,6 @@ public:
static const char *flightSpeedName; static const char *flightSpeedName;
static const char *arrivalReturnSpeedName; static const char *arrivalReturnSpeedName;
static const char *altitudeName; static const char *altitudeName;
static const char *snakeLineDistanceName;
static const char *snakeMinTransectLengthName;
signals: signals:
// Controllers. // Controllers.
...@@ -176,7 +168,6 @@ signals: ...@@ -176,7 +168,6 @@ signals:
void phaseDistanceChanged(void); void phaseDistanceChanged(void);
void phaseDurationChanged(void); void phaseDurationChanged(void);
// Snake. // Snake.
void snakeCalcInProgressChanged(void);
void snakeTilesChanged(void); void snakeTilesChanged(void);
void nemoProgressChanged(void); void nemoProgressChanged(void);
void nemoStatusChanged(void); void nemoStatusChanged(void);
...@@ -207,12 +198,7 @@ private slots: ...@@ -207,12 +198,7 @@ private slots:
void _initSmartRTL(); void _initSmartRTL();
void _smartRTLCleanUp(bool flying); void _smartRTLCleanUp(bool flying);
// Snake. // Snake.
void _storeRoute(RoutingThread::PtrRoutingData data);
void _switchWaypointManager(WaypointManager::ManagerBase &manager); void _switchWaypointManager(WaypointManager::ManagerBase &manager);
void _switchToSnakeWaypointManager(QVariant variant);
void _progressChangedHandler();
void _enableSnakeChangedHandler();
void _updateRoute();
// Periodic tasks. // Periodic tasks.
void _eventTimerHandler(void); void _eventTimerHandler(void);
...@@ -234,7 +220,6 @@ private: ...@@ -234,7 +220,6 @@ private:
WaypointManager::AreaInterface _areaInterface; WaypointManager::AreaInterface _areaInterface;
WaypointManager::Settings _WMSettings; // Waypoint Manager Settings WaypointManager::Settings _WMSettings; // Waypoint Manager Settings
WaypointManager::DefaultManager _defaultWM; WaypointManager::DefaultManager _defaultWM;
WaypointManager::DefaultManager _snakeWM;
WaypointManager::RTLManager _rtlWM; WaypointManager::RTLManager _rtlWM;
WaypointManager::ManagerBase *_currentWM; WaypointManager::ManagerBase *_currentWM;
using ManagerList = QList<WaypointManager::ManagerBase *>; using ManagerList = QList<WaypointManager::ManagerBase *>;
...@@ -262,7 +247,6 @@ private: ...@@ -262,7 +247,6 @@ private:
SettingsFact _flightSpeed; // mission flight speed SettingsFact _flightSpeed; // mission flight speed
SettingsFact _arrivalReturnSpeed; // arrival and return path speed SettingsFact _arrivalReturnSpeed; // arrival and return path speed
SettingsFact _altitude; // mission altitude SettingsFact _altitude; // mission altitude
SettingsFact _enableSnake; // Enable Snake (see snake.h)
// Smart RTL. // Smart RTL.
QTimer _smartRTLTimer; QTimer _smartRTLTimer;
...@@ -271,13 +255,8 @@ private: ...@@ -271,13 +255,8 @@ private:
// Waypoint statistics. // Waypoint statistics.
double _measurementPathLength; // the lenght of the phase in meters double _measurementPathLength; // the lenght of the phase in meters
// Snake
QList<QList<QGeoCoordinate>> _rawTransects;
NemoInterface _nemoInterface;
using StatusMap = std::map<int, QString>; using StatusMap = std::map<int, QString>;
static StatusMap _nemoStatusMap; static StatusMap _nemoStatusMap;
RoutingThread _routingThread;
QGeoCoordinate _origin;
// Periodic tasks. // Periodic tasks.
QTimer _eventTimer; QTimer _eventTimer;
......
...@@ -25,7 +25,8 @@ WimaPlaner::WimaPlaner(QObject *parent) ...@@ -25,7 +25,8 @@ WimaPlaner::WimaPlaner(QObject *parent)
_currentAreaIndex(-1), _wimaBridge(nullptr), _mAreaChanged(true), _currentAreaIndex(-1), _wimaBridge(nullptr), _mAreaChanged(true),
_sAreaChanged(true), _corridorChanged(true), _joinedArea(this), _sAreaChanged(true), _corridorChanged(true), _joinedArea(this),
_arrivalPathLength(0), _returnPathLength(0), _TSComplexItem(nullptr), _arrivalPathLength(0), _returnPathLength(0), _TSComplexItem(nullptr),
_surveyChanged(true), _synchronized(false), _needsUpdate(true) { _surveyChanged(true), _synchronized(false), _needsUpdate(true),
_nemoInterface(this) {
connect(this, &WimaPlaner::currentPolygonIndexChanged, this, connect(this, &WimaPlaner::currentPolygonIndexChanged, this,
&WimaPlaner::updatePolygonInteractivity); &WimaPlaner::updatePolygonInteractivity);
...@@ -33,10 +34,14 @@ WimaPlaner::WimaPlaner(QObject *parent) ...@@ -33,10 +34,14 @@ WimaPlaner::WimaPlaner(QObject *parent)
this->_mAreaChanged = true; this->_mAreaChanged = true;
this->setNeedsUpdate(true); this->setNeedsUpdate(true);
}); });
connect(&this->_measurementArea, &WimaMeasurementArea::tilesChanged, [this] {
this->_nemoInterface.setTileData(this->_measurementArea.tileData());
});
connect(&this->_serviceArea, &WimaArea::pathChanged, [this] { connect(&this->_serviceArea, &WimaArea::pathChanged, [this] {
this->_sAreaChanged = true; this->_sAreaChanged = true;
this->setNeedsUpdate(true); this->setNeedsUpdate(true);
}); });
connect(&this->_serviceArea, &WimaServiceArea::depotChanged, [this] { connect(&this->_serviceArea, &WimaServiceArea::depotChanged, [this] {
this->_sAreaChanged = true; this->_sAreaChanged = true;
this->setNeedsUpdate(true); this->setNeedsUpdate(true);
...@@ -52,6 +57,11 @@ WimaPlaner::WimaPlaner(QObject *parent) ...@@ -52,6 +57,11 @@ WimaPlaner::WimaPlaner(QObject *parent)
_autoLoadTimer.setSingleShot(true); _autoLoadTimer.setSingleShot(true);
_autoLoadTimer.start(300); _autoLoadTimer.start(300);
#endif #endif
// NemoInterface
connect(&this->_nemoInterface, &NemoInterface::progressChanged, [this] {
this->_measurementArea.setProgress(this->_nemoInterface.progress());
});
} }
PlanMasterController *WimaPlaner::masterController() { PlanMasterController *WimaPlaner::masterController() {
...@@ -95,6 +105,8 @@ QGeoCoordinate WimaPlaner::joinedAreaCenter() const { ...@@ -95,6 +105,8 @@ QGeoCoordinate WimaPlaner::joinedAreaCenter() const {
WimaBridge *WimaPlaner::wimaBridge() { return _wimaBridge; } WimaBridge *WimaPlaner::wimaBridge() { return _wimaBridge; }
NemoInterface *WimaPlaner::nemoInterface() { return &_nemoInterface; }
void WimaPlaner::setMasterController(PlanMasterController *masterC) { void WimaPlaner::setMasterController(PlanMasterController *masterC) {
_masterController = masterC; _masterController = masterC;
emit masterControllerChanged(); emit masterControllerChanged();
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
#include "Geometry/WimaServiceAreaData.h" #include "Geometry/WimaServiceAreaData.h"
#include "WimaPlanData.h" #include "WimaPlanData.h"
#include "Snake/NemoInterface.h"
#include "JsonHelper.h" #include "JsonHelper.h"
class MissionController; class MissionController;
...@@ -45,6 +47,7 @@ public: ...@@ -45,6 +47,7 @@ public:
Q_PROPERTY(QGeoCoordinate joinedAreaCenter READ joinedAreaCenter CONSTANT) Q_PROPERTY(QGeoCoordinate joinedAreaCenter READ joinedAreaCenter CONSTANT)
Q_PROPERTY(WimaBridge *wimaBridge READ wimaBridge WRITE setWimaBridge NOTIFY Q_PROPERTY(WimaBridge *wimaBridge READ wimaBridge WRITE setWimaBridge NOTIFY
wimaBridgeChanged) wimaBridgeChanged)
Q_PROPERTY(NemoInterface *nemoInterface READ nemoInterface CONSTANT)
Q_PROPERTY(bool synchronized READ synchronized NOTIFY synchronizedChanged) Q_PROPERTY(bool synchronized READ synchronized NOTIFY synchronizedChanged)
Q_PROPERTY(bool needsUpdate READ needsUpdate NOTIFY needsUpdateChanged) Q_PROPERTY(bool needsUpdate READ needsUpdate NOTIFY needsUpdateChanged)
...@@ -59,6 +62,7 @@ public: ...@@ -59,6 +62,7 @@ public:
QString fileExtension(void) const; QString fileExtension(void) const;
QGeoCoordinate joinedAreaCenter(void) const; QGeoCoordinate joinedAreaCenter(void) const;
WimaBridge *wimaBridge(void); WimaBridge *wimaBridge(void);
NemoInterface *nemoInterface(void);
bool synchronized(); bool synchronized();
bool needsUpdate(); bool needsUpdate();
...@@ -161,4 +165,6 @@ private: ...@@ -161,4 +165,6 @@ private:
QTimer _autoLoadTimer; // timer to auto load mission after some time, prevents QTimer _autoLoadTimer; // timer to auto load mission after some time, prevents
// seg. faults // seg. faults
#endif #endif
NemoInterface _nemoInterface;
}; };
...@@ -110,25 +110,39 @@ Item { ...@@ -110,25 +110,39 @@ Item {
// Add Snake tiles to the map // Add Snake tiles to the map
Component { Component {
id: tileComponent id: tileComponent
MapPolygon { MapPolygon{
color: "transparent"
opacity: 1
border.color: "black"
border.width: 1
path: [] path: []
opacity: 0.6
z: 2
} }
} }
Repeater { Repeater {
id: progressRepeater
property bool enable: areaItem.showTiles.value property bool enable: areaItem.showTiles.value
model: enable ? areaItem.tiles : 0 model: enable ? areaItem.tiles : 0
function getColor(i) {
var progress = areaItem.progress[i]
if (progress < 25)
return "transparent"
if (progress < 50)
return "orange"
if (progress < 75)
return "yellow"
if (progress < 100)
return "greenyellow"
return "limegreen"
}
Item{ Item{
property var _tileComponent property var _tileComponent
function addVisuals() { function addVisuals() {
_tileComponent = tileComponent.createObject(map) _tileComponent = tileComponent.createObject(map)
map.addMapItem(_tileComponent) map.addMapItem(_tileComponent)
_tileComponent.path = object.path _tileComponent.path = object.path
_tileComponent.color = progressRepeater.getColor(index)
} }
function removeVisuals() { function removeVisuals() {
......
...@@ -155,7 +155,7 @@ Rectangle { ...@@ -155,7 +155,7 @@ Rectangle {
anchors.left: logoRow.right anchors.left: logoRow.right
anchors.right: uploadButton.visible ? uploadButton.left : parent.right anchors.right: uploadButton.visible ? uploadButton.left : parent.right
columnSpacing: 0 columnSpacing: 0
columns: 3 columns: 4
GridLayout { GridLayout {
columns: 8 columns: 8
...@@ -252,7 +252,7 @@ Rectangle { ...@@ -252,7 +252,7 @@ Rectangle {
rowSpacing: _rowSpacing rowSpacing: _rowSpacing
columnSpacing: _labelToValueSpacing columnSpacing: _labelToValueSpacing
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
visible: _batteryInfoAvailable // visible: _batteryInfoAvailable
QGCLabel { QGCLabel {
text: qsTr("Battery") text: qsTr("Battery")
...@@ -268,7 +268,7 @@ Rectangle { ...@@ -268,7 +268,7 @@ Rectangle {
} }
Item { width: 1; height: 1 } Item { width: 1; height: 1 }
/* /*
FIXME: Swap point display is currently hidden since the code which calcs it doesn't work correctly FIXME: Swap point display is currently hidden since the code which calcs it doesn't work correctly
QGCLabel { text: qsTr("Swap waypoint:"); font.pointSize: _dataFontSize; } QGCLabel { text: qsTr("Swap waypoint:"); font.pointSize: _dataFontSize; }
QGCLabel { QGCLabel {
...@@ -278,6 +278,72 @@ Rectangle { ...@@ -278,6 +278,72 @@ Rectangle {
} }
*/ */
} }
GridLayout {
columns: 3
rowSpacing: _rowSpacing
columnSpacing: _labelToValueSpacing
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
QGCLabel {
text: qsTr("ROS")
Layout.columnSpan: 3
font.pointSize: ScreenTools.smallFontPointSize
}
QGCCheckBox {
id: enableCheckbox
property var nemo: wimaPlaner ? wimaPlaner.nemoInterface : undefined
text: qsTr("Enable")
checked: nemo ? nemo.running : false
onCheckedChanged: {
if (nemo){
if (checked){
nemo.start()
} else {
nemo.stop()
}
checked = Qt.binding(function(){return nemo.running})
}
}
Layout.minimumWidth: _mediumValueWidth
}
QGCLabel {
property var nemo: wimaPlaner ? wimaPlaner.nemoInterface : undefined
text: nemo ? nemo.statusString : ""
font.pointSize: _dataFontSize
Layout.minimumWidth: _mediumValueWidth
visible: enableCheckbox.checked
Layout.columnSpan: 2
}
QGCCheckBox {
property var nemo: wimaPlaner ? wimaPlaner.nemoInterface : undefined
text: qsTr("Lock Progress")
checked: nemo ? nemo.lockProgress : false
visible: enableCheckbox.checked
onCheckedChanged: {
if (nemo){
if (checked){
nemo.lockProgress = true
} else {
nemo.lockProgress = false
}
checked = Qt.binding(function(){return nemo.lockProgress})
}
}
Layout.minimumWidth: _mediumValueWidth
}
}
} }
QGCButton { QGCButton {
......
...@@ -54,6 +54,7 @@ QGCView { ...@@ -54,6 +54,7 @@ QGCView {
property bool _airspaceEnabled: QGroundControl.airmapSupported ? (QGroundControl.settingsManager.airMapSettings.enableAirMap.rawValue && QGroundControl.airspaceManager.connected): false property bool _airspaceEnabled: QGroundControl.airmapSupported ? (QGroundControl.settingsManager.airMapSettings.enableAirMap.rawValue && QGroundControl.airspaceManager.connected): false
property var _wimaPlaner: wimaPlaner property var _wimaPlaner: wimaPlaner
property var _nemo: wimaPlaner.nemoInterface
property var _planMasterController: masterController property var _planMasterController: masterController
property var _missionController: _planMasterController.missionController property var _missionController: _planMasterController.missionController
property var _visualItems: _missionController.visualItems property var _visualItems: _missionController.visualItems
...@@ -702,6 +703,10 @@ QGCView { ...@@ -702,6 +703,10 @@ QGCView {
name: qsTr("Update"), name: qsTr("Update"),
iconSource: "/res/calculator.png" iconSource: "/res/calculator.png"
}, },
{
name: qsTr("Publish"),
iconSource: "/res/calculator.png"
},
{ {
name: qsTr("Center"), name: qsTr("Center"),
iconSource: "/qmlimages/MapCenter.svg", iconSource: "/qmlimages/MapCenter.svg",
...@@ -731,10 +736,13 @@ QGCView { ...@@ -731,10 +736,13 @@ QGCView {
case 4: case 4:
wimaPlaner.update(); wimaPlaner.update();
break break
case 6: case 5:
editorMap.zoomLevel += 0.5 _nemo.publishTileData();
break break
case 7: case 7:
editorMap.zoomLevel += 0.5
break
case 8:
editorMap.zoomLevel -= 0.5 editorMap.zoomLevel -= 0.5
break break
} }
......
...@@ -4,61 +4,72 @@ ...@@ -4,61 +4,72 @@
#include <vector> #include <vector>
namespace ros_bridge { namespace ros_bridge {
//! @brief Namespace containing classes and methodes ros message generation. //! @brief Namespace containing classes and methodes ros message generation.
namespace messages { namespace messages {
//! @brief Namespace containing classes and methodes for geometry_msgs generation. //! @brief Namespace containing classes and methodes for geometry_msgs
//! generation.
namespace nemo_msgs { namespace nemo_msgs {
//! @brief Namespace containing methodes for geometry_msgs/Point32 message generation. //! @brief Namespace containing methodes for geometry_msgs/Point32 message
//! generation.
namespace progress { namespace progress {
std::string messageType(); std::string messageType();
//! @brief C++ representation of nemo_msgs/Progress message //! @brief C++ representation of nemo_msgs/Progress message
template <class IntType = long, template <class, class...> class ContainterType = std::vector> template <class IntType = long,
class GenericProgress{ template <class, class...> class ContainterType = std::vector>
class GenericProgress {
public: public:
GenericProgress() {} GenericProgress() {}
GenericProgress(const ContainterType<IntType> &progress) : _progress(progress){} GenericProgress(const ContainterType<IntType> &progress)
GenericProgress(const GenericProgress &p) : _progress(p.progress()){} : _progress(progress) {}
GenericProgress(const GenericProgress &p) : _progress(p.progress()) {}
virtual const ContainterType<IntType> &progress(void) const {
return _progress;
}
virtual ContainterType<IntType> &progress(void) { return _progress; }
virtual const ContainterType<IntType> &progress(void) const {return _progress;} bool operator==(const GenericProgress &other) const {
virtual ContainterType<IntType> &progress(void) {return _progress;} return this->_progress == other._progress;
}
bool operator!=(const GenericProgress &other) const {
return !this->operator==(other);
}
protected: protected:
ContainterType<IntType> _progress; ContainterType<IntType> _progress;
}; };
typedef GenericProgress<> Progress; typedef GenericProgress<> Progress;
template <class ProgressType> template <class ProgressType>
bool toJson(const ProgressType &p, rapidjson::Value &value, rapidjson::Document::AllocatorType &allocator) bool toJson(const ProgressType &p, rapidjson::Value &value,
{ rapidjson::Document::AllocatorType &allocator) {
rapidjson::Value jProgress(rapidjson::kArrayType); rapidjson::Value jProgress(rapidjson::kArrayType);
for(unsigned long i=0; i < std::uint64_t(p.progress().size()); ++i){ for (unsigned long i = 0; i < std::uint64_t(p.progress().size()); ++i) {
jProgress.PushBack(rapidjson::Value().SetInt(std::int32_t(p.progress()[i])), allocator); jProgress.PushBack(rapidjson::Value().SetInt(std::int32_t(p.progress()[i])),
} allocator);
value.AddMember("progress", jProgress, allocator); }
return true; value.AddMember("progress", jProgress, allocator);
return true;
} }
template <class ProgressType> template <class ProgressType>
bool fromJson(const rapidjson::Value &value, ProgressType &p) bool fromJson(const rapidjson::Value &value, ProgressType &p) {
{ if (!value.HasMember("progress") || !value["progress"].IsArray()) {
if (!value.HasMember("progress") || !value["progress"].IsArray()){ assert(false);
assert(false); return false;
return false; }
}
const auto& jsonProgress = value["progress"]; const auto &jsonProgress = value["progress"];
unsigned long sz = jsonProgress.Size(); unsigned long sz = jsonProgress.Size();
p.progress().clear(); p.progress().clear();
p.progress().reserve(sz); p.progress().reserve(sz);
for (unsigned long i=0; i < sz; ++i) for (unsigned long i = 0; i < sz; ++i)
p.progress().push_back(std::int32_t(jsonProgress[i].GetInt())); p.progress().push_back(std::int32_t(jsonProgress[i].GetInt()));
return true; return true;
} }
} // namespace progress } // namespace progress
......
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