Commit a0e0f804 authored by Valentin Platzgummer's avatar Valentin Platzgummer

wima planer update improved, wima flight view menu edited.

parent 65210eff
......@@ -46,8 +46,6 @@ Item {
// Use Settings to store menu appearance through different sessions.
Settings {
property alias missionHeaderChecker: missionHeader.checked
property alias navigateHeaderChecker: navigateHeader.checked
property alias vehicleHeaderChecker: vehicleHeader.checked
property alias statsHeaderChecker: statsHeader.checked
}
......@@ -173,124 +171,11 @@ Item {
id: mainColumn
spacing: ScreenTools.defaultFontPixelHeight * 0.3
SectionHeader{
id: missionHeader
text: qsTr("Phase Settings")
}
GridLayout {
columns: 2
rowSpacing: ScreenTools.defaultFontPixelHeight * 0.5
columnSpacing: ScreenTools.defaultFontPixelHeight * 0.5
visible: missionHeader.checked
QGCLabel {
text: qsTr("Next Waypoint")
Layout.fillWidth: true
}
FactTextField {
fact: wimaController.startWaypointIndex
Layout.fillWidth: true
}
QGCLabel {
text: qsTr("Max Waypoints")
Layout.fillWidth: true
}
FactTextField {
fact: wimaController.maxWaypointsPerPhase
Layout.fillWidth: true
}
QGCLabel {
text: qsTr("Overlap")
Layout.fillWidth: true
}
FactTextField {
fact: wimaController.overlapWaypoints
Layout.fillWidth: true
}
QGCLabel {
text: qsTr("Measurement Speed")
Layout.fillWidth: true
}
FactTextField {
fact: wimaController.flightSpeed
Layout.fillWidth: true
}
QGCLabel {
text: qsTr("AaR Speed")
Layout.fillWidth: true
}
FactTextField {
fact: wimaController.arrivalReturnSpeed
Layout.fillWidth: true
}
QGCLabel {
text: qsTr("Altitude")
Layout.fillWidth: true
}
FactTextField {
fact: wimaController.altitude
Layout.fillWidth: true
}
FactCheckBox {
text: qsTr("Show Mission")
fact: wimaController.showAllMissionItems
Layout.fillWidth: true
}
FactCheckBox {
text: qsTr("Show Phase")
fact: wimaController.showCurrentMissionItems
Layout.fillWidth: true
}
}
SectionHeader{
id: navigateHeader
text: qsTr("Navigate")
}
GridLayout {// Buttons
columns: 2
rowSpacing: ScreenTools.defaultFontPixelHeight * 0.5
columnSpacing: ScreenTools.defaultFontPixelHeight * 0.5
visible: navigateHeader.checked
width: missionHeader.width
QGCButton {
id: buttonPreviousMissionPhase
text: qsTr("Go Reverse")
onClicked: wimaController.previousPhase()
Layout.fillWidth: true
}
QGCButton {
id: buttonNextMissionPhase
text: qsTr("Go Forward")
onClicked: wimaController.nextPhase()
Layout.fillWidth: true
}
QGCButton {
id: buttonResetPhase
text: qsTr("Reset Phase")
onClicked: wimaController.resetPhase();
Layout.columnSpan: 2
Layout.fillWidth: true
}
} // Grid Buttons
SectionHeader{
id: vehicleHeader
text: qsTr("Vehicle")
}
GridLayout {
columns: 2
rowSpacing: ScreenTools.defaultFontPixelHeight * 0.5
......@@ -298,17 +183,6 @@ 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")
......@@ -320,7 +194,6 @@ Item {
id: buttonSmartRTL
text: qsTr("Smart RTL")
onClicked: wimaController.requestSmartRTL();
Layout.columnSpan: 2
Layout.fillWidth: true
}
......@@ -350,7 +223,7 @@ Item {
Layout.columnSpan: 2
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: "Done"
text: "Upload Complete"
visible: false
Layout.fillWidth: true
}
......@@ -360,6 +233,7 @@ Item {
id: statsHeader
text: qsTr("Statistics")
}
GridLayout {
columns: 3
rowSpacing: ScreenTools.defaultFontPixelHeight * 0.5
......@@ -374,24 +248,6 @@ Item {
height: 0
}
SmallValue {
property var phaseDistance: wimaController.phaseDistance
shortDescription: qsTr("Phase Length")
value: phaseDistance >= 0 ? phaseDistance.toFixed(2): "-.-"
unit: "m"
//width: widthItem.width*0.49
}
SmallValue {
property var phaseDuration: wimaController.phaseDuration
shortDescription: qsTr("Phase Duration")
value: phaseDuration >= 0 ? getTime(phaseDuration) : "-.-"
//unit: "m"
//width: widthItem.width*0.49
}
SmallValue {
property var currentMissionIndex: missionController.currentMissionIndex
......
......@@ -154,44 +154,6 @@ Rectangle {
}
}
}
QGCLabel {
text: qsTr("Runs")
}
FactTextField {
fact: missionItem.numRuns
}
GridLayout{
Layout.columnSpan: 2
columnSpacing: _margin
rowSpacing: _margin
columns: 6
Repeater{
id: runRepeater
property var fact: missionItem.run
property int run: fact.value
property var names: missionItem.runNames
property int len: missionItem.runNames.length
model: len > 1 ? len : 0
QGCRadioButton {
checked: index === runRepeater.run
text: runRepeater.names[index]
onCheckedChanged: {
if (checked){
missionItem.run.value = index
}
checked = Qt.binding(function(){ return index === runRepeater.run})
}
}
}
}
}
SectionHeader {
......@@ -273,31 +235,20 @@ Rectangle {
anchors.horizontalCenter: parent.horizontalCenter
property bool calculating: missionItem.calculating
running: calculating
visible: calculating || timer.running
onCalculatingChanged: {
if(calculating){
visible = true
} else {
if(!calculating){
// defer hideing
timer.restart()
}
}
Component.onCompleted: {
if (calculating){
visible = true
}
}
Timer{
id: timer
interval: 1000
repeat: false
onTriggered: {
if (indicator.calculating == false){
indicator.visible = false
}
}
running: false
}
}
}
......
......@@ -109,6 +109,12 @@ CircularSurvey::CircularSurvey(Vehicle *vehicle, bool flyView,
connect(this->_pWorker.get(), &RoutingThread::calculatingChanged, this,
&CircularSurvey::calculatingChanged);
this->_transectsDirty = true;
// Altitude
connect(&_cameraCalc, &CameraCalc::distanceToSurfaceRelativeChanged, this,
&CircularSurvey::coordinateHasRelativeAltitudeChanged);
connect(&_cameraCalc, &CameraCalc::distanceToSurfaceRelativeChanged, this,
&CircularSurvey::exitCoordinateHasRelativeAltitudeChanged);
}
CircularSurvey::~CircularSurvey() {}
......
......@@ -26,6 +26,8 @@ void StateMachine::updateState(EVENT e) {
case EVENT::INIT_DONE:
setState(STATE::NEEDS_J_AREA_UPDATE);
break;
case EVENT::M_AREA_NOT_READY:
case EVENT::M_AREA_READY:
case EVENT::M_AREA_PATH_CHANGED:
case EVENT::S_AREA_PATH_CHANGED:
case EVENT::CORRIDOR_PATH_CHANGED:
......@@ -34,20 +36,52 @@ void StateMachine::updateState(EVENT e) {
case EVENT::J_AREA_UPDATED:
case EVENT::DEPOT_CHANGED:
case EVENT::SURVEY_DESTROYED:
case EVENT::MISSION_ITEMS_DESTROYED:
case EVENT::SURVEY_UPDATE_TRIGGERED:
case EVENT::SURVEY_UPDATED:
case EVENT::PATH_CHANGED:
case EVENT::PATH_UPDATED:
break;
default:
qCCritical(WimaPlanerLog)
<< "StateMachine::updateState: Unknown event: " << e;
Q_ASSERT(false);
}
break; // STATE::NEEDS_INIT
case STATE::WAITING_FOR_TILE_UPDATE:
switch (e) {
case EVENT::INIT_DONE:
case EVENT::M_AREA_NOT_READY:
break;
case EVENT::M_AREA_READY:
setState(STATE::NEEDS_J_AREA_UPDATE);
break;
case EVENT::M_AREA_PATH_CHANGED:
case EVENT::S_AREA_PATH_CHANGED:
case EVENT::CORRIDOR_PATH_CHANGED:
case EVENT::M_AREA_TILES_CHANGED:
case EVENT::M_AREA_PROGRESS_CHANGED:
case EVENT::J_AREA_UPDATED:
case EVENT::DEPOT_CHANGED:
case EVENT::SURVEY_DESTROYED:
case EVENT::MISSION_ITEMS_DESTROYED:
case EVENT::SURVEY_UPDATE_TRIGGERED:
case EVENT::SURVEY_UPDATED:
case EVENT::PATH_CHANGED:
case EVENT::PATH_UPDATED:
break;
qCCritical(WimaPlanerLog)
<< "StateMachine::updateState: Unknown event: " << e;
Q_ASSERT(false);
}
break; // STATE::NEEDS_INIT
case STATE::NEEDS_J_AREA_UPDATE:
switch (e) {
case EVENT::INIT_DONE:
break;
case EVENT::M_AREA_NOT_READY:
setState(STATE::WAITING_FOR_TILE_UPDATE);
break;
case EVENT::M_AREA_READY:
case EVENT::M_AREA_PATH_CHANGED:
case EVENT::S_AREA_PATH_CHANGED:
case EVENT::CORRIDOR_PATH_CHANGED:
......@@ -58,20 +92,24 @@ void StateMachine::updateState(EVENT e) {
setState(STATE::NEEDS_SURVEY_UPDATE);
case EVENT::DEPOT_CHANGED:
case EVENT::SURVEY_DESTROYED:
case EVENT::MISSION_ITEMS_DESTROYED:
case EVENT::SURVEY_UPDATE_TRIGGERED:
case EVENT::SURVEY_UPDATED:
case EVENT::PATH_CHANGED:
case EVENT::PATH_UPDATED:
break;
default:
qCCritical(WimaPlanerLog)
<< "StateMachine::updateState: Unknown event: " << e;
Q_ASSERT(false);
break;
}
break; // STATE::NEEDS_J_AREA_UPDATE
case STATE::NEEDS_SURVEY_UPDATE:
switch (e) {
case EVENT::INIT_DONE:
case EVENT::M_AREA_NOT_READY:
setState(STATE::WAITING_FOR_TILE_UPDATE);
break;
case EVENT::M_AREA_READY:
case EVENT::M_AREA_PATH_CHANGED:
case EVENT::S_AREA_PATH_CHANGED:
case EVENT::CORRIDOR_PATH_CHANGED:
......@@ -82,23 +120,27 @@ void StateMachine::updateState(EVENT e) {
case EVENT::J_AREA_UPDATED:
case EVENT::DEPOT_CHANGED:
case EVENT::SURVEY_DESTROYED:
case EVENT::MISSION_ITEMS_DESTROYED:
break;
case EVENT::SURVEY_UPDATE_TRIGGERED:
setState(STATE::WAITING_FOR_SURVEY_UPDATE);
break;
case EVENT::SURVEY_UPDATED:
case EVENT::PATH_CHANGED:
case EVENT::PATH_UPDATED:
break;
default:
qCCritical(WimaPlanerLog)
<< "StateMachine::updateState: Unknown event: " << e;
Q_ASSERT(false);
break;
}
break; // STATE::NEEDS_SURVEY_UPDATE
case STATE::WAITING_FOR_SURVEY_UPDATE:
switch (e) {
case EVENT::INIT_DONE:
case EVENT::M_AREA_NOT_READY:
setState(STATE::WAITING_FOR_TILE_UPDATE);
break;
case EVENT::M_AREA_READY:
case EVENT::M_AREA_PATH_CHANGED:
case EVENT::S_AREA_PATH_CHANGED:
case EVENT::CORRIDOR_PATH_CHANGED:
......@@ -109,24 +151,28 @@ void StateMachine::updateState(EVENT e) {
case EVENT::J_AREA_UPDATED:
case EVENT::DEPOT_CHANGED:
case EVENT::SURVEY_DESTROYED:
case EVENT::MISSION_ITEMS_DESTROYED:
setState(STATE::NEEDS_SURVEY_UPDATE);
break;
case EVENT::SURVEY_UPDATE_TRIGGERED:
break;
case EVENT::SURVEY_UPDATED:
setState(STATE::NEEDS_PATH_UPDATE);
case EVENT::PATH_CHANGED:
case EVENT::PATH_UPDATED:
break;
default:
qCCritical(WimaPlanerLog)
<< "StateMachine::updateState: Unknown event: " << e;
Q_ASSERT(false);
break;
}
break; // STATE::WAYTING_FOR_SURVEY_UPDATE
case STATE::NEEDS_PATH_UPDATE:
switch (e) {
case EVENT::INIT_DONE:
case EVENT::M_AREA_NOT_READY:
setState(STATE::WAITING_FOR_TILE_UPDATE);
break;
case EVENT::M_AREA_READY:
case EVENT::M_AREA_PATH_CHANGED:
case EVENT::S_AREA_PATH_CHANGED:
case EVENT::CORRIDOR_PATH_CHANGED:
......@@ -137,26 +183,30 @@ void StateMachine::updateState(EVENT e) {
case EVENT::J_AREA_UPDATED:
case EVENT::DEPOT_CHANGED:
case EVENT::SURVEY_DESTROYED:
case EVENT::MISSION_ITEMS_DESTROYED:
setState(STATE::NEEDS_SURVEY_UPDATE);
break;
case EVENT::SURVEY_UPDATE_TRIGGERED:
setState(STATE::WAITING_FOR_SURVEY_UPDATE);
break;
case EVENT::SURVEY_UPDATED:
case EVENT::PATH_CHANGED:
break;
case EVENT::PATH_UPDATED:
setState(STATE::UP_TO_DATE);
break;
default:
qCCritical(WimaPlanerLog)
<< "StateMachine::updateState: Unknown event: " << e;
Q_ASSERT(false);
break;
}
break; // STATE::NEEDS_PATH_UPDATE
case STATE::UP_TO_DATE:
switch (e) {
case EVENT::INIT_DONE:
case EVENT::M_AREA_NOT_READY:
setState(STATE::WAITING_FOR_TILE_UPDATE);
break;
case EVENT::M_AREA_READY:
case EVENT::M_AREA_PATH_CHANGED:
case EVENT::S_AREA_PATH_CHANGED:
case EVENT::CORRIDOR_PATH_CHANGED:
......@@ -167,52 +217,93 @@ void StateMachine::updateState(EVENT e) {
case EVENT::J_AREA_UPDATED:
case EVENT::DEPOT_CHANGED:
case EVENT::SURVEY_DESTROYED:
case EVENT::MISSION_ITEMS_DESTROYED:
setState(STATE::NEEDS_SURVEY_UPDATE);
break;
case EVENT::SURVEY_UPDATE_TRIGGERED:
setState(STATE::WAITING_FOR_SURVEY_UPDATE);
break;
case EVENT::SURVEY_UPDATED:
case EVENT::PATH_CHANGED:
setState(STATE::NEEDS_PATH_UPDATE);
break;
case EVENT::PATH_UPDATED:
break;
default:
qCCritical(WimaPlanerLog)
<< "StateMachine::updateState: Unknown event: " << e;
Q_ASSERT(false);
break;
}
break; // STATE::UP_TO_DATE
default:
qCCritical(WimaPlanerLog)
<< "StateMachine::updateState: Unknown state: " << this->_state;
Q_ASSERT(false);
break;
}
}
bool StateMachine::upToDate() { return this->_state == STATE::UP_TO_DATE; }
bool StateMachine::upToDate() { return upToDate(this->_state); }
bool StateMachine::surveyReady() { return surveyReady(this->_state); }
void StateMachine::setState(STATE s) {
if (this->_state != s) {
auto oldState = this->_state;
this->_state = s;
emit stateChanged();
if (oldState == STATE::UP_TO_DATE || s == STATE::UP_TO_DATE) {
if (upToDate(oldState) != upToDate(s)) {
emit upToDateChanged();
}
if (surveyReady(oldState) != surveyReady(s)) {
emit surveyReady();
}
qCDebug(WimaPlanerLog) << "StateMachine::setState():" << oldState << "->"
<< s;
}
}
QDebug &operator<<(QDebug &ds, STATE s) {
bool StateMachine::surveyReady(STATE s) {
// Using a switch to enable compiler checking of used states.
bool value = false;
switch (s) {
case STATE::NEEDS_INIT:
case STATE::WAITING_FOR_TILE_UPDATE:
case STATE::NEEDS_J_AREA_UPDATE:
case STATE::NEEDS_SURVEY_UPDATE:
case STATE::WAITING_FOR_SURVEY_UPDATE:
break;
case STATE::NEEDS_PATH_UPDATE:
case STATE::UP_TO_DATE:
value = true;
break;
}
return value;
}
bool StateMachine::upToDate(STATE s) {
// Using a switch to enable compiler checking of used states.
bool value = false;
switch (s) {
case STATE::NEEDS_INIT:
case STATE::WAITING_FOR_TILE_UPDATE:
case STATE::NEEDS_J_AREA_UPDATE:
case STATE::NEEDS_SURVEY_UPDATE:
case STATE::WAITING_FOR_SURVEY_UPDATE:
case STATE::NEEDS_PATH_UPDATE:
break;
case STATE::UP_TO_DATE:
value = true;
break;
}
return value;
}
QDebug &operator<<(QDebug &ds, STATE s) {
switch (s) {
case STATE::NEEDS_INIT:
ds << "NEEDS_INIT";
break;
case STATE::WAITING_FOR_TILE_UPDATE:
ds << "WAITING_FOR_TILE_UPDATE";
break;
case STATE::NEEDS_J_AREA_UPDATE:
ds << "NEEDS_J_AREA_UPDATE";
break;
......@@ -237,6 +328,12 @@ QDebug &operator<<(QDebug &ds, EVENT s) {
case EVENT::INIT_DONE:
ds << "INIT_DONE";
break;
case EVENT::M_AREA_NOT_READY:
ds << "M_AREA_NOT_READY";
break;
case EVENT::M_AREA_READY:
ds << "M_AREA_READY";
break;
case EVENT::M_AREA_PATH_CHANGED:
ds << "M_AREA_PATH_CHANGED";
break;
......@@ -261,12 +358,18 @@ QDebug &operator<<(QDebug &ds, EVENT s) {
case EVENT::SURVEY_DESTROYED:
ds << "SURVEY_DESTROYED";
break;
case EVENT::MISSION_ITEMS_DESTROYED:
ds << "MISSION_ITEMS_DESTROYED";
break;
case EVENT::SURVEY_UPDATE_TRIGGERED:
ds << "SURVEY_UPDATE_TRIGGERED";
break;
case EVENT::SURVEY_UPDATED:
ds << "SURVEY_UPDATED";
break;
case EVENT::PATH_CHANGED:
ds << "PATH_CHANGED";
break;
case EVENT::PATH_UPDATED:
ds << "PATH_UPDATED";
break;
......
......@@ -7,6 +7,7 @@ namespace wima_planer_detail {
enum class STATE {
NEEDS_INIT,
WAITING_FOR_TILE_UPDATE,
NEEDS_J_AREA_UPDATE,
NEEDS_SURVEY_UPDATE,
WAITING_FOR_SURVEY_UPDATE,
......@@ -18,6 +19,8 @@ QDebug &operator<<(QDebug &ds, STATE s);
enum class EVENT {
INIT_DONE,
M_AREA_NOT_READY,
M_AREA_READY,
M_AREA_PATH_CHANGED,
S_AREA_PATH_CHANGED,
CORRIDOR_PATH_CHANGED,
......@@ -26,9 +29,11 @@ enum class EVENT {
J_AREA_UPDATED,
DEPOT_CHANGED,
SURVEY_DESTROYED,
MISSION_ITEMS_DESTROYED,
SURVEY_UPDATE_TRIGGERED,
SURVEY_UPDATED,
PATH_UPDATED,
PATH_CHANGED,
PATH_UPDATED
};
QDebug &operator<<(QDebug &ds, EVENT s);
......@@ -41,13 +46,17 @@ public:
STATE state();
void updateState(EVENT e);
bool upToDate();
bool surveyReady();
signals:
void stateChanged();
void upToDateChanged();
void surveyReadyChanged();
private:
void setState(STATE s);
bool surveyReady(STATE s);
bool upToDate(STATE s);
STATE _state;
};
......
This diff is collapsed.
......@@ -56,6 +56,8 @@ public:
Q_PROPERTY(NemoInterface *nemoInterface READ nemoInterface CONSTANT)
Q_PROPERTY(bool synchronized READ synchronized NOTIFY synchronizedChanged)
Q_PROPERTY(bool needsUpdate READ needsUpdate NOTIFY needsUpdateChanged)
Q_PROPERTY(bool readyForSynchronization READ readyForSynchronization NOTIFY
readyForSynchronizationChanged)
// Property accessors
PlanMasterController *masterController(void);
......@@ -71,6 +73,7 @@ public:
NemoInterface *nemoInterface(void);
bool synchronized();
bool needsUpdate();
bool readyForSynchronization();
// Property setters
void setMasterController(PlanMasterController *masterController);
......@@ -116,6 +119,7 @@ signals:
void wimaBridgeChanged();
void synchronizedChanged(void);
void needsUpdateChanged(void);
void readyForSynchronizationChanged(void);
private slots:
void updatePolygonInteractivity(int index);
......@@ -127,9 +131,14 @@ private slots:
void mAreaTilesChangedHandler();
void mAreaProgressChangedHandler();
void mAreaProgressAcceptedHandler();
void mAreaReadyChangedHandler();
void sAreaPathChangedHandler();
void corridorPathChangedHandler();
void depotChangedHandler();
void missionControllerVisualItemsChangedHandler();
void missionControllerWaypointPathChangedHandler();
void missionControllerNewItemsFromVehicleHandler();
void missionControllerMissionItemCountChangedHandler();
#ifndef NDEBUG
void autoLoadMission(void);
......@@ -147,8 +156,12 @@ private:
const QGeoCoordinate &destination,
QVector<QGeoCoordinate> &path);
void setSynchronized(bool s);
void enableMonitoring();
void disableMonitoring();
void enableAreaMonitoring();
void disableAreaMonitoring();
void enableMissionControllerMonitoring();
void disableMissionControllerMonitoring();
bool areasMonitored();
bool missionControllerMonitored();
// Member Variables
PlanMasterController *_masterController;
......@@ -189,4 +202,6 @@ private:
// State
QScopedPointer<wima_planer_detail::StateMachine> _stateMachine;
bool _areasMonitored;
bool _missionControllerMonitored;
};
......@@ -138,7 +138,7 @@ Rectangle {
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.left: logoRow.right
anchors.right: uploadButton.left
anchors.right: buttonsRow.left
font.pointSize: ScreenTools.largeFontPointSize
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
......@@ -153,7 +153,7 @@ Rectangle {
anchors.leftMargin: _margins
anchors.rightMargin: _margins
anchors.left: logoRow.right
anchors.right: uploadButton.visible ? uploadButton.left : parent.right
anchors.right: buttonsRow.left
columnSpacing: 0
columns: 4
......@@ -346,19 +346,22 @@ Rectangle {
}