diff --git a/src/MissionManager/MavCmdInfo.json b/src/MissionManager/MavCmdInfo.json index b3737f3a0f41c4743d1310ead247455ff6f2a429..ca24d058efd0239a396ab7b5d2197db8ed43fd35 100644 --- a/src/MissionManager/MavCmdInfo.json +++ b/src/MissionManager/MavCmdInfo.json @@ -150,6 +150,7 @@ "friendlyName": "Region of interest (nav)", "description": "Sets the region of interest for cameras.", "specifiesCoordinate": true, + "standaloneCoordinate": true, "friendlyEdit": true, "category": "Camera", "param1": { @@ -393,11 +394,12 @@ { "id": 191, "rawName": "MAV_CMD_DO_GO_AROUND", "friendlyName": "MAV_CMD_DO_GO_AROUND" }, { "id": 200, "rawName": "MAV_CMD_DO_CONTROL_VIDEO", "friendlyName": "MAV_CMD_DO_CONTROL_VIDEO" }, { - "id": 201, - "rawName": "MAV_CMD_DO_SET_ROI", - "friendlyName": "Region of interest (cmd)" , - "description": "Sets the region of interest for cameras.", + "id": 201, + "rawName": "MAV_CMD_DO_SET_ROI", + "friendlyName": "Region of interest (cmd)" , + "description": "Sets the region of interest for cameras.", "specifiesCoordinate": true, + "standaloneCoordinate": true, "friendlyEdit": true, "category": "Camera", "param1": { diff --git a/src/MissionManager/MissionCommands.cc b/src/MissionManager/MissionCommands.cc index 42d2903e1fcb20ceb079bbe67b3787026d615d8b..0f6a1e14fc49cfaf1718bed24e949d274b8b966e 100644 --- a/src/MissionManager/MissionCommands.cc +++ b/src/MissionManager/MissionCommands.cc @@ -49,6 +49,7 @@ const QString MissionCommands::_param3JsonKey (QStringLiteral("par const QString MissionCommands::_param4JsonKey (QStringLiteral("param4")); const QString MissionCommands::_paramJsonKeyFormat (QStringLiteral("param%1")); const QString MissionCommands::_rawNameJsonKey (QStringLiteral("rawName")); +const QString MissionCommands::_standaloneCoordinateJsonKey (QStringLiteral("standaloneCoordinate")); const QString MissionCommands::_specifiesCoordinateJsonKey (QStringLiteral("specifiesCoordinate")); const QString MissionCommands::_unitsJsonKey (QStringLiteral("units")); const QString MissionCommands::_versionJsonKey (QStringLiteral("version")); @@ -129,9 +130,9 @@ void MissionCommands::_loadMavCmdInfoJson(void) QStringList keys; QList types; - keys << _idJsonKey << _rawNameJsonKey << _friendlyNameJsonKey << _descriptionJsonKey << _specifiesCoordinateJsonKey << _friendlyEditJsonKey + keys << _idJsonKey << _rawNameJsonKey << _friendlyNameJsonKey << _descriptionJsonKey << _standaloneCoordinateJsonKey << _specifiesCoordinateJsonKey <<_friendlyEditJsonKey << _param1JsonKey << _param2JsonKey << _param3JsonKey << _param4JsonKey << _categoryJsonKey; - types << QJsonValue::Double << QJsonValue::String << QJsonValue::String<< QJsonValue::String << QJsonValue::Bool << QJsonValue::Bool + types << QJsonValue::Double << QJsonValue::String << QJsonValue::String<< QJsonValue::String << QJsonValue::Bool << QJsonValue::Bool << QJsonValue::Bool << QJsonValue::Object << QJsonValue::Object << QJsonValue::Object << QJsonValue::Object << QJsonValue::String; if (!_validateKeyTypes(jsonObject, keys, types)) { return; @@ -144,6 +145,7 @@ void MissionCommands::_loadMavCmdInfoJson(void) mavCmdInfo->_rawName = jsonObject.value(_rawNameJsonKey).toString(); mavCmdInfo->_friendlyName = jsonObject.value(_friendlyNameJsonKey).toString(QString()); mavCmdInfo->_description = jsonObject.value(_descriptionJsonKey).toString(QString()); + mavCmdInfo->_standaloneCoordinate = jsonObject.value(_standaloneCoordinateJsonKey).toBool(false); mavCmdInfo->_specifiesCoordinate = jsonObject.value(_specifiesCoordinateJsonKey).toBool(false); mavCmdInfo->_friendlyEdit = jsonObject.value(_friendlyEditJsonKey).toBool(false); @@ -153,6 +155,7 @@ void MissionCommands::_loadMavCmdInfoJson(void) << mavCmdInfo->_rawName << mavCmdInfo->_friendlyName << mavCmdInfo->_description + << mavCmdInfo->_standaloneCoordinate << mavCmdInfo->_specifiesCoordinate << mavCmdInfo->_friendlyEdit; diff --git a/src/MissionManager/MissionCommands.h b/src/MissionManager/MissionCommands.h index bd1b60c9e9205ede66590ef62ed7df7e3b8f9c71..ce2f214f1c9378e390d1e6e7363700df6ba4e74b 100644 --- a/src/MissionManager/MissionCommands.h +++ b/src/MissionManager/MissionCommands.h @@ -88,13 +88,14 @@ public: } - Q_PROPERTY(QString category READ category CONSTANT) - Q_PROPERTY(MavlinkQmlSingleton::Qml_MAV_CMD command READ command CONSTANT) - Q_PROPERTY(QString description READ description CONSTANT) - Q_PROPERTY(bool friendlyEdit READ friendlyEdit CONSTANT) - Q_PROPERTY(QString friendlyName READ friendlyName CONSTANT) - Q_PROPERTY(QString rawName READ rawName CONSTANT) - Q_PROPERTY(bool specifiesCoordinate READ specifiesCoordinate CONSTANT) + Q_PROPERTY(QString category READ category CONSTANT) + Q_PROPERTY(MavlinkQmlSingleton::Qml_MAV_CMD command READ command CONSTANT) + Q_PROPERTY(QString description READ description CONSTANT) + Q_PROPERTY(bool friendlyEdit READ friendlyEdit CONSTANT) + Q_PROPERTY(QString friendlyName READ friendlyName CONSTANT) + Q_PROPERTY(QString rawName READ rawName CONSTANT) + Q_PROPERTY(bool standaloneCoordinate READ standaloneCoordinate CONSTANT) + Q_PROPERTY(bool specifiesCoordinate READ specifiesCoordinate CONSTANT) QString category (void) const { return _category; } MavlinkQmlSingleton::Qml_MAV_CMD command(void) const { return (MavlinkQmlSingleton::Qml_MAV_CMD)_command; } @@ -102,6 +103,7 @@ public: bool friendlyEdit (void) const { return _friendlyEdit; } QString friendlyName (void) const { return _friendlyName; } QString rawName (void) const { return _rawName; } + bool standaloneCoordinate(void) const { return _standaloneCoordinate; } bool specifiesCoordinate (void) const { return _specifiesCoordinate; } const QMap& paramInfoMap(void) const { return _paramInfoMap; } @@ -114,6 +116,7 @@ private: QString _friendlyName; QMap _paramInfoMap; QString _rawName; + bool _standaloneCoordinate; bool _specifiesCoordinate; friend class MissionCommands; @@ -170,6 +173,7 @@ private: static const QString _param4JsonKey; static const QString _paramJsonKeyFormat; static const QString _rawNameJsonKey; + static const QString _standaloneCoordinateJsonKey; static const QString _specifiesCoordinateJsonKey; static const QString _unitsJsonKey; static const QString _versionJsonKey; diff --git a/src/MissionManager/MissionController.cc b/src/MissionManager/MissionController.cc index 93d8d9b4e6ae86bf3e9d18824baa6e9549ce1217..13cea6fa0055314a8d045533303b8bc11f93da50 100644 --- a/src/MissionManager/MissionController.cc +++ b/src/MissionManager/MissionController.cc @@ -346,7 +346,7 @@ void MissionController::_recalcWaypointLines(void) item->setAzimuth(0.0); item->setDistance(-1.0); - if (item->specifiesCoordinate()) { + if (item->specifiesCoordinate() && !item->standaloneCoordinate()) { if (firstCoordinateItem) { if (item->command() == MavlinkQmlSingleton::MAV_CMD_NAV_TAKEOFF) { // The first coordinate we hit is a takeoff command so link back to home position if valid @@ -628,7 +628,7 @@ bool MissionController::_findLastAltitude(double* lastAltitude) for (int i=0; i<_missionItems->count(); i++) { MissionItem* item = qobject_cast(_missionItems->get(i)); - if (item->specifiesCoordinate()) { + if (item->specifiesCoordinate() && !item->standaloneCoordinate()) { foundAltitude = item->param7(); found = true; } diff --git a/src/MissionManager/MissionItem.cc b/src/MissionManager/MissionItem.cc index 15ae2657c004bc19ed2cb28a9d0865734b8bc62e..be7969b96e3226187c490fefd8a78374a7e536b2 100644 --- a/src/MissionManager/MissionItem.cc +++ b/src/MissionManager/MissionItem.cc @@ -504,6 +504,11 @@ void MissionItem::setParam7(double param) } } +bool MissionItem::standaloneCoordinate(void) const +{ + return _mavCmdInfoMap[(MAV_CMD)command()]->standaloneCoordinate(); +} + bool MissionItem::specifiesCoordinate(void) const { return _mavCmdInfoMap[(MAV_CMD)command()]->specifiesCoordinate(); diff --git a/src/MissionManager/MissionItem.h b/src/MissionManager/MissionItem.h index 5dff90c7a6b314c82e5a52c1e6d9740d41ce5b05..078a9789384f37298070dbcc3f533cf47c821f98 100644 --- a/src/MissionManager/MissionItem.h +++ b/src/MissionManager/MissionItem.h @@ -68,23 +68,24 @@ public: const MissionItem& operator=(const MissionItem& other); - Q_PROPERTY(double altDifference READ altDifference WRITE setAltDifference NOTIFY altDifferenceChanged) ///< Change in altitude from previous waypoint - Q_PROPERTY(double azimuth READ azimuth WRITE setAzimuth NOTIFY azimuthChanged) ///< Azimuth to previous waypoint - Q_PROPERTY(QString category READ category NOTIFY commandChanged) - Q_PROPERTY(MavlinkQmlSingleton::Qml_MAV_CMD command READ command WRITE setCommand NOTIFY commandChanged) - Q_PROPERTY(QString commandDescription READ commandDescription NOTIFY commandChanged) - Q_PROPERTY(QString commandName READ commandName NOTIFY commandChanged) - Q_PROPERTY(QGeoCoordinate coordinate READ coordinate WRITE setCoordinate NOTIFY coordinateChanged) - Q_PROPERTY(bool dirty READ dirty WRITE setDirty NOTIFY dirtyChanged) - Q_PROPERTY(double distance READ distance WRITE setDistance NOTIFY distanceChanged) ///< Distance to previous waypoint - Q_PROPERTY(bool friendlyEditAllowed READ friendlyEditAllowed NOTIFY friendlyEditAllowedChanged) - Q_PROPERTY(bool homePosition READ homePosition CONSTANT) ///< true: This item is being used as a home position indicator - Q_PROPERTY(bool homePositionValid READ homePositionValid WRITE setHomePositionValid NOTIFY homePositionValidChanged) ///< true: Home position should be shown - Q_PROPERTY(bool isCurrentItem READ isCurrentItem WRITE setIsCurrentItem NOTIFY isCurrentItemChanged) - Q_PROPERTY(bool rawEdit READ rawEdit WRITE setRawEdit NOTIFY rawEditChanged) ///< true: raw item editing with all params - Q_PROPERTY(int sequenceNumber READ sequenceNumber WRITE setSequenceNumber NOTIFY sequenceNumberChanged) - Q_PROPERTY(bool specifiesCoordinate READ specifiesCoordinate NOTIFY commandChanged) - Q_PROPERTY(Fact* supportedCommand READ supportedCommand NOTIFY commandChanged) + Q_PROPERTY(double altDifference READ altDifference WRITE setAltDifference NOTIFY altDifferenceChanged) ///< Change in altitude from previous waypoint + Q_PROPERTY(double azimuth READ azimuth WRITE setAzimuth NOTIFY azimuthChanged) ///< Azimuth to previous waypoint + Q_PROPERTY(QString category READ category NOTIFY commandChanged) + Q_PROPERTY(MavlinkQmlSingleton::Qml_MAV_CMD command READ command WRITE setCommand NOTIFY commandChanged) + Q_PROPERTY(QString commandDescription READ commandDescription NOTIFY commandChanged) + Q_PROPERTY(QString commandName READ commandName NOTIFY commandChanged) + Q_PROPERTY(QGeoCoordinate coordinate READ coordinate WRITE setCoordinate NOTIFY coordinateChanged) + Q_PROPERTY(bool dirty READ dirty WRITE setDirty NOTIFY dirtyChanged) + Q_PROPERTY(double distance READ distance WRITE setDistance NOTIFY distanceChanged) ///< Distance to previous waypoint + Q_PROPERTY(bool friendlyEditAllowed READ friendlyEditAllowed NOTIFY friendlyEditAllowedChanged) + Q_PROPERTY(bool homePosition READ homePosition CONSTANT) ///< true: This item is being used as a home position indicator + Q_PROPERTY(bool homePositionValid READ homePositionValid WRITE setHomePositionValid NOTIFY homePositionValidChanged) ///< true: Home position should be shown + Q_PROPERTY(bool isCurrentItem READ isCurrentItem WRITE setIsCurrentItem NOTIFY isCurrentItemChanged) + Q_PROPERTY(bool rawEdit READ rawEdit WRITE setRawEdit NOTIFY rawEditChanged) ///< true: raw item editing with all params + Q_PROPERTY(int sequenceNumber READ sequenceNumber WRITE setSequenceNumber NOTIFY sequenceNumberChanged) + Q_PROPERTY(bool standaloneCoordinate READ standaloneCoordinate NOTIFY commandChanged) + Q_PROPERTY(bool specifiesCoordinate READ specifiesCoordinate NOTIFY commandChanged) + Q_PROPERTY(Fact* supportedCommand READ supportedCommand NOTIFY commandChanged) // These properties are used to display the editing ui Q_PROPERTY(QmlObjectListModel* checkboxFacts READ checkboxFacts NOTIFY uiModelChanged) @@ -112,6 +113,7 @@ public: bool isCurrentItem (void) const { return _isCurrentItem; } bool rawEdit (void) const; int sequenceNumber (void) const { return _sequenceNumber; } + bool standaloneCoordinate(void) const; bool specifiesCoordinate (void) const; Fact* supportedCommand (void) { return &_supportedCommandFact; }