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
763635c9
Commit
763635c9
authored
Dec 15, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle unknown MAV_CMD values
parent
f3509481
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
22 deletions
+40
-22
MissionItem.cc
src/MissionManager/MissionItem.cc
+40
-22
No files found.
src/MissionManager/MissionItem.cc
View file @
763635c9
...
@@ -45,18 +45,18 @@ struct EnumInfo_s {
...
@@ -45,18 +45,18 @@ struct EnumInfo_s {
};
};
static
const
struct
EnumInfo_s
_rgMavFrameInfo
[]
=
{
static
const
struct
EnumInfo_s
_rgMavFrameInfo
[]
=
{
{
"MAV_FRAME_GLOBAL"
,
MAV_FRAME_GLOBAL
},
{
"MAV_FRAME_GLOBAL"
,
MAV_FRAME_GLOBAL
},
{
"MAV_FRAME_LOCAL_NED"
,
MAV_FRAME_LOCAL_NED
},
{
"MAV_FRAME_LOCAL_NED"
,
MAV_FRAME_LOCAL_NED
},
{
"MAV_FRAME_MISSION"
,
MAV_FRAME_MISSION
},
{
"MAV_FRAME_MISSION"
,
MAV_FRAME_MISSION
},
{
"MAV_FRAME_GLOBAL_RELATIVE_ALT"
,
MAV_FRAME_GLOBAL_RELATIVE_ALT
},
{
"MAV_FRAME_GLOBAL_RELATIVE_ALT"
,
MAV_FRAME_GLOBAL_RELATIVE_ALT
},
{
"MAV_FRAME_LOCAL_ENU"
,
MAV_FRAME_LOCAL_ENU
},
{
"MAV_FRAME_LOCAL_ENU"
,
MAV_FRAME_LOCAL_ENU
},
{
"MAV_FRAME_GLOBAL_INT"
,
MAV_FRAME_GLOBAL_INT
},
{
"MAV_FRAME_GLOBAL_INT"
,
MAV_FRAME_GLOBAL_INT
},
{
"MAV_FRAME_GLOBAL_RELATIVE_ALT_INT"
,
MAV_FRAME_GLOBAL_RELATIVE_ALT_INT
},
{
"MAV_FRAME_GLOBAL_RELATIVE_ALT_INT"
,
MAV_FRAME_GLOBAL_RELATIVE_ALT_INT
},
{
"MAV_FRAME_LOCAL_OFFSET_NED"
,
MAV_FRAME_LOCAL_OFFSET_NED
},
{
"MAV_FRAME_LOCAL_OFFSET_NED"
,
MAV_FRAME_LOCAL_OFFSET_NED
},
{
"MAV_FRAME_BODY_NED"
,
MAV_FRAME_BODY_NED
},
{
"MAV_FRAME_BODY_NED"
,
MAV_FRAME_BODY_NED
},
{
"MAV_FRAME_BODY_OFFSET_NED"
,
MAV_FRAME_BODY_OFFSET_NED
},
{
"MAV_FRAME_BODY_OFFSET_NED"
,
MAV_FRAME_BODY_OFFSET_NED
},
{
"MAV_FRAME_GLOBAL_TERRAIN_ALT"
,
MAV_FRAME_GLOBAL_TERRAIN_ALT
},
{
"MAV_FRAME_GLOBAL_TERRAIN_ALT"
,
MAV_FRAME_GLOBAL_TERRAIN_ALT
},
{
"MAV_FRAME_GLOBAL_TERRAIN_ALT_INT"
,
MAV_FRAME_GLOBAL_TERRAIN_ALT_INT
},
{
"MAV_FRAME_GLOBAL_TERRAIN_ALT_INT"
,
MAV_FRAME_GLOBAL_TERRAIN_ALT_INT
},
};
};
QDebug
operator
<<
(
QDebug
dbg
,
const
MissionItem
&
missionItem
)
QDebug
operator
<<
(
QDebug
dbg
,
const
MissionItem
&
missionItem
)
...
@@ -514,17 +514,30 @@ void MissionItem::setParam7(double param)
...
@@ -514,17 +514,30 @@ void MissionItem::setParam7(double param)
bool
MissionItem
::
standaloneCoordinate
(
void
)
const
bool
MissionItem
::
standaloneCoordinate
(
void
)
const
{
{
if
(
_mavCmdInfoMap
.
contains
((
MAV_CMD
)
command
()))
{
return
_mavCmdInfoMap
[(
MAV_CMD
)
command
()]
->
standaloneCoordinate
();
return
_mavCmdInfoMap
[(
MAV_CMD
)
command
()]
->
standaloneCoordinate
();
}
else
{
return
false
;
}
}
}
bool
MissionItem
::
specifiesCoordinate
(
void
)
const
bool
MissionItem
::
specifiesCoordinate
(
void
)
const
{
{
if
(
_mavCmdInfoMap
.
contains
((
MAV_CMD
)
command
()))
{
return
_mavCmdInfoMap
[(
MAV_CMD
)
command
()]
->
specifiesCoordinate
();
return
_mavCmdInfoMap
[(
MAV_CMD
)
command
()]
->
specifiesCoordinate
();
}
else
{
return
false
;
}
}
}
QString
MissionItem
::
commandDescription
(
void
)
const
QString
MissionItem
::
commandDescription
(
void
)
const
{
{
if
(
_mavCmdInfoMap
.
contains
((
MAV_CMD
)
command
()))
{
return
_mavCmdInfoMap
[(
MAV_CMD
)
command
()]
->
description
();
return
_mavCmdInfoMap
[(
MAV_CMD
)
command
()]
->
description
();
}
else
{
qWarning
()
<<
"Should not ask for command description on unknown command"
;
return
QString
();
}
}
}
void
MissionItem
::
_clearParamMetaData
(
void
)
void
MissionItem
::
_clearParamMetaData
(
void
)
...
@@ -676,7 +689,7 @@ void MissionItem::setCoordinate(const QGeoCoordinate& coordinate)
...
@@ -676,7 +689,7 @@ void MissionItem::setCoordinate(const QGeoCoordinate& coordinate)
bool
MissionItem
::
friendlyEditAllowed
(
void
)
const
bool
MissionItem
::
friendlyEditAllowed
(
void
)
const
{
{
if
(
_mavCmdInfoMap
[(
MAV_CMD
)
command
()]
->
friendlyEdit
())
{
if
(
_mavCmdInfoMap
.
contains
((
MAV_CMD
)
command
())
&&
_mavCmdInfoMap
[(
MAV_CMD
)
command
()]
->
friendlyEdit
())
{
if
(
!
autoContinue
())
{
if
(
!
autoContinue
())
{
return
false
;
return
false
;
}
}
...
@@ -797,11 +810,13 @@ void MissionItem::setDefaultsForCommand(void)
...
@@ -797,11 +810,13 @@ void MissionItem::setDefaultsForCommand(void)
// We set these global defaults first, then if there are param defaults they will get reset
// We set these global defaults first, then if there are param defaults they will get reset
setParam7
(
defaultAltitude
);
setParam7
(
defaultAltitude
);
if
(
_mavCmdInfoMap
.
contains
((
MAV_CMD
)
command
()))
{
foreach
(
const
MavCmdParamInfo
*
paramInfo
,
_mavCmdInfoMap
[(
MAV_CMD
)
command
()]
->
paramInfoMap
())
{
foreach
(
const
MavCmdParamInfo
*
paramInfo
,
_mavCmdInfoMap
[(
MAV_CMD
)
command
()]
->
paramInfoMap
())
{
Fact
*
rgParamFacts
[
7
]
=
{
&
_param1Fact
,
&
_param2Fact
,
&
_param3Fact
,
&
_param4Fact
,
&
_param5Fact
,
&
_param6Fact
,
&
_param7Fact
};
Fact
*
rgParamFacts
[
7
]
=
{
&
_param1Fact
,
&
_param2Fact
,
&
_param3Fact
,
&
_param4Fact
,
&
_param5Fact
,
&
_param6Fact
,
&
_param7Fact
};
rgParamFacts
[
paramInfo
->
param
()
-
1
]
->
setRawValue
(
paramInfo
->
defaultValue
());
rgParamFacts
[
paramInfo
->
param
()
-
1
]
->
setRawValue
(
paramInfo
->
defaultValue
());
}
}
}
setAutoContinue
(
true
);
setAutoContinue
(
true
);
setFrame
(
specifiesCoordinate
()
?
MAV_FRAME_GLOBAL_RELATIVE_ALT
:
MAV_FRAME_MISSION
);
setFrame
(
specifiesCoordinate
()
?
MAV_FRAME_GLOBAL_RELATIVE_ALT
:
MAV_FRAME_MISSION
);
...
@@ -825,9 +840,12 @@ void MissionItem::_sendCommandChanged(void)
...
@@ -825,9 +840,12 @@ void MissionItem::_sendCommandChanged(void)
QString
MissionItem
::
commandName
(
void
)
const
QString
MissionItem
::
commandName
(
void
)
const
{
{
if
(
_mavCmdInfoMap
.
contains
((
MAV_CMD
)
command
()))
{
const
MavCmdInfo
*
mavCmdInfo
=
_mavCmdInfoMap
[(
MAV_CMD
)
command
()];
const
MavCmdInfo
*
mavCmdInfo
=
_mavCmdInfoMap
[(
MAV_CMD
)
command
()];
return
mavCmdInfo
->
friendlyName
().
isEmpty
()
?
mavCmdInfo
->
rawName
()
:
mavCmdInfo
->
friendlyName
();
return
mavCmdInfo
->
friendlyName
().
isEmpty
()
?
mavCmdInfo
->
rawName
()
:
mavCmdInfo
->
friendlyName
();
}
else
{
return
QString
(
"Unknown: %1"
).
arg
(
command
());
}
}
}
QVariant
MissionItem
::
_degreesToRadians
(
const
QVariant
&
degrees
)
QVariant
MissionItem
::
_degreesToRadians
(
const
QVariant
&
degrees
)
...
...
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