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
1d46da77
Commit
1d46da77
authored
Jun 18, 2017
by
DonLakeFlyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix camera section showing on wrong commands
Update unit tests to catch this
parent
6532f686
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
158 additions
and
4 deletions
+158
-4
MissionControllerTest.cc
src/MissionManager/MissionControllerTest.cc
+24
-0
MissionControllerTest.h
src/MissionManager/MissionControllerTest.h
+3
-2
PlanMasterController.cc
src/MissionManager/PlanMasterController.cc
+1
-0
SimpleMissionItem.cc
src/MissionManager/SimpleMissionItem.cc
+11
-2
SectionTest.plan
src/MissionManager/UnitTest/SectionTest.plan
+119
-0
No files found.
src/MissionManager/MissionControllerTest.cc
View file @
1d46da77
...
...
@@ -224,3 +224,27 @@ void MissionControllerTest::_testGimbalRecalc(void)
QCOMPARE
(
visualItem
->
missionGimbalYaw
(),
0.0
);
}
}
void
MissionControllerTest
::
_testLoadJsonSectionAvailable
(
void
)
{
_initForFirmwareType
(
MAV_AUTOPILOT_PX4
);
_masterController
->
loadFromFile
(
":/unittest/SectionTest.plan"
);
QmlObjectListModel
*
visualItems
=
_missionController
->
visualItems
();
QVERIFY
(
visualItems
);
QCOMPARE
(
visualItems
->
count
(),
5
);
// Check that only waypoint items have camera and speed sections
for
(
int
i
=
1
;
i
<
visualItems
->
count
();
i
++
)
{
SimpleMissionItem
*
item
=
visualItems
->
value
<
SimpleMissionItem
*>
(
i
);
QVERIFY
(
item
);
if
((
int
)
item
->
command
()
==
MAV_CMD_NAV_WAYPOINT
)
{
QCOMPARE
(
item
->
cameraSection
()
->
available
(),
true
);
QCOMPARE
(
item
->
speedSection
()
->
available
(),
true
);
}
else
{
QCOMPARE
(
item
->
cameraSection
()
->
available
(),
false
);
QCOMPARE
(
item
->
speedSection
()
->
available
(),
false
);
}
}
}
src/MissionManager/MissionControllerTest.h
View file @
1d46da77
...
...
@@ -33,12 +33,13 @@ private slots:
void
cleanup
(
void
);
void
_testGimbalRecalc
(
void
);
private:
void
_testLoadJsonSectionAvailable
(
void
);
void
_testEmptyVehicleAPM
(
void
);
void
_testEmptyVehiclePX4
(
void
);
void
_testAddWayppointAPM
(
void
);
void
_testAddWayppointPX4
(
void
);
private:
#if 0
void _testOfflineToOnlineAPM(void);
void _testOfflineToOnlinePX4(void);
...
...
src/MissionManager/PlanMasterController.cc
View file @
1d46da77
...
...
@@ -246,6 +246,7 @@ void PlanMasterController::loadFromFile(const QString& filename)
if
(
!
file
.
open
(
QIODevice
::
ReadOnly
|
QIODevice
::
Text
))
{
errorString
=
file
.
errorString
()
+
QStringLiteral
(
" "
)
+
filename
;
qgcApp
()
->
showMessage
(
errorMessage
.
arg
(
errorString
));
return
;
}
...
...
src/MissionManager/SimpleMissionItem.cc
View file @
1d46da77
...
...
@@ -278,12 +278,20 @@ void SimpleMissionItem::save(QJsonArray& missionItems)
bool
SimpleMissionItem
::
load
(
QTextStream
&
loadStream
)
{
return
_missionItem
.
load
(
loadStream
);
bool
success
;
if
((
success
=
_missionItem
.
load
(
loadStream
)))
{
_updateOptionalSections
();
}
return
success
;
}
bool
SimpleMissionItem
::
load
(
const
QJsonObject
&
json
,
int
sequenceNumber
,
QString
&
errorString
)
{
return
_missionItem
.
load
(
json
,
sequenceNumber
,
errorString
);
bool
success
;
if
((
success
=
_missionItem
.
load
(
json
,
sequenceNumber
,
errorString
)))
{
_updateOptionalSections
();
}
return
success
;
}
bool
SimpleMissionItem
::
isStandaloneCoordinate
(
void
)
const
...
...
@@ -755,6 +763,7 @@ void SimpleMissionItem::_updateOptionalSections(void)
emit
cameraSectionChanged
(
_cameraSection
);
emit
speedSectionChanged
(
_speedSection
);
emit
lastSequenceNumberChanged
(
lastSequenceNumber
());
}
int
SimpleMissionItem
::
lastSequenceNumber
(
void
)
const
...
...
src/MissionManager/UnitTest/SectionTest.plan
0 → 100644
View file @
1d46da77
{
"fileType": "Plan",
"geoFence": {
"polygon": [
],
"version": 1
},
"groundStation": "QGroundControl",
"mission": {
"cruiseSpeed": 15,
"firmwareType": 12,
"hoverSpeed": 5,
"items": [
{
"autoContinue": true,
"command": 22,
"coordinate": [
47.63311996,
-122.090763,
20
],
"doJumpId": 1,
"frame": 3,
"params": [
0,
0,
0,
null
],
"type": "SimpleItem"
},
{
"autoContinue": true,
"command": 16,
"coordinate": [
47.63369112,
-122.08925023,
20
],
"doJumpId": 2,
"frame": 3,
"params": [
0,
0,
0,
null
],
"type": "SimpleItem"
},
{
"autoContinue": true,
"command": 16,
"coordinate": [
47.63345253,
-122.08725467,
20
],
"doJumpId": 3,
"frame": 3,
"params": [
0,
0,
0,
null
],
"type": "SimpleItem"
},
{
"autoContinue": true,
"command": 205,
"coordinate": [
0,
0,
2
],
"doJumpId": 4,
"frame": 2,
"params": [
0,
0,
0,
0
],
"type": "SimpleItem"
},
{
"autoContinue": true,
"command": 16,
"coordinate": [
47.63261386,
-122.08661094,
20
],
"doJumpId": 5,
"frame": 3,
"params": [
0,
0,
0,
null
],
"type": "SimpleItem"
}
],
"plannedHomePosition": [
47.633389756176875,
-122.09076300000001,
20
],
"vehicleType": 2,
"version": 2
},
"rallyPoints": {
"points": [
],
"version": 1
},
"version": 1
}
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