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
f5cd1ea8
Commit
f5cd1ea8
authored
Mar 05, 2020
by
DoinLakeFlyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support for new isLandCommand MissionCommandUIInfo
parent
4f0c4f01
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
36 additions
and
12 deletions
+36
-12
MissionCommandUIInfo.cc
src/MissionManager/MissionCommandUIInfo.cc
+18
-2
MissionCommandUIInfo.h
src/MissionManager/MissionCommandUIInfo.h
+4
-0
SimpleMissionItem.cc
src/MissionManager/SimpleMissionItem.cc
+10
-10
SimpleMissionItem.h
src/MissionManager/SimpleMissionItem.h
+1
-0
VisualMissionItem.h
src/MissionManager/VisualMissionItem.h
+3
-0
No files found.
src/MissionManager/MissionCommandUIInfo.cc
View file @
f5cd1ea8
...
...
@@ -37,6 +37,7 @@ const char* MissionCommandUIInfo::_rawNameJsonKey = "rawName";
const
char
*
MissionCommandUIInfo
::
_standaloneCoordinateJsonKey
=
"standaloneCoordinate"
;
const
char
*
MissionCommandUIInfo
::
_specifiesCoordinateJsonKey
=
"specifiesCoordinate"
;
const
char
*
MissionCommandUIInfo
::
_specifiesAltitudeOnlyJsonKey
=
"specifiesAltitudeOnly"
;
const
char
*
MissionCommandUIInfo
::
_isLandCommandJsonKey
=
"isLandCommand"
;
const
char
*
MissionCommandUIInfo
::
_unitsJsonKey
=
"units"
;
const
char
*
MissionCommandUIInfo
::
_commentJsonKey
=
"comment"
;
const
char
*
MissionCommandUIInfo
::
_advancedCategory
=
"Advanced"
;
...
...
@@ -164,6 +165,15 @@ bool MissionCommandUIInfo::specifiesAltitudeOnly(void) const
}
}
bool
MissionCommandUIInfo
::
isLandCommand
(
void
)
const
{
if
(
_infoMap
.
contains
(
_isLandCommandJsonKey
))
{
return
_infoMap
[
_isLandCommandJsonKey
].
toBool
();
}
else
{
return
false
;
}
}
void
MissionCommandUIInfo
::
_overrideInfo
(
MissionCommandUIInfo
*
uiInfo
)
{
// Override info values
...
...
@@ -199,7 +209,7 @@ bool MissionCommandUIInfo::loadJsonInfo(const QJsonObject& jsonObject, bool requ
QStringList
allKeys
;
allKeys
<<
_idJsonKey
<<
_rawNameJsonKey
<<
_friendlyNameJsonKey
<<
_descriptionJsonKey
<<
_standaloneCoordinateJsonKey
<<
_specifiesCoordinateJsonKey
<<
_friendlyEditJsonKey
<<
_param1JsonKey
<<
_param2JsonKey
<<
_param3JsonKey
<<
_param4JsonKey
<<
_param5JsonKey
<<
_param6JsonKey
<<
_param7JsonKey
<<
_paramRemoveJsonKey
<<
_categoryJsonKey
<<
_specifiesAltitudeOnlyJsonKey
;
<<
_paramRemoveJsonKey
<<
_categoryJsonKey
<<
_specifiesAltitudeOnlyJsonKey
<<
_isLandCommandJsonKey
;
// Look for unknown keys in top level object
for
(
const
QString
&
key
:
jsonObject
.
keys
())
{
...
...
@@ -231,7 +241,7 @@ bool MissionCommandUIInfo::loadJsonInfo(const QJsonObject& jsonObject, bool requ
QList
<
QJsonValue
::
Type
>
types
;
types
<<
QJsonValue
::
Double
<<
QJsonValue
::
String
<<
QJsonValue
::
String
<<
QJsonValue
::
String
<<
QJsonValue
::
Bool
<<
QJsonValue
::
Bool
<<
QJsonValue
::
Bool
<<
QJsonValue
::
Object
<<
QJsonValue
::
Object
<<
QJsonValue
::
Object
<<
QJsonValue
::
Object
<<
QJsonValue
::
Object
<<
QJsonValue
::
Object
<<
QJsonValue
::
Object
<<
QJsonValue
::
String
<<
QJsonValue
::
String
<<
QJsonValue
::
Bool
;
<<
QJsonValue
::
String
<<
QJsonValue
::
String
<<
QJsonValue
::
Bool
<<
QJsonValue
::
Bool
;
if
(
!
JsonHelper
::
validateKeyTypes
(
jsonObject
,
allKeys
,
types
,
internalError
))
{
errorString
=
_loadErrorString
(
internalError
);
return
false
;
...
...
@@ -262,6 +272,9 @@ bool MissionCommandUIInfo::loadJsonInfo(const QJsonObject& jsonObject, bool requ
if
(
jsonObject
.
contains
(
_specifiesAltitudeOnlyJsonKey
))
{
_infoMap
[
_specifiesAltitudeOnlyJsonKey
]
=
jsonObject
.
value
(
_specifiesAltitudeOnlyJsonKey
).
toBool
();
}
if
(
jsonObject
.
contains
(
_isLandCommandJsonKey
))
{
_infoMap
[
_isLandCommandJsonKey
]
=
jsonObject
.
value
(
_isLandCommandJsonKey
).
toBool
();
}
if
(
jsonObject
.
contains
(
_friendlyEditJsonKey
))
{
_infoMap
[
_friendlyEditJsonKey
]
=
jsonObject
.
value
(
_friendlyEditJsonKey
).
toVariant
();
}
...
...
@@ -289,6 +302,9 @@ bool MissionCommandUIInfo::loadJsonInfo(const QJsonObject& jsonObject, bool requ
if
(
!
_infoAvailable
(
_specifiesCoordinateJsonKey
))
{
_setInfoValue
(
_specifiesCoordinateJsonKey
,
false
);
}
if
(
!
_infoAvailable
(
_isLandCommandJsonKey
))
{
_setInfoValue
(
_isLandCommandJsonKey
,
false
);
}
if
(
!
_infoAvailable
(
_friendlyEditJsonKey
))
{
_setInfoValue
(
_friendlyEditJsonKey
,
false
);
}
...
...
src/MissionManager/MissionCommandUIInfo.h
View file @
f5cd1ea8
...
...
@@ -96,6 +96,7 @@ private:
/// specifiesCoordinate bool false true: Command specifies a lat/lon/alt 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)
/// 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
/// category string Advanced Category which this command belongs to
/// paramRemove string Used by an override to remove params, example: "1,3" will remove params 1 and 3 on the override
...
...
@@ -118,6 +119,7 @@ public:
Q_PROPERTY
(
bool
isStandaloneCoordinate
READ
isStandaloneCoordinate
CONSTANT
)
Q_PROPERTY
(
bool
specifiesCoordinate
READ
specifiesCoordinate
CONSTANT
)
Q_PROPERTY
(
bool
specifiesAltitudeOnly
READ
specifiesAltitudeOnly
CONSTANT
)
Q_PROPERTY
(
bool
isLandCommand
READ
isLandCommand
CONSTANT
)
Q_PROPERTY
(
int
command
READ
intCommand
CONSTANT
)
MAV_CMD
command
(
void
)
const
{
return
_command
;
}
...
...
@@ -131,6 +133,7 @@ public:
bool
isStandaloneCoordinate
(
void
)
const
;
bool
specifiesCoordinate
(
void
)
const
;
bool
specifiesAltitudeOnly
(
void
)
const
;
bool
isLandCommand
(
void
)
const
;
/// Load the data in the object from the specified json
/// @param jsonObject Json object to load from
...
...
@@ -190,6 +193,7 @@ private:
static
const
char
*
_standaloneCoordinateJsonKey
;
static
const
char
*
_specifiesCoordinateJsonKey
;
static
const
char
*
_specifiesAltitudeOnlyJsonKey
;
static
const
char
*
_isLandCommandJsonKey
;
static
const
char
*
_unitsJsonKey
;
static
const
char
*
_commentJsonKey
;
static
const
char
*
_advancedCategory
;
...
...
src/MissionManager/SimpleMissionItem.cc
View file @
f5cd1ea8
...
...
@@ -182,6 +182,7 @@ void SimpleMissionItem::_connectSignals(void)
connect
(
&
_missionItem
.
_commandFact
,
&
Fact
::
valueChanged
,
this
,
&
SimpleMissionItem
::
specifiesCoordinateChanged
);
connect
(
&
_missionItem
.
_commandFact
,
&
Fact
::
valueChanged
,
this
,
&
SimpleMissionItem
::
specifiesAltitudeOnlyChanged
);
connect
(
&
_missionItem
.
_commandFact
,
&
Fact
::
valueChanged
,
this
,
&
SimpleMissionItem
::
isStandaloneCoordinateChanged
);
connect
(
&
_missionItem
.
_commandFact
,
&
Fact
::
valueChanged
,
this
,
&
SimpleMissionItem
::
isLandCommandChanged
);
// Whenever these properties change the ui model changes as well
connect
(
this
,
&
SimpleMissionItem
::
commandChanged
,
this
,
&
SimpleMissionItem
::
_rebuildFacts
);
...
...
@@ -743,21 +744,13 @@ void SimpleMissionItem::_setDefaultsForCommand(void)
}
}
switch
(
command
)
{
case
MAV_CMD_NAV_WAYPOINT
:
if
(
command
==
MAV_CMD_NAV_WAYPOINT
)
{
// We default all acceptance radius to 0. This allows flight controller to be in control of
// accept radius.
_missionItem
.
setParam2
(
0
);
break
;
case
MAV_CMD_NAV_LAND
:
case
MAV_CMD_NAV_VTOL_LAND
:
case
MAV_CMD_DO_SET_ROI_LOCATION
:
}
else
if
(
uiInfo
->
isLandCommand
()
||
command
==
MAV_CMD_DO_SET_ROI_LOCATION
)
{
_altitudeFact
.
setRawValue
(
0
);
_missionItem
.
setParam7
(
0
);
break
;
default:
break
;
}
_missionItem
.
setAutoContinue
(
true
);
...
...
@@ -984,3 +977,10 @@ void SimpleMissionItem::_possibleAdditionalTimeDelayChanged(void)
return
;
}
bool
SimpleMissionItem
::
isLandCommand
(
void
)
const
{
MAV_CMD
command
=
static_cast
<
MAV_CMD
>
(
this
->
command
());
const
MissionCommandUIInfo
*
uiInfo
=
_commandTree
->
getUIInfo
(
_vehicle
,
command
);
return
uiInfo
->
isLandCommand
();
}
src/MissionManager/SimpleMissionItem.h
View file @
f5cd1ea8
...
...
@@ -100,6 +100,7 @@ public:
bool
dirty
(
void
)
const
override
{
return
_dirty
;
}
bool
isSimpleItem
(
void
)
const
final
{
return
true
;
}
bool
isStandaloneCoordinate
(
void
)
const
final
;
bool
isLandCommand
(
void
)
const
final
;
bool
specifiesCoordinate
(
void
)
const
final
;
bool
specifiesAltitudeOnly
(
void
)
const
final
;
QString
commandDescription
(
void
)
const
final
;
...
...
src/MissionManager/VisualMissionItem.h
View file @
f5cd1ea8
...
...
@@ -68,6 +68,7 @@ public:
Q_PROPERTY
(
bool
specifiesAltitudeOnly
READ
specifiesAltitudeOnly
NOTIFY
specifiesAltitudeOnlyChanged
)
///< true: Item has altitude only, no full coordinate
Q_PROPERTY
(
bool
isSimpleItem
READ
isSimpleItem
NOTIFY
isSimpleItemChanged
)
///< Simple or Complex MissionItem
Q_PROPERTY
(
bool
isTakeoffItem
READ
isTakeoffItem
NOTIFY
isTakeoffItemChanged
)
///< true: Takeoff item special case
Q_PROPERTY
(
bool
isLandCommand
READ
isLandCommand
NOTIFY
isLandCommandChanged
)
///< true: Takeoff item special case
Q_PROPERTY
(
QString
editorQml
MEMBER
_editorQml
CONSTANT
)
///< Qml code for editing this item
Q_PROPERTY
(
QString
mapVisualQML
READ
mapVisualQML
CONSTANT
)
///< QMl code for map visuals
Q_PROPERTY
(
double
specifiedFlightSpeed
READ
specifiedFlightSpeed
NOTIFY
specifiedFlightSpeedChanged
)
///< NaN for not specified
...
...
@@ -131,6 +132,7 @@ public:
virtual
bool
dirty
(
void
)
const
=
0
;
virtual
bool
isSimpleItem
(
void
)
const
=
0
;
virtual
bool
isTakeoffItem
(
void
)
const
{
return
false
;
}
virtual
bool
isLandCommand
(
void
)
const
{
return
false
;
}
virtual
bool
isStandaloneCoordinate
(
void
)
const
=
0
;
virtual
bool
specifiesCoordinate
(
void
)
const
=
0
;
virtual
bool
specifiesAltitudeOnly
(
void
)
const
=
0
;
...
...
@@ -208,6 +210,7 @@ signals:
void
sequenceNumberChanged
(
int
sequenceNumber
);
void
isSimpleItemChanged
(
bool
isSimpleItem
);
void
isTakeoffItemChanged
(
bool
isTakeoffItem
);
void
isLandCommandChanged
(
void
);
void
specifiesCoordinateChanged
(
void
);
void
isStandaloneCoordinateChanged
(
void
);
void
specifiesAltitudeOnlyChanged
(
void
);
...
...
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