Unverified Commit a95b2d32 authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #6836 from DonLakeFlyer/ResumeMission

Fix Resume Mission item count bug
parents 31fa444d 82cceb1a
...@@ -4,8 +4,13 @@ Note: This file only contains high level features or important fixes. ...@@ -4,8 +4,13 @@ Note: This file only contains high level features or important fixes.
## 3.4 ## 3.4
### 3.4.3 - Not yet released
* Fix bug where Resume Mission would not display correctly in some cases. Issue #6835.
### 3.4.2
* Fix bug where new mission items may end up with 0 altitude internally and sent to vehicle while UI shows correct altitude. Issue #6823.
### 3.4.1 ### 3.4.1
* Fix bug where new mission items may end up with 0 altitude internally and sent to vehicle while UI shows correct altitude.
* Fix crash when Survery with terrain follow is moved quickly * Fix crash when Survery with terrain follow is moved quickly
* Fix terrain follow climb/descent rate fields swapped in ui * Fix terrain follow climb/descent rate fields swapped in ui
...@@ -101,18 +101,19 @@ Item { ...@@ -101,18 +101,19 @@ Item {
property bool showTakeoff: _guidedActionsEnabled && _activeVehicle.takeoffVehicleSupported && !_vehicleFlying property bool showTakeoff: _guidedActionsEnabled && _activeVehicle.takeoffVehicleSupported && !_vehicleFlying
property bool showLand: _guidedActionsEnabled && _activeVehicle.guidedModeSupported && _vehicleArmed && !_activeVehicle.fixedWing && !_vehicleInLandMode property bool showLand: _guidedActionsEnabled && _activeVehicle.guidedModeSupported && _vehicleArmed && !_activeVehicle.fixedWing && !_vehicleInLandMode
property bool showStartMission: _guidedActionsEnabled && _missionAvailable && !_missionActive && !_vehicleFlying property bool showStartMission: _guidedActionsEnabled && _missionAvailable && !_missionActive && !_vehicleFlying
property bool showContinueMission: _guidedActionsEnabled && _missionAvailable && !_missionActive && _vehicleArmed && _vehicleFlying && (_currentMissionIndex < missionController.visualItems.count - 1) property bool showContinueMission: _guidedActionsEnabled && _missionAvailable && !_missionActive && _vehicleArmed && _vehicleFlying && (_currentMissionIndex < _missionItemCount - 1)
property bool showPause: _guidedActionsEnabled && _vehicleArmed && _activeVehicle.pauseVehicleSupported && _vehicleFlying && !_vehiclePaused property bool showPause: _guidedActionsEnabled && _vehicleArmed && _activeVehicle.pauseVehicleSupported && _vehicleFlying && !_vehiclePaused
property bool showChangeAlt: _guidedActionsEnabled && _vehicleFlying && _activeVehicle.guidedModeSupported && _vehicleArmed && !_missionActive property bool showChangeAlt: _guidedActionsEnabled && _vehicleFlying && _activeVehicle.guidedModeSupported && _vehicleArmed && !_missionActive
property bool showOrbit: _guidedActionsEnabled && !_hideOrbit && _vehicleFlying && _activeVehicle.orbitModeSupported && !_missionActive property bool showOrbit: _guidedActionsEnabled && !_hideOrbit && _vehicleFlying && _activeVehicle.orbitModeSupported && !_missionActive
property bool showLandAbort: _guidedActionsEnabled && _vehicleFlying && _activeVehicle.fixedWing && _vehicleLanding property bool showLandAbort: _guidedActionsEnabled && _vehicleFlying && _activeVehicle.fixedWing && _vehicleLanding
property bool showGotoLocation: _guidedActionsEnabled && _vehicleFlying property bool showGotoLocation: _guidedActionsEnabled && _vehicleFlying
// Note: The 'missionController.visualItems.count - 3' is a hack to not trigger resume mission when a mission ends with an RTL item // Note: The '_missionItemCount - 2' is a hack to not trigger resume mission when a mission ends with an RTL item
property bool showResumeMission: _activeVehicle && !_vehicleArmed && _vehicleWasFlying && _missionAvailable && _resumeMissionIndex > 0 && (_resumeMissionIndex < missionController.visualItems.count - 3) property bool showResumeMission: _activeVehicle && !_vehicleArmed && _vehicleWasFlying && _missionAvailable && _resumeMissionIndex > 0 && (_resumeMissionIndex < _missionItemCount - 2)
property bool guidedUIVisible: guidedActionConfirm.visible || guidedActionList.visible property bool guidedUIVisible: guidedActionConfirm.visible || guidedActionList.visible
property var _corePlugin: QGroundControl.corePlugin
property bool _guidedActionsEnabled: (!ScreenTools.isDebug && QGroundControl.corePlugin.options.guidedActionsRequireRCRSSI && _activeVehicle) ? _rcRSSIAvailable : _activeVehicle property bool _guidedActionsEnabled: (!ScreenTools.isDebug && QGroundControl.corePlugin.options.guidedActionsRequireRCRSSI && _activeVehicle) ? _rcRSSIAvailable : _activeVehicle
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property string _flightMode: _activeVehicle ? _activeVehicle.flightMode : "" property string _flightMode: _activeVehicle ? _activeVehicle.flightMode : ""
...@@ -125,6 +126,7 @@ Item { ...@@ -125,6 +126,7 @@ Item {
property bool _vehicleInMissionMode: false property bool _vehicleInMissionMode: false
property bool _vehicleInRTLMode: false property bool _vehicleInRTLMode: false
property bool _vehicleInLandMode: false property bool _vehicleInLandMode: false
property int _missionItemCount: missionController.missionItemCount
property int _currentMissionIndex: missionController.currentMissionIndex property int _currentMissionIndex: missionController.currentMissionIndex
property int _resumeMissionIndex: missionController.resumeMissionIndex property int _resumeMissionIndex: missionController.resumeMissionIndex
property bool _hideEmergenyStop: !QGroundControl.corePlugin.options.guidedBarShowEmergencyStop property bool _hideEmergenyStop: !QGroundControl.corePlugin.options.guidedBarShowEmergencyStop
...@@ -132,15 +134,14 @@ Item { ...@@ -132,15 +134,14 @@ Item {
property bool _vehicleWasFlying: false property bool _vehicleWasFlying: false
property bool _rcRSSIAvailable: _activeVehicle ? _activeVehicle.rcRSSI > 0 && _activeVehicle.rcRSSI <= 100 : false property bool _rcRSSIAvailable: _activeVehicle ? _activeVehicle.rcRSSI > 0 && _activeVehicle.rcRSSI <= 100 : false
//Handy code for debugging state problems // You can turn on log output for GuidedActionsController by turning on GuidedActionsControllerLog category
property bool __debugGuidedStates: false
property bool __guidedModeSupported: _activeVehicle ? _activeVehicle.guidedModeSupported : false property bool __guidedModeSupported: _activeVehicle ? _activeVehicle.guidedModeSupported : false
property bool __pauseVehicleSupported: _activeVehicle ? _activeVehicle.pauseVehicleSupported : false property bool __pauseVehicleSupported: _activeVehicle ? _activeVehicle.pauseVehicleSupported : false
property bool __flightMode: _flightMode property bool __flightMode: _flightMode
function _outputState() { function _outputState() {
if (__debugGuidedStates) { if (_corePlugin.guidedActionsControllerLogging()) {
console.log(qsTr("_activeVehicle(%1) _vehicleArmed(%2) guidedModeSupported(%3) _vehicleFlying(%4) _vehicleInRTLMode(%5) pauseVehicleSupported(%6) _vehiclePaused(%7) _flightMode(%8)").arg(_activeVehicle ? 1 : 0).arg(_vehicleArmed ? 1 : 0).arg(__guidedModeSupported ? 1 : 0).arg(_vehicleFlying ? 1 : 0).arg(_vehicleInRTLMode ? 1 : 0).arg(__pauseVehicleSupported ? 1 : 0).arg(_vehiclePaused ? 1 : 0).arg(_flightMode)) console.log(qsTr("_activeVehicle(%1) _vehicleArmed(%2) guidedModeSupported(%3) _vehicleFlying(%4) _vehicleWasFlying(%5) _vehicleInRTLMode(%6) pauseVehicleSupported(%7) _vehiclePaused(%8) _flightMode(%9) _missionItemCount(%10)").arg(_activeVehicle ? 1 : 0).arg(_vehicleArmed ? 1 : 0).arg(__guidedModeSupported ? 1 : 0).arg(_vehicleFlying ? 1 : 0).arg(_vehicleWasFlying ? 1 : 0).arg(_vehicleInRTLMode ? 1 : 0).arg(__pauseVehicleSupported ? 1 : 0).arg(_vehiclePaused ? 1 : 0).arg(_flightMode).arg(_missionItemCount))
} }
} }
...@@ -152,31 +153,32 @@ Item { ...@@ -152,31 +153,32 @@ Item {
on__FlightModeChanged: _outputState() on__FlightModeChanged: _outputState()
on__GuidedModeSupportedChanged: _outputState() on__GuidedModeSupportedChanged: _outputState()
on__PauseVehicleSupportedChanged: _outputState() on__PauseVehicleSupportedChanged: _outputState()
on_MissionItemCountChanged: _outputState()
on_CurrentMissionIndexChanged: { on_CurrentMissionIndexChanged: {
if (__debugGuidedStates) { if (_corePlugin.guidedActionsControllerLogging()) {
console.log("_currentMissionIndex", _currentMissionIndex) console.log("_currentMissionIndex", _currentMissionIndex)
} }
} }
on_ResumeMissionIndexChanged: { on_ResumeMissionIndexChanged: {
if (__debugGuidedStates) { if (_corePlugin.guidedActionsControllerLogging()) {
console.log("_resumeMissionIndex", _resumeMissionIndex) console.log("_resumeMissionIndex", _resumeMissionIndex)
} }
} }
onShowResumeMissionChanged: { onShowResumeMissionChanged: {
if (__debugGuidedStates) { if (_corePlugin.guidedActionsControllerLogging()) {
console.log("showResumeMission", showResumeMission) console.log("showResumeMission", showResumeMission)
} }
_outputState() _outputState()
} }
onShowStartMissionChanged: { onShowStartMissionChanged: {
if (__debugGuidedStates) { if (_corePlugin.guidedActionsControllerLogging()) {
console.log("showStartMission", showStartMission) console.log("showStartMission", showStartMission)
} }
_outputState() _outputState()
} }
onShowContinueMissionChanged: { onShowContinueMissionChanged: {
if (__debugGuidedStates) { if (_corePlugin.guidedActionsControllerLogging()) {
console.log("showContinueMission", showContinueMission) console.log("showContinueMission", showContinueMission)
} }
_outputState() _outputState()
......
...@@ -56,8 +56,9 @@ const int MissionController::_missionFileVersion = 2; ...@@ -56,8 +56,9 @@ const int MissionController::_missionFileVersion = 2;
MissionController::MissionController(PlanMasterController* masterController, QObject *parent) MissionController::MissionController(PlanMasterController* masterController, QObject *parent)
: PlanElementController (masterController, parent) : PlanElementController (masterController, parent)
, _missionManager (_managerVehicle->missionManager()) , _missionManager (_managerVehicle->missionManager())
, _visualItems (NULL) , _missionItemCount (0)
, _settingsItem (NULL) , _visualItems (nullptr)
, _settingsItem (nullptr)
, _firstItemsFromVehicle (false) , _firstItemsFromVehicle (false)
, _itemsRequested (false) , _itemsRequested (false)
, _inRecalcSequence (false) , _inRecalcSequence (false)
...@@ -68,7 +69,7 @@ MissionController::MissionController(PlanMasterController* masterController, QOb ...@@ -68,7 +69,7 @@ MissionController::MissionController(PlanMasterController* masterController, QOb
, _appSettings (qgcApp()->toolbox()->settingsManager()->appSettings()) , _appSettings (qgcApp()->toolbox()->settingsManager()->appSettings())
, _progressPct (0) , _progressPct (0)
, _currentPlanViewIndex (-1) , _currentPlanViewIndex (-1)
, _currentPlanViewItem (NULL) , _currentPlanViewItem (nullptr)
{ {
_resetMissionFlightStatus(); _resetMissionFlightStatus();
managerVehicleChanged(_managerVehicle); managerVehicleChanged(_managerVehicle);
...@@ -159,6 +160,9 @@ void MissionController::_newMissionItemsAvailableFromVehicle(bool removeAllReque ...@@ -159,6 +160,9 @@ void MissionController::_newMissionItemsAvailableFromVehicle(bool removeAllReque
const QList<MissionItem*>& newMissionItems = _missionManager->missionItems(); const QList<MissionItem*>& newMissionItems = _missionManager->missionItems();
qCDebug(MissionControllerLog) << "loading from vehicle: count"<< newMissionItems.count(); qCDebug(MissionControllerLog) << "loading from vehicle: count"<< newMissionItems.count();
_missionItemCount = newMissionItems.count();
emit missionItemCountChanged(_missionItemCount);
int i = 0; int i = 0;
if (_controllerVehicle->firmwarePlugin()->sendHomePositionToVehicle() && newMissionItems.count() != 0) { if (_controllerVehicle->firmwarePlugin()->sendHomePositionToVehicle() && newMissionItems.count() != 0) {
// First item is fake home position // First item is fake home position
......
...@@ -73,6 +73,7 @@ public: ...@@ -73,6 +73,7 @@ public:
Q_PROPERTY(double progressPct READ progressPct NOTIFY progressPctChanged) Q_PROPERTY(double progressPct READ progressPct NOTIFY progressPctChanged)
Q_PROPERTY(int missionItemCount READ missionItemCount NOTIFY missionItemCountChanged) ///< True mission item command count (only valid in Fly View)
Q_PROPERTY(int currentMissionIndex READ currentMissionIndex NOTIFY currentMissionIndexChanged) Q_PROPERTY(int currentMissionIndex READ currentMissionIndex NOTIFY currentMissionIndexChanged)
Q_PROPERTY(int resumeMissionIndex READ resumeMissionIndex NOTIFY resumeMissionIndexChanged) ///< Returns the item index two which a mission should be resumed. -1 indicates resume mission not available. Q_PROPERTY(int resumeMissionIndex READ resumeMissionIndex NOTIFY resumeMissionIndexChanged) ///< Returns the item index two which a mission should be resumed. -1 indicates resume mission not available.
...@@ -170,6 +171,7 @@ public: ...@@ -170,6 +171,7 @@ public:
QString corridorScanComplexItemName (void) const { return _corridorScanMissionItemName; } QString corridorScanComplexItemName (void) const { return _corridorScanMissionItemName; }
QString structureScanComplexItemName(void) const { return _structureScanMissionItemName; } QString structureScanComplexItemName(void) const { return _structureScanMissionItemName; }
int missionItemCount (void) const { return _missionItemCount; }
int currentMissionIndex (void) const; int currentMissionIndex (void) const;
int resumeMissionIndex (void) const; int resumeMissionIndex (void) const;
int currentPlanViewIndex (void) const; int currentPlanViewIndex (void) const;
...@@ -208,6 +210,7 @@ signals: ...@@ -208,6 +210,7 @@ signals:
void currentMissionIndexChanged (int currentMissionIndex); void currentMissionIndexChanged (int currentMissionIndex);
void currentPlanViewIndexChanged (void); void currentPlanViewIndexChanged (void);
void currentPlanViewItemChanged (void); void currentPlanViewItemChanged (void);
void missionItemCountChanged (int missionItemCount);
private slots: private slots:
void _newMissionItemsAvailableFromVehicle(bool removeAllRequested); void _newMissionItemsAvailableFromVehicle(bool removeAllRequested);
...@@ -260,6 +263,7 @@ private: ...@@ -260,6 +263,7 @@ private:
private: private:
MissionManager* _missionManager; MissionManager* _missionManager;
int _missionItemCount;
QmlObjectListModel* _visualItems; QmlObjectListModel* _visualItems;
MissionSettingsItem* _settingsItem; MissionSettingsItem* _settingsItem;
QmlObjectListModel _waypointLines; QmlObjectListModel _waypointLines;
......
...@@ -16,13 +16,14 @@ ...@@ -16,13 +16,14 @@
#include <QSettings> #include <QSettings>
// Add Global logging categories (not class specific) here using QGC_LOGGING_CATEGORY // Add Global logging categories (not class specific) here using QGC_LOGGING_CATEGORY
QGC_LOGGING_CATEGORY(FirmwareUpgradeLog, "FirmwareUpgradeLog") QGC_LOGGING_CATEGORY(FirmwareUpgradeLog, "FirmwareUpgradeLog")
QGC_LOGGING_CATEGORY(FirmwareUpgradeVerboseLog, "FirmwareUpgradeVerboseLog") QGC_LOGGING_CATEGORY(FirmwareUpgradeVerboseLog, "FirmwareUpgradeVerboseLog")
QGC_LOGGING_CATEGORY(MissionCommandsLog, "MissionCommandsLog") QGC_LOGGING_CATEGORY(MissionCommandsLog, "MissionCommandsLog")
QGC_LOGGING_CATEGORY(MissionItemLog, "MissionItemLog") QGC_LOGGING_CATEGORY(MissionItemLog, "MissionItemLog")
QGC_LOGGING_CATEGORY(ParameterManagerLog, "ParameterManagerLog") QGC_LOGGING_CATEGORY(ParameterManagerLog, "ParameterManagerLog")
QGC_LOGGING_CATEGORY(GeotaggingLog, "GeotaggingLog") QGC_LOGGING_CATEGORY(GeotaggingLog, "GeotaggingLog")
QGC_LOGGING_CATEGORY(RTKGPSLog, "RTKGPSLog") QGC_LOGGING_CATEGORY(RTKGPSLog, "RTKGPSLog")
QGC_LOGGING_CATEGORY(GuidedActionsControllerLog, "GuidedActionsControllerLog")
QGCLoggingCategoryRegister* _instance = NULL; QGCLoggingCategoryRegister* _instance = NULL;
const char* QGCLoggingCategoryRegister::_filterRulesSettingsGroup = "LoggingFilters"; const char* QGCLoggingCategoryRegister::_filterRulesSettingsGroup = "LoggingFilters";
......
...@@ -25,6 +25,7 @@ Q_DECLARE_LOGGING_CATEGORY(MissionItemLog) ...@@ -25,6 +25,7 @@ Q_DECLARE_LOGGING_CATEGORY(MissionItemLog)
Q_DECLARE_LOGGING_CATEGORY(ParameterManagerLog) Q_DECLARE_LOGGING_CATEGORY(ParameterManagerLog)
Q_DECLARE_LOGGING_CATEGORY(GeotaggingLog) Q_DECLARE_LOGGING_CATEGORY(GeotaggingLog)
Q_DECLARE_LOGGING_CATEGORY(RTKGPSLog) Q_DECLARE_LOGGING_CATEGORY(RTKGPSLog)
Q_DECLARE_LOGGING_CATEGORY(GuidedActionsControllerLog)
/// @def QGC_LOGGING_CATEGORY /// @def QGC_LOGGING_CATEGORY
/// This is a QGC specific replacement for Q_LOGGING_CATEGORY. It will register the category name into a /// This is a QGC specific replacement for Q_LOGGING_CATEGORY. It will register the category name into a
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "AppMessages.h" #include "AppMessages.h"
#include "QmlObjectListModel.h" #include "QmlObjectListModel.h"
#include "VideoReceiver.h" #include "VideoReceiver.h"
#include "QGCLoggingCategory.h"
#include <QtQml> #include <QtQml>
#include <QQmlEngine> #include <QQmlEngine>
...@@ -297,3 +298,8 @@ VideoReceiver* QGCCorePlugin::createVideoReceiver(QObject* parent) ...@@ -297,3 +298,8 @@ VideoReceiver* QGCCorePlugin::createVideoReceiver(QObject* parent)
{ {
return new VideoReceiver(parent); return new VideoReceiver(parent);
} }
bool QGCCorePlugin::guidedActionsControllerLogging(void) const
{
return GuidedActionsControllerLog().isDebugEnabled();
}
...@@ -51,6 +51,8 @@ public: ...@@ -51,6 +51,8 @@ public:
Q_PROPERTY(QString brandImageOutdoor READ brandImageOutdoor CONSTANT) Q_PROPERTY(QString brandImageOutdoor READ brandImageOutdoor CONSTANT)
Q_PROPERTY(QmlObjectListModel* customMapItems READ customMapItems CONSTANT) Q_PROPERTY(QmlObjectListModel* customMapItems READ customMapItems CONSTANT)
Q_INVOKABLE bool guidedActionsControllerLogging(void) const;
/// The list of settings under the Settings Menu /// The list of settings under the Settings Menu
/// @return A list of QGCSettings /// @return A list of QGCSettings
virtual QVariantList& settingsPages(void); virtual QVariantList& settingsPages(void);
......
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