Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
cb0e358a
Commit
cb0e358a
authored
Apr 08, 2017
by
Don Gagne
Committed by
GitHub
Apr 08, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4942 from DonLakeFlyer/ParamNaN
Add support for NaN in mission command params
parents
48a18758
f19ff053
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
216 additions
and
103 deletions
+216
-103
MavCmdInfoCommon.json
src/FirmwarePlugin/PX4/MavCmdInfoCommon.json
+1
-1
MavCmdInfoMultiRotor.json
src/FirmwarePlugin/PX4/MavCmdInfoMultiRotor.json
+2
-2
MavCmdInfoCommon.json
src/MissionManager/MavCmdInfoCommon.json
+19
-15
MavCmdInfoFixedWing.json
src/MissionManager/MavCmdInfoFixedWing.json
+37
-0
MissionCommandUIInfo.cc
src/MissionManager/MissionCommandUIInfo.cc
+13
-4
MissionCommandUIInfo.h
src/MissionManager/MissionCommandUIInfo.h
+6
-1
SimpleMissionItem.cc
src/MissionManager/SimpleMissionItem.cc
+73
-55
SimpleMissionItem.h
src/MissionManager/SimpleMissionItem.h
+30
-22
SurveyMissionItem.cc
src/MissionManager/SurveyMissionItem.cc
+4
-3
SimpleItemEditor.qml
src/PlanView/SimpleItemEditor.qml
+31
-0
No files found.
src/FirmwarePlugin/PX4/MavCmdInfoCommon.json
View file @
cb0e358a
...
...
@@ -7,7 +7,7 @@
{
"id"
:
16
,
"comment"
:
"MAV_CMD_NAV_WAYPOINT"
,
"paramRemove"
:
"2,3
,4
"
"paramRemove"
:
"2,3"
},
{
"id"
:
21
,
...
...
src/FirmwarePlugin/PX4/MavCmdInfoMultiRotor.json
View file @
cb0e358a
...
...
@@ -14,13 +14,13 @@
"id"
:
18
,
"comment"
:
"MAV_CMD_NAV_LOITER_TURNS"
,
"description"
:
"Travel to a position and Loiter for a number of turns."
,
"paramRemove"
:
"3
,4
"
"paramRemove"
:
"3"
},
{
"id"
:
19
,
"comment"
:
"MAV_CMD_NAV_LOITER_TIME"
,
"description"
:
"Travel to a position and Loiter for an amount of time."
,
"paramRemove"
:
"3
,4
"
"paramRemove"
:
"3"
},
{
"id"
:
22
,
...
...
src/MissionManager/MavCmdInfoCommon.json
View file @
cb0e358a
...
...
@@ -54,7 +54,7 @@
"param4"
:
{
"label"
:
"Heading"
,
"units"
:
"radians"
,
"
default"
:
0.0
,
"
nanUnchanged"
:
true
,
"decimalPlaces"
:
2
}
},
...
...
@@ -71,6 +71,12 @@
"units"
:
"m"
,
"default"
:
50.0
,
"decimalPlaces"
:
2
},
"param4"
:
{
"label"
:
"Heading"
,
"units"
:
"radians"
,
"nanUnchanged"
:
true
,
"decimalPlaces"
:
2
}
},
{
...
...
@@ -93,11 +99,10 @@
"decimalPlaces"
:
2
},
"param4"
:
{
"label"
:
"Exit loiter from"
,
"enumStrings"
:
"Center,Tangent"
,
"enumValues"
:
"0,1"
,
"default"
:
1
,
"decimalPlaces"
:
0
"label"
:
"Heading"
,
"units"
:
"radians"
,
"nanUnchanged"
:
true
,
"decimalPlaces"
:
2
}
},
{
...
...
@@ -121,11 +126,10 @@
"decimalPlaces"
:
2
},
"param4"
:
{
"label"
:
"Exit loiter from"
,
"enumStrings"
:
"Center,Tangent"
,
"enumValues"
:
"0,1"
,
"default"
:
1
,
"decimalPlaces"
:
0
"label"
:
"Heading"
,
"units"
:
"radians"
,
"nanUnchanged"
:
true
,
"decimalPlaces"
:
2
}
},
{
...
...
@@ -153,7 +157,7 @@
"param4"
:
{
"label"
:
"Heading"
,
"units"
:
"radians"
,
"
default"
:
0.0
,
"
nanUnchanged"
:
true
,
"decimalPlaces"
:
2
}
},
...
...
@@ -174,7 +178,7 @@
"param4"
:
{
"label"
:
"Heading"
,
"units"
:
"radians"
,
"
default"
:
0.0
,
"
nanUnchanged"
:
true
,
"decimalPlaces"
:
2
}
},
...
...
@@ -312,7 +316,7 @@
"param4"
:
{
"label"
:
"Heading"
,
"units"
:
"deg"
,
"
default"
:
0.0
,
"
nanUnchanged"
:
true
,
"decimalPlaces"
:
2
}
},
...
...
@@ -327,7 +331,7 @@
"param4"
:
{
"label"
:
"Heading"
,
"units"
:
"deg"
,
"
default"
:
0.0
,
"
nanUnchanged"
:
true
,
"decimalPlaces"
:
2
}
},
...
...
src/MissionManager/MavCmdInfoFixedWing.json
View file @
cb0e358a
...
...
@@ -8,6 +8,43 @@
"id"
:
16
,
"comment"
:
"MAV_CMD_NAV_WAYPOINT"
,
"paramRemove"
:
"4"
},
{
"id"
:
17
,
"comment"
:
"MAV_CMD_NAV_LOITER_UNLIM"
,
"paramRemove"
:
"4"
},
{
"id"
:
18
,
"comment"
:
"MAV_CMD_NAV_LOITER_TURNS"
,
"param4"
:
{
"label"
:
"Exit loiter from"
,
"enumStrings"
:
"Center,Tangent"
,
"enumValues"
:
"0,1"
,
"default"
:
1
,
"decimalPlaces"
:
0
}
},
{
"id"
:
19
,
"comment"
:
"MAV_CMD_NAV_LOITER_TIME"
,
"param4"
:
{
"label"
:
"Exit loiter from"
,
"enumStrings"
:
"Center,Tangent"
,
"enumValues"
:
"0,1"
,
"default"
:
1
,
"decimalPlaces"
:
0
}
},
{
"id"
:
21
,
"comment"
:
"MAV_CMD_NAV_LAND"
,
"paramRemove"
:
"4"
},
{
"id"
:
22
,
"comment"
:
"MAV_CMD_NAV_TAKEOFF"
,
"paramRemove"
:
"4"
}
]
}
src/MissionManager/MissionCommandUIInfo.cc
View file @
cb0e358a
...
...
@@ -18,6 +18,7 @@ const char* MissionCommandUIInfo::_defaultJsonKey = "default";
const
char
*
MissionCommandUIInfo
::
_descriptionJsonKey
=
"description"
;
const
char
*
MissionCommandUIInfo
::
_enumStringsJsonKey
=
"enumStrings"
;
const
char
*
MissionCommandUIInfo
::
_enumValuesJsonKey
=
"enumValues"
;
const
char
*
MissionCommandUIInfo
::
_nanUnchangedJsonKey
=
"nanUnchanged"
;
const
char
*
MissionCommandUIInfo
::
_friendlyEditJsonKey
=
"friendlyEdit"
;
const
char
*
MissionCommandUIInfo
::
_friendlyNameJsonKey
=
"friendlyName"
;
const
char
*
MissionCommandUIInfo
::
_idJsonKey
=
"id"
;
...
...
@@ -62,6 +63,7 @@ const MissionCmdParamInfo& MissionCmdParamInfo::operator=(const MissionCmdParamI
_label
=
other
.
_label
;
_param
=
other
.
_param
;
_units
=
other
.
_units
;
_nanUnchanged
=
other
.
_nanUnchanged
;
return
*
this
;
}
...
...
@@ -333,7 +335,7 @@ bool MissionCommandUIInfo::loadJsonInfo(const QJsonObject& jsonObject, bool requ
QJsonObject
paramObject
=
jsonObject
.
value
(
paramKey
).
toObject
();
QStringList
allParamKeys
;
allParamKeys
<<
_defaultJsonKey
<<
_decimalPlacesJsonKey
<<
_enumStringsJsonKey
<<
_enumValuesJsonKey
<<
_labelJsonKey
<<
_unitsJsonKey
;
allParamKeys
<<
_defaultJsonKey
<<
_decimalPlacesJsonKey
<<
_enumStringsJsonKey
<<
_enumValuesJsonKey
<<
_labelJsonKey
<<
_unitsJsonKey
<<
_nanUnchangedJsonKey
;
// Look for unknown keys in param object
foreach
(
const
QString
&
key
,
paramObject
.
keys
())
{
...
...
@@ -345,7 +347,7 @@ bool MissionCommandUIInfo::loadJsonInfo(const QJsonObject& jsonObject, bool requ
// Validate key types
QList
<
QJsonValue
::
Type
>
types
;
types
<<
QJsonValue
::
Double
<<
QJsonValue
::
Double
<<
QJsonValue
::
String
<<
QJsonValue
::
String
<<
QJsonValue
::
String
<<
QJsonValue
::
String
;
types
<<
QJsonValue
::
Double
<<
QJsonValue
::
Double
<<
QJsonValue
::
String
<<
QJsonValue
::
String
<<
QJsonValue
::
String
<<
QJsonValue
::
String
<<
QJsonValue
::
Bool
;
if
(
!
JsonHelper
::
validateKeyTypes
(
jsonObject
,
allParamKeys
,
types
,
internalError
))
{
errorString
=
_loadErrorString
(
internalError
);
return
false
;
...
...
@@ -362,11 +364,17 @@ bool MissionCommandUIInfo::loadJsonInfo(const QJsonObject& jsonObject, bool requ
MissionCmdParamInfo
*
paramInfo
=
new
MissionCmdParamInfo
(
this
);
paramInfo
->
_label
=
paramObject
.
value
(
_labelJsonKey
).
toString
();
paramInfo
->
_defaultValue
=
paramObject
.
value
(
_defaultJsonKey
).
toDouble
(
0.0
);
paramInfo
->
_decimalPlaces
=
paramObject
.
value
(
_decimalPlacesJsonKey
).
toInt
(
FactMetaData
::
unknownDecimalPlaces
);
paramInfo
->
_enumStrings
=
paramObject
.
value
(
_enumStringsJsonKey
).
toString
().
split
(
","
,
QString
::
SkipEmptyParts
);
paramInfo
->
_param
=
i
;
paramInfo
->
_units
=
paramObject
.
value
(
_unitsJsonKey
).
toString
();
paramInfo
->
_nanUnchanged
=
paramObject
.
value
(
_nanUnchangedJsonKey
).
toBool
(
false
);
if
(
paramObject
.
contains
(
_defaultJsonKey
))
{
paramInfo
->
_defaultValue
=
paramObject
.
value
(
_defaultJsonKey
).
toDouble
(
0.0
);
}
else
{
paramInfo
->
_defaultValue
=
_nanUnchangedJsonKey
?
std
::
numeric_limits
<
double
>::
quiet_NaN
()
:
0
;
}
QStringList
enumValues
=
paramObject
.
value
(
_enumValuesJsonKey
).
toString
().
split
(
","
,
QString
::
SkipEmptyParts
);
foreach
(
const
QString
&
enumValue
,
enumValues
)
{
...
...
@@ -394,7 +402,8 @@ bool MissionCommandUIInfo::loadJsonInfo(const QJsonObject& jsonObject, bool requ
<<
paramInfo
->
_param
<<
paramInfo
->
_units
<<
paramInfo
->
_enumStrings
<<
paramInfo
->
_enumValues
;
<<
paramInfo
->
_enumValues
<<
paramInfo
->
_nanUnchanged
;
_paramInfoMap
[
i
]
=
paramInfo
;
}
...
...
src/MissionManager/MissionCommandUIInfo.h
View file @
cb0e358a
...
...
@@ -31,10 +31,11 @@ class MissionCommandTreeTest;
/// Key Type Default Description
/// label string required Label for text field
/// units string Units for value, should use FactMetaData units strings in order to get automatic translation
/// default double 0.0
Default value for param
/// default double 0.0
/NaN Default value for param. If no default value specified and nanUnchanged == true, then defaultVlue is NaN.
/// decimalPlaces int 7 Number of decimal places to show for value
/// enumStrings string Strings to show in combo box for selection
/// enumValues string Values assocaited with each enum string
/// nanUnchanged bool false True: value can be set to NaN to signal unchanged
///
class
MissionCmdParamInfo
:
public
QObject
{
...
...
@@ -53,6 +54,7 @@ public:
Q_PROPERTY
(
QString
label
READ
label
CONSTANT
)
Q_PROPERTY
(
int
param
READ
param
CONSTANT
)
Q_PROPERTY
(
QString
units
READ
units
CONSTANT
)
Q_PROPERTY
(
bool
nanUnchanged
READ
nanUnchanged
CONSTANT
)
int
decimalPlaces
(
void
)
const
{
return
_decimalPlaces
;
}
double
defaultValue
(
void
)
const
{
return
_defaultValue
;
}
...
...
@@ -61,6 +63,7 @@ public:
QString
label
(
void
)
const
{
return
_label
;
}
int
param
(
void
)
const
{
return
_param
;
}
QString
units
(
void
)
const
{
return
_units
;
}
bool
nanUnchanged
(
void
)
const
{
return
_nanUnchanged
;
}
private:
int
_decimalPlaces
;
...
...
@@ -70,6 +73,7 @@ private:
QString
_label
;
int
_param
;
QString
_units
;
bool
_nanUnchanged
;
friend
class
MissionCommandTree
;
friend
class
MissionCommandUIInfo
;
...
...
@@ -167,6 +171,7 @@ private:
static
const
char
*
_descriptionJsonKey
;
static
const
char
*
_enumStringsJsonKey
;
static
const
char
*
_enumValuesJsonKey
;
static
const
char
*
_nanUnchangedJsonKey
;
static
const
char
*
_friendlyNameJsonKey
;
static
const
char
*
_friendlyEditJsonKey
;
static
const
char
*
_idJsonKey
;
...
...
src/MissionManager/SimpleMissionItem.cc
View file @
cb0e358a
This diff is collapsed.
Click to expand it.
src/MissionManager/SimpleMissionItem.h
View file @
cb0e358a
...
...
@@ -40,9 +40,10 @@ public:
Q_PROPERTY
(
QObject
*
cameraSection
READ
cameraSection
NOTIFY
cameraSectionChanged
)
// These properties are used to display the editing ui
Q_PROPERTY
(
QmlObjectListModel
*
checkboxFacts
READ
checkboxFacts
NOTIFY
uiModelChanged
)
Q_PROPERTY
(
QmlObjectListModel
*
comboboxFacts
READ
comboboxFacts
NOTIFY
uiModelChanged
)
Q_PROPERTY
(
QmlObjectListModel
*
textFieldFacts
READ
textFieldFacts
NOTIFY
uiModelChanged
)
Q_PROPERTY
(
QmlObjectListModel
*
checkboxFacts
READ
checkboxFacts
CONSTANT
)
Q_PROPERTY
(
QmlObjectListModel
*
comboboxFacts
READ
comboboxFacts
CONSTANT
)
Q_PROPERTY
(
QmlObjectListModel
*
textFieldFacts
READ
textFieldFacts
CONSTANT
)
Q_PROPERTY
(
QmlObjectListModel
*
nanFacts
READ
nanFacts
CONSTANT
)
/// Scans the loaded items for additional section settings
/// @param visualItems List of all visual items
...
...
@@ -59,9 +60,10 @@ public:
bool
rawEdit
(
void
)
const
;
CameraSection
*
cameraSection
(
void
)
{
return
_cameraSection
;
}
QmlObjectListModel
*
textFieldFacts
(
void
);
QmlObjectListModel
*
checkboxFacts
(
void
);
QmlObjectListModel
*
comboboxFacts
(
void
);
QmlObjectListModel
*
textFieldFacts
(
void
)
{
return
&
_textFieldFacts
;
}
QmlObjectListModel
*
nanFacts
(
void
)
{
return
&
_nanFacts
;
}
QmlObjectListModel
*
checkboxFacts
(
void
)
{
return
&
_checkboxFacts
;
}
QmlObjectListModel
*
comboboxFacts
(
void
)
{
return
&
_comboboxFacts
;
}
void
setRawEdit
(
bool
rawEdit
);
...
...
@@ -120,28 +122,29 @@ signals:
void
friendlyEditAllowedChanged
(
bool
friendlyEditAllowed
);
void
headingDegreesChanged
(
double
heading
);
void
rawEditChanged
(
bool
rawEdit
);
void
uiModelChanged
(
void
);
void
cameraSectionChanged
(
QObject
*
cameraSection
);
private
slots
:
void
_setDirtyFromSignal
(
void
);
void
_cameraSectionDirtyChanged
(
bool
dirty
);
void
_sendCommandChanged
(
void
);
void
_sendCoordinateChanged
(
void
);
void
_sendFrameChanged
(
void
);
void
_sendFriendlyEditAllowedChanged
(
void
);
void
_s
endUiModelChanged
(
void
);
void
_sync
AltitudeRelativeToHomeToFrame
(
const
QVariant
&
value
);
void
_
syncFrameToAltitudeRelativeToHome
(
void
);
void
_
updateLastSequenceNumber
(
void
);
void
_setDirtyFromSignal
(
void
);
void
_cameraSectionDirtyChanged
(
bool
dirty
);
void
_sendCommandChanged
(
void
);
void
_sendCoordinateChanged
(
void
);
void
_sendFrameChanged
(
void
);
void
_sendFriendlyEditAllowedChanged
(
void
);
void
_s
yncAltitudeRelativeToHomeToFrame
(
const
QVariant
&
value
);
void
_sync
FrameToAltitudeRelativeToHome
(
void
);
void
_
updateLastSequenceNumber
(
void
);
void
_
rebuildFacts
(
void
);
private:
void
_clearParamMetaData
(
void
);
void
_connectSignals
(
void
);
void
_setupMetaData
(
void
);
void
_updateCameraSection
(
void
);
void
_connectSignals
(
void
);
void
_setupMetaData
(
void
);
void
_updateCameraSection
(
void
);
void
_rebuildTextFieldFacts
(
void
);
void
_rebuildNaNFacts
(
void
);
void
_rebuildCheckboxFacts
(
void
);
void
_rebuildComboBoxFacts
(
void
);
private:
MissionItem
_missionItem
;
bool
_rawEdit
;
bool
_dirty
;
...
...
@@ -153,6 +156,11 @@ private:
Fact
_altitudeRelativeToHomeFact
;
Fact
_supportedCommandFact
;
QmlObjectListModel
_textFieldFacts
;
QmlObjectListModel
_nanFacts
;
QmlObjectListModel
_checkboxFacts
;
QmlObjectListModel
_comboboxFacts
;
static
FactMetaData
*
_altitudeMetaData
;
static
FactMetaData
*
_commandMetaData
;
...
...
src/MissionManager/SurveyMissionItem.cc
View file @
cb0e358a
...
...
@@ -926,12 +926,13 @@ int SurveyMissionItem::_appendWaypointToMission(QList<MissionItem*>& items, int
MAV_CMD_NAV_WAYPOINT
,
altitudeRelative
?
MAV_FRAME_GLOBAL_RELATIVE_ALT
:
MAV_FRAME_GLOBAL
,
cameraTrigger
==
CameraTriggerHoverAndCapture
?
1
:
0
,
// Hold time (1 second for hover and capture to settle vehicle before image is taken)
0.0
,
0.0
,
0.0
,
// param 2-4 unused
0.0
,
0.0
,
std
::
numeric_limits
<
double
>::
quiet_NaN
(),
// Yaw unchanged
coord
.
latitude
(),
coord
.
longitude
(),
altitude
,
true
,
// autoContinue
false
,
// isCurrentItem
true
,
// autoContinue
false
,
// isCurrentItem
missionItemParent
);
items
.
append
(
item
);
...
...
src/PlanView/SimpleItemEditor.qml
View file @
cb0e358a
...
...
@@ -107,6 +107,37 @@ Rectangle {
}
}
GridLayout
{
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
columns
:
2
Repeater
{
model
:
missionItem
.
nanFacts
QGCCheckBox
{
text
:
object
.
name
Layout.column
:
0
Layout.row
:
index
checked
:
!
isNaN
(
object
.
rawValue
)
onClicked
:
object
.
rawValue
=
checked
?
0
:
NaN
}
}
Repeater
{
model
:
missionItem
.
nanFacts
FactTextField
{
showUnits
:
true
fact
:
object
Layout.column
:
1
Layout.row
:
index
Layout.fillWidth
:
true
enabled
:
!
isNaN
(
object
.
rawValue
)
}
}
}
Repeater
{
model
:
missionItem
.
checkboxFacts
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment