Commit df489c3e authored by Valentin Platzgummer's avatar Valentin Platzgummer

Phase duration and time after smart RTL now displayed correctly

parent 86978aa1
...@@ -608,7 +608,8 @@ QGCView { ...@@ -608,7 +608,8 @@ QGCView {
anchors.leftMargin: ScreenTools.defaultFontPixelWidth anchors.leftMargin: ScreenTools.defaultFontPixelWidth
anchors.bottomMargin: ScreenTools.defaultFontPixelWidth anchors.bottomMargin: ScreenTools.defaultFontPixelWidth
maxWidth: singleMultiSelector.x - ScreenTools.defaultFontPixelHeight*4 maxWidth: singleMultiSelector.x - ScreenTools.defaultFontPixelHeight*4
maxHeight: parent.height - toolStrip.height - toolStrip.y - ScreenTools.defaultFontPixelHeight*4 maxHeight: _flightMap.height - toolStrip.height - toolStrip.y
- ScreenTools.defaultFontPixelHeight*4
wimaController: _wimaController wimaController: _wimaController
...@@ -679,7 +680,7 @@ QGCView { ...@@ -679,7 +680,7 @@ QGCView {
maxHeight: (_flightVideo.visible ? _flightVideo.y : parent.height) - toolStrip.y maxHeight: (_flightVideo.visible ? _flightVideo.y : parent.height) - toolStrip.y
buttonVisible: [ _useChecklist, _guidedController.showTakeoff || !_guidedController.showLand, _guidedController.showLand && !_guidedController.showTakeoff, true, true, true ] buttonVisible: [ _useChecklist, _guidedController.showTakeoff || !_guidedController.showLand, _guidedController.showLand && !_guidedController.showTakeoff, true, true, true ]
buttonEnabled: [ _useChecklist && _activeVehicle, _guidedController.showTakeoff, _guidedController.showLand, _guidedController.showRTL, _guidedController.showPause, _anyActionAvailable ] buttonEnabled: [ _useChecklist && _activeVehicle, _guidedController.showTakeoff, _guidedController.showLand, _guidedController.showRTL, _guidedController.showPause, _anyActionAvailable ]
horizontal: false horizontal: true
enableSwitchButton: true enableSwitchButton: true
property bool _anyActionAvailable: _guidedController.showStartMission || _guidedController.showResumeMission || _guidedController.showChangeAlt || _guidedController.showLandAbort property bool _anyActionAvailable: _guidedController.showStartMission || _guidedController.showResumeMission || _guidedController.showChangeAlt || _guidedController.showLandAbort
......
...@@ -21,6 +21,7 @@ Item { ...@@ -21,6 +21,7 @@ Item {
id: _root id: _root
height: mainFrame.height height: mainFrame.height
width: mainFrame.width width: mainFrame.width
clip: true
property int maxHeight: 500 property int maxHeight: 500
property int maxWidth: 300 property int maxWidth: 300
...@@ -36,6 +37,10 @@ Item { ...@@ -36,6 +37,10 @@ Item {
signal initSmartRTL(); signal initSmartRTL();
DeadMouseArea {
anchors.fill: parent
}
Item { Item {
id: _private id: _private
property bool missionReadyForStart: true property bool missionReadyForStart: true
......
...@@ -42,6 +42,8 @@ WimaController::WimaController(QObject *parent) ...@@ -42,6 +42,8 @@ WimaController::WimaController(QObject *parent)
, _returnPathLength (-1) , _returnPathLength (-1)
, _phaseDistance (-1) , _phaseDistance (-1)
, _phaseDuration (-1) , _phaseDuration (-1)
, _phaseDistanceBuffer (-1)
, _phaseDurationBuffer (-1)
, _vehicleHasLowBattery (false) , _vehicleHasLowBattery (false)
, _lowBatteryHandlingTriggered(false) , _lowBatteryHandlingTriggered(false)
, _executingSmartRTL (false) , _executingSmartRTL (false)
...@@ -807,10 +809,12 @@ bool WimaController::calcNextPhase() ...@@ -807,10 +809,12 @@ bool WimaController::calcNextPhase()
_currentMissionItems.append(visualItemCopy); _currentMissionItems.append(visualItemCopy);
} }
_setPhaseDistance(_measurementPathLength + _arrivalPathLength + _returnPathLength); double dist = 0;
_setPhaseDuration(_measurementPathLength/_flightSpeed.rawValue().toDouble() double time = 0;
+ (_arrivalPathLength + _returnPathLength) if (!_missionController->distanceTimeToMissionEnd(dist, time, 1, false))
/ _arrivalReturnSpeed.rawValue().toDouble()); qWarning("WimaController::calcNextPhase: distanceTimeToMissionEnd returned false!");
_setPhaseDistance(dist);
_setPhaseDuration(time);
_missionController->removeAll(); // remove items from _missionController, will be added on upload _missionController->removeAll(); // remove items from _missionController, will be added on upload
updateAltitude(); updateAltitude();
...@@ -978,6 +982,8 @@ void WimaController::smartRTLCleanUp(bool flying) ...@@ -978,6 +982,8 @@ void WimaController::smartRTLCleanUp(bool flying)
if (_executingSmartRTL) { if (_executingSmartRTL) {
_executingSmartRTL = false; _executingSmartRTL = false;
_loadCurrentMissionItemsFromBuffer(); _loadCurrentMissionItemsFromBuffer();
_setPhaseDistance(_phaseDistanceBuffer);
_setPhaseDuration(_phaseDurationBuffer);
_showAllMissionItems.setRawValue(true); _showAllMissionItems.setRawValue(true);
_missionController->removeAllFromVehicle(); _missionController->removeAllFromVehicle();
_missionController->removeAll(); _missionController->removeAll();
...@@ -1062,6 +1068,9 @@ bool WimaController::_calcReturnPath(QString &errorSring) ...@@ -1062,6 +1068,9 @@ bool WimaController::_calcReturnPath(QString &errorSring)
// qWarning() << "returnPath.size()" << returnPath.size(); // qWarning() << "returnPath.size()" << returnPath.size();
_saveCurrentMissionItemsToBuffer(); _saveCurrentMissionItemsToBuffer();
_phaseDistanceBuffer = _phaseDistance;
_phaseDurationBuffer = _phaseDuration;
// create Mission Items // create Mission Items
removeFromVehicle(); removeFromVehicle();
...@@ -1127,10 +1136,8 @@ bool WimaController::_calcReturnPath(QString &errorSring) ...@@ -1127,10 +1136,8 @@ bool WimaController::_calcReturnPath(QString &errorSring)
} }
//qWarning() << "_currentMissionItems.count()" << _currentMissionItems.count(); //qWarning() << "_currentMissionItems.count()" << _currentMissionItems.count();
_setPhaseDistance(_phaseDistance + _arrivalPathLength + _returnPathLength); _setPhaseDistance(-1);
_setPhaseDuration(_phaseDistance/_flightSpeed.rawValue().toDouble() _setPhaseDuration(-1);
+ (_arrivalPathLength + _returnPathLength)
/ _arrivalReturnSpeed.rawValue().toDouble());
_missionController->removeAll(); // remove items from _missionController, will be added on upload _missionController->removeAll(); // remove items from _missionController, will be added on upload
updateAltitude(); updateAltitude();
......
...@@ -238,6 +238,8 @@ private: ...@@ -238,6 +238,8 @@ private:
double _returnPathLength; // the length of the arrival and return path in meters double _returnPathLength; // the length of the arrival and return path in meters
double _phaseDistance; // the lenth in meters of the current phase double _phaseDistance; // the lenth in meters of the current phase
double _phaseDuration; // the phase duration in seconds double _phaseDuration; // the phase duration in seconds
double _phaseDistanceBuffer; // buffer for storing _phaseDistance when doing smart RTL
double _phaseDurationBuffer; // buffer for storing _phaseDuration when doing smart RTL
QTimer _checkBatteryTimer; QTimer _checkBatteryTimer;
bool _vehicleHasLowBattery; bool _vehicleHasLowBattery;
......
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