Commit fd19b461 authored by DoinLakeFlyer's avatar DoinLakeFlyer

parent cb88912e
...@@ -172,6 +172,7 @@ ...@@ -172,6 +172,7 @@
"friendlyName": "Takeoff", "friendlyName": "Takeoff",
"description": "Launch from the ground and travel towards the specified takeoff position.", "description": "Launch from the ground and travel towards the specified takeoff position.",
"specifiesCoordinate": true, "specifiesCoordinate": true,
"isTakeoffCommand": true,
"friendlyEdit": true, "friendlyEdit": true,
"category": "Basic", "category": "Basic",
"param1": { "param1": {
...@@ -290,6 +291,7 @@ ...@@ -290,6 +291,7 @@
"friendlyName": "VTOL takeoff", "friendlyName": "VTOL takeoff",
"description": "Hover straight up to specified altitude, transition to fixed-wing and fly to the specified takeoff location.", "description": "Hover straight up to specified altitude, transition to fixed-wing and fly to the specified takeoff location.",
"specifiesCoordinate": true, "specifiesCoordinate": true,
"isTakeoffCommand": true,
"friendlyEdit": true, "friendlyEdit": true,
"category": "Basic", "category": "Basic",
"param4": { "param4": {
......
...@@ -38,6 +38,7 @@ const char* MissionCommandUIInfo::_standaloneCoordinateJsonKey = "standaloneCoo ...@@ -38,6 +38,7 @@ const char* MissionCommandUIInfo::_standaloneCoordinateJsonKey = "standaloneCoo
const char* MissionCommandUIInfo::_specifiesCoordinateJsonKey = "specifiesCoordinate"; const char* MissionCommandUIInfo::_specifiesCoordinateJsonKey = "specifiesCoordinate";
const char* MissionCommandUIInfo::_specifiesAltitudeOnlyJsonKey = "specifiesAltitudeOnly"; const char* MissionCommandUIInfo::_specifiesAltitudeOnlyJsonKey = "specifiesAltitudeOnly";
const char* MissionCommandUIInfo::_isLandCommandJsonKey = "isLandCommand"; const char* MissionCommandUIInfo::_isLandCommandJsonKey = "isLandCommand";
const char* MissionCommandUIInfo::_isTakeoffCommandJsonKey = "isTakeoffCommand";
const char* MissionCommandUIInfo::_unitsJsonKey = "units"; const char* MissionCommandUIInfo::_unitsJsonKey = "units";
const char* MissionCommandUIInfo::_commentJsonKey = "comment"; const char* MissionCommandUIInfo::_commentJsonKey = "comment";
const char* MissionCommandUIInfo::_advancedCategory = "Advanced"; const char* MissionCommandUIInfo::_advancedCategory = "Advanced";
...@@ -174,6 +175,15 @@ bool MissionCommandUIInfo::isLandCommand(void) const ...@@ -174,6 +175,15 @@ bool MissionCommandUIInfo::isLandCommand(void) const
} }
} }
bool MissionCommandUIInfo::isTakeoffCommand(void) const
{
if (_infoMap.contains(_isTakeoffCommandJsonKey)) {
return _infoMap[_isTakeoffCommandJsonKey].toBool();
} else {
return false;
}
}
void MissionCommandUIInfo::_overrideInfo(MissionCommandUIInfo* uiInfo) void MissionCommandUIInfo::_overrideInfo(MissionCommandUIInfo* uiInfo)
{ {
// Override info values // Override info values
...@@ -209,7 +219,7 @@ bool MissionCommandUIInfo::loadJsonInfo(const QJsonObject& jsonObject, bool requ ...@@ -209,7 +219,7 @@ bool MissionCommandUIInfo::loadJsonInfo(const QJsonObject& jsonObject, bool requ
QStringList allKeys; QStringList allKeys;
allKeys << _idJsonKey << _rawNameJsonKey << _friendlyNameJsonKey << _descriptionJsonKey << _standaloneCoordinateJsonKey << _specifiesCoordinateJsonKey allKeys << _idJsonKey << _rawNameJsonKey << _friendlyNameJsonKey << _descriptionJsonKey << _standaloneCoordinateJsonKey << _specifiesCoordinateJsonKey
<<_friendlyEditJsonKey << _param1JsonKey << _param2JsonKey << _param3JsonKey << _param4JsonKey << _param5JsonKey << _param6JsonKey << _param7JsonKey <<_friendlyEditJsonKey << _param1JsonKey << _param2JsonKey << _param3JsonKey << _param4JsonKey << _param5JsonKey << _param6JsonKey << _param7JsonKey
<< _paramRemoveJsonKey << _categoryJsonKey << _specifiesAltitudeOnlyJsonKey << _isLandCommandJsonKey; << _paramRemoveJsonKey << _categoryJsonKey << _specifiesAltitudeOnlyJsonKey << _isLandCommandJsonKey << _isTakeoffCommandJsonKey;
// Look for unknown keys in top level object // Look for unknown keys in top level object
for (const QString& key: jsonObject.keys()) { for (const QString& key: jsonObject.keys()) {
...@@ -275,6 +285,9 @@ bool MissionCommandUIInfo::loadJsonInfo(const QJsonObject& jsonObject, bool requ ...@@ -275,6 +285,9 @@ bool MissionCommandUIInfo::loadJsonInfo(const QJsonObject& jsonObject, bool requ
if (jsonObject.contains(_isLandCommandJsonKey)) { if (jsonObject.contains(_isLandCommandJsonKey)) {
_infoMap[_isLandCommandJsonKey] = jsonObject.value(_isLandCommandJsonKey).toBool(); _infoMap[_isLandCommandJsonKey] = jsonObject.value(_isLandCommandJsonKey).toBool();
} }
if (jsonObject.contains(_isTakeoffCommandJsonKey)) {
_infoMap[_isTakeoffCommandJsonKey] = jsonObject.value(_isTakeoffCommandJsonKey).toBool();
}
if (jsonObject.contains(_friendlyEditJsonKey)) { if (jsonObject.contains(_friendlyEditJsonKey)) {
_infoMap[_friendlyEditJsonKey] = jsonObject.value(_friendlyEditJsonKey).toVariant(); _infoMap[_friendlyEditJsonKey] = jsonObject.value(_friendlyEditJsonKey).toVariant();
} }
...@@ -305,6 +318,9 @@ bool MissionCommandUIInfo::loadJsonInfo(const QJsonObject& jsonObject, bool requ ...@@ -305,6 +318,9 @@ bool MissionCommandUIInfo::loadJsonInfo(const QJsonObject& jsonObject, bool requ
if (!_infoAvailable(_isLandCommandJsonKey)) { if (!_infoAvailable(_isLandCommandJsonKey)) {
_setInfoValue(_isLandCommandJsonKey, false); _setInfoValue(_isLandCommandJsonKey, false);
} }
if (!_infoAvailable(_isTakeoffCommandJsonKey)) {
_setInfoValue(_isTakeoffCommandJsonKey, false);
}
if (!_infoAvailable(_friendlyEditJsonKey)) { if (!_infoAvailable(_friendlyEditJsonKey)) {
_setInfoValue(_friendlyEditJsonKey, false); _setInfoValue(_friendlyEditJsonKey, false);
} }
......
...@@ -96,6 +96,7 @@ private: ...@@ -96,6 +96,7 @@ private:
/// specifiesCoordinate bool false true: Command specifies a lat/lon/alt coordinate /// specifiesCoordinate bool false true: Command specifies a lat/lon/alt coordinate
/// specifiesAltitudeOnly bool false true: Command specifies an altitude only (no coordinate) /// specifiesAltitudeOnly bool false true: Command specifies an altitude only (no coordinate)
/// standaloneCoordinate bool false true: Vehicle does not fly through coordinate associated with command (exampl: ROI) /// standaloneCoordinate bool false true: Vehicle does not fly through coordinate associated with command (exampl: ROI)
/// isTakeoffCommand bool false true: Command specifies a takeoff command (TAEKOFF, VTOL_TAKEOFF, ...)
/// isLandCommand bool false true: Command specifies a land command (LAND, VTOL_LAND, ...) /// isLandCommand bool false true: Command specifies a land command (LAND, VTOL_LAND, ...)
/// friendlyEdit bool false true: Command supports friendly editing dialog, false: Command supports 'Show all values" style editing only /// friendlyEdit bool false true: Command supports friendly editing dialog, false: Command supports 'Show all values" style editing only
/// category string Advanced Category which this command belongs to /// category string Advanced Category which this command belongs to
...@@ -120,6 +121,7 @@ public: ...@@ -120,6 +121,7 @@ public:
Q_PROPERTY(bool specifiesCoordinate READ specifiesCoordinate CONSTANT) Q_PROPERTY(bool specifiesCoordinate READ specifiesCoordinate CONSTANT)
Q_PROPERTY(bool specifiesAltitudeOnly READ specifiesAltitudeOnly CONSTANT) Q_PROPERTY(bool specifiesAltitudeOnly READ specifiesAltitudeOnly CONSTANT)
Q_PROPERTY(bool isLandCommand READ isLandCommand CONSTANT) Q_PROPERTY(bool isLandCommand READ isLandCommand CONSTANT)
Q_PROPERTY(bool isTakeoffCommand READ isTakeoffCommand CONSTANT)
Q_PROPERTY(int command READ intCommand CONSTANT) Q_PROPERTY(int command READ intCommand CONSTANT)
MAV_CMD command(void) const { return _command; } MAV_CMD command(void) const { return _command; }
...@@ -134,6 +136,7 @@ public: ...@@ -134,6 +136,7 @@ public:
bool specifiesCoordinate (void) const; bool specifiesCoordinate (void) const;
bool specifiesAltitudeOnly (void) const; bool specifiesAltitudeOnly (void) const;
bool isLandCommand (void) const; bool isLandCommand (void) const;
bool isTakeoffCommand (void) const;
/// Load the data in the object from the specified json /// Load the data in the object from the specified json
/// @param jsonObject Json object to load from /// @param jsonObject Json object to load from
...@@ -194,6 +197,7 @@ private: ...@@ -194,6 +197,7 @@ private:
static const char* _specifiesCoordinateJsonKey; static const char* _specifiesCoordinateJsonKey;
static const char* _specifiesAltitudeOnlyJsonKey; static const char* _specifiesAltitudeOnlyJsonKey;
static const char* _isLandCommandJsonKey; static const char* _isLandCommandJsonKey;
static const char* _isTakeoffCommandJsonKey;
static const char* _unitsJsonKey; static const char* _unitsJsonKey;
static const char* _commentJsonKey; static const char* _commentJsonKey;
static const char* _advancedCategory; static const char* _advancedCategory;
......
...@@ -116,7 +116,9 @@ void TakeoffMissionItem::setCoordinate(const QGeoCoordinate& coordinate) ...@@ -116,7 +116,9 @@ void TakeoffMissionItem::setCoordinate(const QGeoCoordinate& coordinate)
bool TakeoffMissionItem::isTakeoffCommand(MAV_CMD command) bool TakeoffMissionItem::isTakeoffCommand(MAV_CMD command)
{ {
return command == MAV_CMD_NAV_TAKEOFF || command == MAV_CMD_NAV_VTOL_TAKEOFF; const MissionCommandUIInfo* uiInfo = qgcApp()->toolbox()->missionCommandTree()->getUIInfo(qgcApp()->toolbox()->multiVehicleManager()->offlineEditingVehicle(), command);
return uiInfo ? uiInfo->isTakeoffCommand() : false;
} }
void TakeoffMissionItem::_initLaunchTakeoffAtSameLocation(void) void TakeoffMissionItem::_initLaunchTakeoffAtSameLocation(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