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
3ff3035b
Unverified
Commit
3ff3035b
authored
Jul 13, 2020
by
Don Gagne
Committed by
GitHub
Jul 13, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8911 from DonLakeFlyer/GlobalAltMode
Plan: Fix global alt mode support
parents
fdb07a11
80a651e2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
8 deletions
+50
-8
MissionController.cc
src/MissionManager/MissionController.cc
+4
-1
MissionControllerTest.cc
src/MissionManager/MissionControllerTest.cc
+36
-0
MissionControllerTest.h
src/MissionManager/MissionControllerTest.h
+5
-4
SimpleMissionItem.cc
src/MissionManager/SimpleMissionItem.cc
+5
-3
No files found.
src/MissionManager/MissionController.cc
View file @
3ff3035b
...
...
@@ -327,7 +327,10 @@ VisualMissionItem* MissionController::_insertSimpleMissionItemWorker(QGeoCoordin
if
(
_findPreviousAltitude
(
visualItemIndex
,
&
prevAltitude
,
&
prevAltitudeMode
))
{
newItem
->
altitude
()
->
setRawValue
(
prevAltitude
);
newItem
->
setAltitudeMode
(
static_cast
<
QGroundControlQmlGlobal
::
AltitudeMode
>
(
prevAltitudeMode
));
if
(
globalAltitudeMode
()
==
QGroundControlQmlGlobal
::
AltitudeModeNone
)
{
// We are in mixed altitude modes, so copy from previous. Otherwise alt mode will be set from global setting.
newItem
->
setAltitudeMode
(
static_cast
<
QGroundControlQmlGlobal
::
AltitudeMode
>
(
prevAltitudeMode
));
}
}
}
}
...
...
src/MissionManager/MissionControllerTest.cc
View file @
3ff3035b
...
...
@@ -203,3 +203,39 @@ void MissionControllerTest::_testLoadJsonSectionAvailable(void)
}
}
void
MissionControllerTest
::
_testGlobalAltMode
(
void
)
{
_initForFirmwareType
(
MAV_AUTOPILOT_PX4
);
struct
_globalAltMode_s
{
QGroundControlQmlGlobal
::
AltitudeMode
altMode
;
MAV_FRAME
expectedMavFrame
;
}
altModeTestCases
[]
=
{
{
QGroundControlQmlGlobal
::
AltitudeModeRelative
,
MAV_FRAME_GLOBAL_RELATIVE_ALT
},
{
QGroundControlQmlGlobal
::
AltitudeModeAbsolute
,
MAV_FRAME_GLOBAL
},
{
QGroundControlQmlGlobal
::
AltitudeModeAboveTerrain
,
MAV_FRAME_GLOBAL
},
{
QGroundControlQmlGlobal
::
AltitudeModeTerrainFrame
,
MAV_FRAME_GLOBAL_TERRAIN_ALT
},
};
for
(
const
_globalAltMode_s
&
testCase
:
altModeTestCases
)
{
_missionController
->
removeAll
();
_missionController
->
setGlobalAltitudeMode
(
testCase
.
altMode
);
_missionController
->
insertTakeoffItem
(
QGeoCoordinate
(
0
,
0
),
1
);
_missionController
->
insertSimpleMissionItem
(
QGeoCoordinate
(
0
,
0
),
2
);
_missionController
->
insertSimpleMissionItem
(
QGeoCoordinate
(
0
,
0
),
3
);
_missionController
->
insertSimpleMissionItem
(
QGeoCoordinate
(
0
,
0
),
4
);
SimpleMissionItem
*
si
=
qobject_cast
<
SimpleMissionItem
*>
(
_missionController
->
visualItems
()
->
value
<
VisualMissionItem
*>
(
1
));
QCOMPARE
(
si
->
altitudeMode
(),
QGroundControlQmlGlobal
::
AltitudeModeRelative
);
QCOMPARE
(
si
->
missionItem
().
frame
(),
MAV_FRAME_GLOBAL_RELATIVE_ALT
);
for
(
int
i
=
2
;
i
<
_missionController
->
visualItems
()
->
count
();
i
++
)
{
qDebug
()
<<
i
;
SimpleMissionItem
*
si
=
qobject_cast
<
SimpleMissionItem
*>
(
_missionController
->
visualItems
()
->
value
<
VisualMissionItem
*>
(
i
));
QCOMPARE
(
si
->
altitudeMode
(),
testCase
.
altMode
);
QCOMPARE
(
si
->
missionItem
().
frame
(),
testCase
.
expectedMavFrame
);
}
}
}
src/MissionManager/MissionControllerTest.h
View file @
3ff3035b
...
...
@@ -32,10 +32,11 @@ public:
private
slots
:
void
cleanup
(
void
);
void
_testGimbalRecalc
(
void
);
void
_testLoadJsonSectionAvailable
(
void
);
void
_testEmptyVehicleAPM
(
void
);
void
_testEmptyVehiclePX4
(
void
);
void
_testGimbalRecalc
(
void
);
void
_testLoadJsonSectionAvailable
(
void
);
void
_testEmptyVehicleAPM
(
void
);
void
_testEmptyVehiclePX4
(
void
);
void
_testGlobalAltMode
(
void
);
private:
#if 0
...
...
src/MissionManager/SimpleMissionItem.cc
View file @
3ff3035b
...
...
@@ -726,14 +726,17 @@ void SimpleMissionItem::_setDefaultsForCommand(void)
_altitudeMode
=
QGroundControlQmlGlobal
::
AltitudeModeRelative
;
emit
altitudeModeChanged
();
_amslAltAboveTerrainFact
.
setRawValue
(
qQNaN
());
if
(
specifiesAltitude
()
||
isStandaloneCoordinate
()
)
{
if
(
specifiesAltitude
())
{
double
defaultAlt
=
qgcApp
()
->
toolbox
()
->
settingsManager
()
->
appSettings
()
->
defaultMissionItemAltitude
()
->
rawValue
().
toDouble
();
_altitudeFact
.
setRawValue
(
defaultAlt
);
_missionItem
.
_param7Fact
.
setRawValue
(
defaultAlt
);
setAltitudeMode
(
_missionController
->
globalAltitudeModeDefault
());
// Note that setAltitudeMode will also set MAV_FRAME correctly through signalling
// Takeoff items always use relative alt since that is the highest quality data to base altitude from
setAltitudeMode
(
isTakeoffItem
()
?
QGroundControlQmlGlobal
::
AltitudeModeRelative
:
_missionController
->
globalAltitudeModeDefault
());
}
else
{
_altitudeFact
.
setRawValue
(
0
);
_missionItem
.
_param7Fact
.
setRawValue
(
0
);
_missionItem
.
setFrame
(
MAV_FRAME_MISSION
);
}
MAV_CMD
command
=
static_cast
<
MAV_CMD
>
(
this
->
command
());
...
...
@@ -759,7 +762,6 @@ void SimpleMissionItem::_setDefaultsForCommand(void)
}
_missionItem
.
setAutoContinue
(
true
);
_missionItem
.
setFrame
(
specifiesAltitude
()
?
MAV_FRAME_GLOBAL_RELATIVE_ALT
:
MAV_FRAME_MISSION
);
setRawEdit
(
false
);
}
...
...
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