Commit 1da21bda authored by Don Gagne's avatar Don Gagne

Add concept of standalone coordinate

Standalone coordinate don’t connect to waypoint lines
parent 039d61c0
...@@ -150,6 +150,7 @@ ...@@ -150,6 +150,7 @@
"friendlyName": "Region of interest (nav)", "friendlyName": "Region of interest (nav)",
"description": "Sets the region of interest for cameras.", "description": "Sets the region of interest for cameras.",
"specifiesCoordinate": true, "specifiesCoordinate": true,
"standaloneCoordinate": true,
"friendlyEdit": true, "friendlyEdit": true,
"category": "Camera", "category": "Camera",
"param1": { "param1": {
...@@ -393,11 +394,12 @@ ...@@ -393,11 +394,12 @@
{ "id": 191, "rawName": "MAV_CMD_DO_GO_AROUND", "friendlyName": "MAV_CMD_DO_GO_AROUND" }, { "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": 200, "rawName": "MAV_CMD_DO_CONTROL_VIDEO", "friendlyName": "MAV_CMD_DO_CONTROL_VIDEO" },
{ {
"id": 201, "id": 201,
"rawName": "MAV_CMD_DO_SET_ROI", "rawName": "MAV_CMD_DO_SET_ROI",
"friendlyName": "Region of interest (cmd)" , "friendlyName": "Region of interest (cmd)" ,
"description": "Sets the region of interest for cameras.", "description": "Sets the region of interest for cameras.",
"specifiesCoordinate": true, "specifiesCoordinate": true,
"standaloneCoordinate": true,
"friendlyEdit": true, "friendlyEdit": true,
"category": "Camera", "category": "Camera",
"param1": { "param1": {
......
...@@ -49,6 +49,7 @@ const QString MissionCommands::_param3JsonKey (QStringLiteral("par ...@@ -49,6 +49,7 @@ const QString MissionCommands::_param3JsonKey (QStringLiteral("par
const QString MissionCommands::_param4JsonKey (QStringLiteral("param4")); const QString MissionCommands::_param4JsonKey (QStringLiteral("param4"));
const QString MissionCommands::_paramJsonKeyFormat (QStringLiteral("param%1")); const QString MissionCommands::_paramJsonKeyFormat (QStringLiteral("param%1"));
const QString MissionCommands::_rawNameJsonKey (QStringLiteral("rawName")); const QString MissionCommands::_rawNameJsonKey (QStringLiteral("rawName"));
const QString MissionCommands::_standaloneCoordinateJsonKey (QStringLiteral("standaloneCoordinate"));
const QString MissionCommands::_specifiesCoordinateJsonKey (QStringLiteral("specifiesCoordinate")); const QString MissionCommands::_specifiesCoordinateJsonKey (QStringLiteral("specifiesCoordinate"));
const QString MissionCommands::_unitsJsonKey (QStringLiteral("units")); const QString MissionCommands::_unitsJsonKey (QStringLiteral("units"));
const QString MissionCommands::_versionJsonKey (QStringLiteral("version")); const QString MissionCommands::_versionJsonKey (QStringLiteral("version"));
...@@ -129,9 +130,9 @@ void MissionCommands::_loadMavCmdInfoJson(void) ...@@ -129,9 +130,9 @@ void MissionCommands::_loadMavCmdInfoJson(void)
QStringList keys; QStringList keys;
QList<QJsonValue::Type> types; QList<QJsonValue::Type> types;
keys << _idJsonKey << _rawNameJsonKey << _friendlyNameJsonKey << _descriptionJsonKey << _specifiesCoordinateJsonKey << _friendlyEditJsonKey keys << _idJsonKey << _rawNameJsonKey << _friendlyNameJsonKey << _descriptionJsonKey << _standaloneCoordinateJsonKey << _specifiesCoordinateJsonKey <<_friendlyEditJsonKey
<< _param1JsonKey << _param2JsonKey << _param3JsonKey << _param4JsonKey << _categoryJsonKey; << _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; << QJsonValue::Object << QJsonValue::Object << QJsonValue::Object << QJsonValue::Object << QJsonValue::String;
if (!_validateKeyTypes(jsonObject, keys, types)) { if (!_validateKeyTypes(jsonObject, keys, types)) {
return; return;
...@@ -144,6 +145,7 @@ void MissionCommands::_loadMavCmdInfoJson(void) ...@@ -144,6 +145,7 @@ void MissionCommands::_loadMavCmdInfoJson(void)
mavCmdInfo->_rawName = jsonObject.value(_rawNameJsonKey).toString(); mavCmdInfo->_rawName = jsonObject.value(_rawNameJsonKey).toString();
mavCmdInfo->_friendlyName = jsonObject.value(_friendlyNameJsonKey).toString(QString()); mavCmdInfo->_friendlyName = jsonObject.value(_friendlyNameJsonKey).toString(QString());
mavCmdInfo->_description = jsonObject.value(_descriptionJsonKey).toString(QString()); mavCmdInfo->_description = jsonObject.value(_descriptionJsonKey).toString(QString());
mavCmdInfo->_standaloneCoordinate = jsonObject.value(_standaloneCoordinateJsonKey).toBool(false);
mavCmdInfo->_specifiesCoordinate = jsonObject.value(_specifiesCoordinateJsonKey).toBool(false); mavCmdInfo->_specifiesCoordinate = jsonObject.value(_specifiesCoordinateJsonKey).toBool(false);
mavCmdInfo->_friendlyEdit = jsonObject.value(_friendlyEditJsonKey).toBool(false); mavCmdInfo->_friendlyEdit = jsonObject.value(_friendlyEditJsonKey).toBool(false);
...@@ -153,6 +155,7 @@ void MissionCommands::_loadMavCmdInfoJson(void) ...@@ -153,6 +155,7 @@ void MissionCommands::_loadMavCmdInfoJson(void)
<< mavCmdInfo->_rawName << mavCmdInfo->_rawName
<< mavCmdInfo->_friendlyName << mavCmdInfo->_friendlyName
<< mavCmdInfo->_description << mavCmdInfo->_description
<< mavCmdInfo->_standaloneCoordinate
<< mavCmdInfo->_specifiesCoordinate << mavCmdInfo->_specifiesCoordinate
<< mavCmdInfo->_friendlyEdit; << mavCmdInfo->_friendlyEdit;
......
...@@ -88,13 +88,14 @@ public: ...@@ -88,13 +88,14 @@ public:
} }
Q_PROPERTY(QString category READ category CONSTANT) Q_PROPERTY(QString category READ category CONSTANT)
Q_PROPERTY(MavlinkQmlSingleton::Qml_MAV_CMD command READ command CONSTANT) Q_PROPERTY(MavlinkQmlSingleton::Qml_MAV_CMD command READ command CONSTANT)
Q_PROPERTY(QString description READ description CONSTANT) Q_PROPERTY(QString description READ description CONSTANT)
Q_PROPERTY(bool friendlyEdit READ friendlyEdit CONSTANT) Q_PROPERTY(bool friendlyEdit READ friendlyEdit CONSTANT)
Q_PROPERTY(QString friendlyName READ friendlyName CONSTANT) Q_PROPERTY(QString friendlyName READ friendlyName CONSTANT)
Q_PROPERTY(QString rawName READ rawName CONSTANT) Q_PROPERTY(QString rawName READ rawName CONSTANT)
Q_PROPERTY(bool specifiesCoordinate READ specifiesCoordinate CONSTANT) Q_PROPERTY(bool standaloneCoordinate READ standaloneCoordinate CONSTANT)
Q_PROPERTY(bool specifiesCoordinate READ specifiesCoordinate CONSTANT)
QString category (void) const { return _category; } QString category (void) const { return _category; }
MavlinkQmlSingleton::Qml_MAV_CMD command(void) const { return (MavlinkQmlSingleton::Qml_MAV_CMD)_command; } MavlinkQmlSingleton::Qml_MAV_CMD command(void) const { return (MavlinkQmlSingleton::Qml_MAV_CMD)_command; }
...@@ -102,6 +103,7 @@ public: ...@@ -102,6 +103,7 @@ public:
bool friendlyEdit (void) const { return _friendlyEdit; } bool friendlyEdit (void) const { return _friendlyEdit; }
QString friendlyName (void) const { return _friendlyName; } QString friendlyName (void) const { return _friendlyName; }
QString rawName (void) const { return _rawName; } QString rawName (void) const { return _rawName; }
bool standaloneCoordinate(void) const { return _standaloneCoordinate; }
bool specifiesCoordinate (void) const { return _specifiesCoordinate; } bool specifiesCoordinate (void) const { return _specifiesCoordinate; }
const QMap<int, MavCmdParamInfo*>& paramInfoMap(void) const { return _paramInfoMap; } const QMap<int, MavCmdParamInfo*>& paramInfoMap(void) const { return _paramInfoMap; }
...@@ -114,6 +116,7 @@ private: ...@@ -114,6 +116,7 @@ private:
QString _friendlyName; QString _friendlyName;
QMap<int, MavCmdParamInfo*> _paramInfoMap; QMap<int, MavCmdParamInfo*> _paramInfoMap;
QString _rawName; QString _rawName;
bool _standaloneCoordinate;
bool _specifiesCoordinate; bool _specifiesCoordinate;
friend class MissionCommands; friend class MissionCommands;
...@@ -170,6 +173,7 @@ private: ...@@ -170,6 +173,7 @@ private:
static const QString _param4JsonKey; static const QString _param4JsonKey;
static const QString _paramJsonKeyFormat; static const QString _paramJsonKeyFormat;
static const QString _rawNameJsonKey; static const QString _rawNameJsonKey;
static const QString _standaloneCoordinateJsonKey;
static const QString _specifiesCoordinateJsonKey; static const QString _specifiesCoordinateJsonKey;
static const QString _unitsJsonKey; static const QString _unitsJsonKey;
static const QString _versionJsonKey; static const QString _versionJsonKey;
......
...@@ -346,7 +346,7 @@ void MissionController::_recalcWaypointLines(void) ...@@ -346,7 +346,7 @@ void MissionController::_recalcWaypointLines(void)
item->setAzimuth(0.0); item->setAzimuth(0.0);
item->setDistance(-1.0); item->setDistance(-1.0);
if (item->specifiesCoordinate()) { if (item->specifiesCoordinate() && !item->standaloneCoordinate()) {
if (firstCoordinateItem) { if (firstCoordinateItem) {
if (item->command() == MavlinkQmlSingleton::MAV_CMD_NAV_TAKEOFF) { 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 // 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) ...@@ -628,7 +628,7 @@ bool MissionController::_findLastAltitude(double* lastAltitude)
for (int i=0; i<_missionItems->count(); i++) { for (int i=0; i<_missionItems->count(); i++) {
MissionItem* item = qobject_cast<MissionItem*>(_missionItems->get(i)); MissionItem* item = qobject_cast<MissionItem*>(_missionItems->get(i));
if (item->specifiesCoordinate()) { if (item->specifiesCoordinate() && !item->standaloneCoordinate()) {
foundAltitude = item->param7(); foundAltitude = item->param7();
found = true; found = true;
} }
......
...@@ -504,6 +504,11 @@ void MissionItem::setParam7(double param) ...@@ -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 bool MissionItem::specifiesCoordinate(void) const
{ {
return _mavCmdInfoMap[(MAV_CMD)command()]->specifiesCoordinate(); return _mavCmdInfoMap[(MAV_CMD)command()]->specifiesCoordinate();
......
...@@ -68,23 +68,24 @@ public: ...@@ -68,23 +68,24 @@ public:
const MissionItem& operator=(const MissionItem& other); 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 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(double azimuth READ azimuth WRITE setAzimuth NOTIFY azimuthChanged) ///< Azimuth to previous waypoint
Q_PROPERTY(QString category READ category NOTIFY commandChanged) Q_PROPERTY(QString category READ category NOTIFY commandChanged)
Q_PROPERTY(MavlinkQmlSingleton::Qml_MAV_CMD command READ command WRITE setCommand 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 commandDescription READ commandDescription NOTIFY commandChanged)
Q_PROPERTY(QString commandName READ commandName NOTIFY commandChanged) Q_PROPERTY(QString commandName READ commandName NOTIFY commandChanged)
Q_PROPERTY(QGeoCoordinate coordinate READ coordinate WRITE setCoordinate NOTIFY coordinateChanged) Q_PROPERTY(QGeoCoordinate coordinate READ coordinate WRITE setCoordinate NOTIFY coordinateChanged)
Q_PROPERTY(bool dirty READ dirty WRITE setDirty NOTIFY dirtyChanged) 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(double distance READ distance WRITE setDistance NOTIFY distanceChanged) ///< Distance to previous waypoint
Q_PROPERTY(bool friendlyEditAllowed READ friendlyEditAllowed NOTIFY friendlyEditAllowedChanged) 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 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 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 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(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(int sequenceNumber READ sequenceNumber WRITE setSequenceNumber NOTIFY sequenceNumberChanged)
Q_PROPERTY(bool specifiesCoordinate READ specifiesCoordinate NOTIFY commandChanged) Q_PROPERTY(bool standaloneCoordinate READ standaloneCoordinate NOTIFY commandChanged)
Q_PROPERTY(Fact* supportedCommand READ supportedCommand 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 // These properties are used to display the editing ui
Q_PROPERTY(QmlObjectListModel* checkboxFacts READ checkboxFacts NOTIFY uiModelChanged) Q_PROPERTY(QmlObjectListModel* checkboxFacts READ checkboxFacts NOTIFY uiModelChanged)
...@@ -112,6 +113,7 @@ public: ...@@ -112,6 +113,7 @@ public:
bool isCurrentItem (void) const { return _isCurrentItem; } bool isCurrentItem (void) const { return _isCurrentItem; }
bool rawEdit (void) const; bool rawEdit (void) const;
int sequenceNumber (void) const { return _sequenceNumber; } int sequenceNumber (void) const { return _sequenceNumber; }
bool standaloneCoordinate(void) const;
bool specifiesCoordinate (void) const; bool specifiesCoordinate (void) const;
Fact* supportedCommand (void) { return &_supportedCommandFact; } Fact* supportedCommand (void) { return &_supportedCommandFact; }
......
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