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
f34a7c6e
Commit
f34a7c6e
authored
Oct 17, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix unit tests
parent
0adf8caa
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
41 deletions
+31
-41
MissionItem.cc
src/MissionItem.cc
+3
-3
MissionItem.h
src/MissionItem.h
+3
-1
MissionItemTest.cc
src/MissionItemTest.cc
+24
-36
MainWindow.qml
src/ui/MainWindow.qml
+1
-1
No files found.
src/MissionItem.cc
View file @
f34a7c6e
...
...
@@ -561,13 +561,13 @@ QString MissionItem::commandDescription(void)
description
=
"Travel to a position and Loiter around the specified radius for an amount of time."
;
break
;
case
MAV_CMD_NAV_RETURN_TO_LAUNCH
:
description
=
"Send the vehicle back to the home position
set when armed
."
;
description
=
"Send the vehicle back to the home position."
;
break
;
case
MAV_CMD_NAV_LAND
:
description
=
"Land vehicle at the
current
location."
;
description
=
"Land vehicle at the
specified
location."
;
break
;
case
MAV_CMD_NAV_TAKEOFF
:
description
=
"
Lift off from the ground and travel to
the specified position."
;
description
=
"
Take off from the ground and travel towards
the specified position."
;
break
;
case
MAV_CMD_CONDITION_DELAY
:
description
=
"Delay"
;
...
...
src/MissionItem.h
View file @
f34a7c6e
...
...
@@ -101,6 +101,9 @@ public:
double
headingDegrees
(
void
)
const
;
void
setHeadingDegrees
(
double
headingDegrees
);
// This is public for unit testing
double
_yawRadians
(
void
)
const
;
QStringList
commandNames
(
void
);
QString
commandName
(
void
);
QString
commandDescription
(
void
);
...
...
@@ -251,7 +254,6 @@ private slots:
private:
QString
_oneDecimalString
(
double
value
);
void
_connectSignals
(
void
);
double
_yawRadians
(
void
)
const
;
void
_setYawRadians
(
double
yawRadians
);
private:
...
...
src/MissionItemTest.cc
View file @
f34a7c6e
...
...
@@ -27,63 +27,46 @@
UT_REGISTER_TEST
(
MissionItemTest
)
const
MissionItemTest
::
ItemInfo_t
MissionItemTest
::
_rgItemInfo
[]
=
{
{
1
,
QGeoCoordinate
(
-
10.0
,
-
20.0
,
-
30.0
),
MAV_CMD_NAV_WAYPOINT
,
10.0
,
20.0
,
30.0
,
40
.0
,
true
,
false
,
MAV_FRAME_GLOBAL_RELATIVE_ALT
},
{
1
,
QGeoCoordinate
(
-
10.0
,
-
20.0
,
-
30.0
),
MAV_CMD_NAV_LOITER_UNLIM
,
10.0
,
20.0
,
30.0
,
40
.0
,
true
,
false
,
MAV_FRAME_GLOBAL_RELATIVE_ALT
},
{
1
,
QGeoCoordinate
(
-
10.0
,
-
20.0
,
-
30.0
),
MAV_CMD_NAV_LOITER_TURNS
,
10.0
,
20.0
,
30.0
,
40
.0
,
true
,
false
,
MAV_FRAME_GLOBAL_RELATIVE_ALT
},
{
1
,
QGeoCoordinate
(
-
10.0
,
-
20.0
,
-
30.0
),
MAV_CMD_NAV_LOITER_TIME
,
10.0
,
20.0
,
30.0
,
40
.0
,
true
,
false
,
MAV_FRAME_GLOBAL_RELATIVE_ALT
},
{
1
,
QGeoCoordinate
(
-
10.0
,
-
20.0
,
-
30.0
),
MAV_CMD_NAV_LAND
,
10.0
,
20.0
,
30.0
,
40
.0
,
true
,
false
,
MAV_FRAME_GLOBAL_RELATIVE_ALT
},
{
1
,
QGeoCoordinate
(
-
10.0
,
-
20.0
,
-
30.0
),
MAV_CMD_NAV_TAKEOFF
,
10.0
,
20.0
,
30.0
,
40
.0
,
true
,
false
,
MAV_FRAME_GLOBAL_RELATIVE_ALT
},
{
1
,
QGeoCoordinate
(
-
10.0
,
-
20.0
,
-
30.0
),
MAV_CMD_CONDITION_DELAY
,
10.0
,
20.0
,
30.0
,
40
.0
,
true
,
false
,
MAV_FRAME_MISSION
},
{
1
,
QGeoCoordinate
(
-
10.0
,
-
20.0
,
-
30.0
),
MAV_CMD_DO_JUMP
,
10.0
,
20.0
,
30.0
,
40
.0
,
true
,
false
,
MAV_FRAME_MISSION
},
{
1
,
QGeoCoordinate
(
-
10.0
,
-
20.0
,
-
30.0
),
MAV_CMD_NAV_WAYPOINT
,
10.0
,
20.0
,
30.0
,
1
.0
,
true
,
false
,
MAV_FRAME_GLOBAL_RELATIVE_ALT
},
{
1
,
QGeoCoordinate
(
-
10.0
,
-
20.0
,
-
30.0
),
MAV_CMD_NAV_LOITER_UNLIM
,
10.0
,
20.0
,
30.0
,
1
.0
,
true
,
false
,
MAV_FRAME_GLOBAL_RELATIVE_ALT
},
{
1
,
QGeoCoordinate
(
-
10.0
,
-
20.0
,
-
30.0
),
MAV_CMD_NAV_LOITER_TURNS
,
10.0
,
20.0
,
30.0
,
1
.0
,
true
,
false
,
MAV_FRAME_GLOBAL_RELATIVE_ALT
},
{
1
,
QGeoCoordinate
(
-
10.0
,
-
20.0
,
-
30.0
),
MAV_CMD_NAV_LOITER_TIME
,
10.0
,
20.0
,
30.0
,
1
.0
,
true
,
false
,
MAV_FRAME_GLOBAL_RELATIVE_ALT
},
{
1
,
QGeoCoordinate
(
-
10.0
,
-
20.0
,
-
30.0
),
MAV_CMD_NAV_LAND
,
10.0
,
20.0
,
30.0
,
1
.0
,
true
,
false
,
MAV_FRAME_GLOBAL_RELATIVE_ALT
},
{
1
,
QGeoCoordinate
(
-
10.0
,
-
20.0
,
-
30.0
),
MAV_CMD_NAV_TAKEOFF
,
10.0
,
20.0
,
30.0
,
1
.0
,
true
,
false
,
MAV_FRAME_GLOBAL_RELATIVE_ALT
},
{
1
,
QGeoCoordinate
(
-
10.0
,
-
20.0
,
-
30.0
),
MAV_CMD_CONDITION_DELAY
,
10.0
,
20.0
,
30.0
,
1
.0
,
true
,
false
,
MAV_FRAME_MISSION
},
{
1
,
QGeoCoordinate
(
-
10.0
,
-
20.0
,
-
30.0
),
MAV_CMD_DO_JUMP
,
10.0
,
20.0
,
30.0
,
1
.0
,
true
,
false
,
MAV_FRAME_MISSION
},
};
const
MissionItemTest
::
FactValue_t
MissionItemTest
::
_rgFactValuesWaypoint
[]
=
{
{
"Latitude:"
,
-
10.0
},
{
"Longitude:"
,
-
20.0
},
{
"Altitude:"
,
-
30.0
},
{
"Heading:"
,
40.0
},
{
"Radius:"
,
20.0
},
{
"Hold:"
,
10.0
},
};
const
MissionItemTest
::
FactValue_t
MissionItemTest
::
_rgFactValuesLoiterUnlim
[]
=
{
{
"Latitude:"
,
-
10.0
},
{
"Longitude:"
,
-
20.0
},
{
"Altitude:"
,
-
30.0
},
{
"Heading:"
,
40.0
},
{
"Radius:"
,
30.0
},
};
const
MissionItemTest
::
FactValue_t
MissionItemTest
::
_rgFactValuesLoiterTurns
[]
=
{
{
"Latitude:"
,
-
10.0
},
{
"Longitude:"
,
-
20.0
},
{
"Altitude:"
,
-
30.0
},
{
"Heading:"
,
40.0
},
{
"Radius:"
,
30.0
},
{
"Turns:"
,
10.0
},
};
const
MissionItemTest
::
FactValue_t
MissionItemTest
::
_rgFactValuesLoiterTime
[]
=
{
{
"Latitude:"
,
-
10.0
},
{
"Longitude:"
,
-
20.0
},
{
"Altitude:"
,
-
30.0
},
{
"Heading:"
,
40.0
},
{
"Radius:"
,
30.0
},
{
"Seconds:"
,
10.0
},
};
const
MissionItemTest
::
FactValue_t
MissionItemTest
::
_rgFactValuesLand
[]
=
{
{
"Latitude:"
,
-
10.0
},
{
"Longitude:"
,
-
20.0
},
{
"Altitude:"
,
-
30.0
},
{
"Heading:"
,
40
.0
},
{
"Heading:"
,
1
.0
},
};
const
MissionItemTest
::
FactValue_t
MissionItemTest
::
_rgFactValuesTakeoff
[]
=
{
{
"Latitude:"
,
-
10.0
},
{
"Longitude:"
,
-
20.0
},
{
"Altitude:"
,
-
30.0
},
{
"Heading:"
,
40
.0
},
{
"Heading:"
,
1
.0
},
{
"Pitch:"
,
10.0
},
};
...
...
@@ -97,14 +80,14 @@ const MissionItemTest::FactValue_t MissionItemTest::_rgFactValuesDoJump[] = {
};
const
MissionItemTest
::
ItemExpected_t
MissionItemTest
::
_rgItemExpected
[]
=
{
{
"1
\t
0
\t
3
\t
16
\t
10
\t
20
\t
30
\t
40
\t
-10
\t
-20
\t
-30
\t
1
\r\n
"
,
sizeof
(
MissionItemTest
::
_rgFactValuesWaypoint
)
/
sizeof
(
MissionItemTest
::
_rgFactValuesWaypoint
[
0
]),
MissionItemTest
::
_rgFactValuesWaypoint
},
{
"1
\t
0
\t
3
\t
17
\t
10
\t
20
\t
30
\t
40
\t
-10
\t
-20
\t
-30
\t
1
\r\n
"
,
sizeof
(
MissionItemTest
::
_rgFactValuesLoiterUnlim
)
/
sizeof
(
MissionItemTest
::
_rgFactValuesLoiterUnlim
[
0
]),
MissionItemTest
::
_rgFactValuesLoiterUnlim
},
{
"1
\t
0
\t
3
\t
18
\t
10
\t
20
\t
30
\t
40
\t
-10
\t
-20
\t
-30
\t
1
\r\n
"
,
sizeof
(
MissionItemTest
::
_rgFactValuesLoiterTurns
)
/
sizeof
(
MissionItemTest
::
_rgFactValuesLoiterTurns
[
0
]),
MissionItemTest
::
_rgFactValuesLoiterTurns
},
{
"1
\t
0
\t
3
\t
19
\t
10
\t
20
\t
30
\t
40
\t
-10
\t
-20
\t
-30
\t
1
\r\n
"
,
sizeof
(
MissionItemTest
::
_rgFactValuesLoiterTime
)
/
sizeof
(
MissionItemTest
::
_rgFactValuesLoiterTime
[
0
]),
MissionItemTest
::
_rgFactValuesLoiterTime
},
{
"1
\t
0
\t
3
\t
21
\t
10
\t
20
\t
30
\t
40
\t
-10
\t
-20
\t
-30
\t
1
\r\n
"
,
sizeof
(
MissionItemTest
::
_rgFactValuesLand
)
/
sizeof
(
MissionItemTest
::
_rgFactValuesLand
[
0
]),
MissionItemTest
::
_rgFactValuesLand
},
{
"1
\t
0
\t
3
\t
22
\t
10
\t
20
\t
30
\t
40
\t
-10
\t
-20
\t
-30
\t
1
\r\n
"
,
sizeof
(
MissionItemTest
::
_rgFactValuesTakeoff
)
/
sizeof
(
MissionItemTest
::
_rgFactValuesTakeoff
[
0
]),
MissionItemTest
::
_rgFactValuesTakeoff
},
{
"1
\t
0
\t
2
\t
112
\t
10
\t
20
\t
30
\t
40
\t
-10
\t
-20
\t
-30
\t
1
\r\n
"
,
sizeof
(
MissionItemTest
::
_rgFactValuesConditionDelay
)
/
sizeof
(
MissionItemTest
::
_rgFactValuesConditionDelay
[
0
]),
MissionItemTest
::
_rgFactValuesConditionDelay
},
{
"1
\t
0
\t
2
\t
177
\t
10
\t
20
\t
30
\t
40
\t
-10
\t
-20
\t
-30
\t
1
\r\n
"
,
sizeof
(
MissionItemTest
::
_rgFactValuesDoJump
)
/
sizeof
(
MissionItemTest
::
_rgFactValuesDoJump
[
0
]),
MissionItemTest
::
_rgFactValuesDoJump
},
{
"1
\t
0
\t
3
\t
16
\t
10
\t
20
\t
30
\t
1
\t
-10
\t
-20
\t
-30
\t
1
\r\n
"
,
sizeof
(
MissionItemTest
::
_rgFactValuesWaypoint
)
/
sizeof
(
MissionItemTest
::
_rgFactValuesWaypoint
[
0
]),
MissionItemTest
::
_rgFactValuesWaypoint
},
{
"1
\t
0
\t
3
\t
17
\t
10
\t
20
\t
30
\t
1
\t
-10
\t
-20
\t
-30
\t
1
\r\n
"
,
sizeof
(
MissionItemTest
::
_rgFactValuesLoiterUnlim
)
/
sizeof
(
MissionItemTest
::
_rgFactValuesLoiterUnlim
[
0
]),
MissionItemTest
::
_rgFactValuesLoiterUnlim
},
{
"1
\t
0
\t
3
\t
18
\t
10
\t
20
\t
30
\t
1
\t
-10
\t
-20
\t
-30
\t
1
\r\n
"
,
sizeof
(
MissionItemTest
::
_rgFactValuesLoiterTurns
)
/
sizeof
(
MissionItemTest
::
_rgFactValuesLoiterTurns
[
0
]),
MissionItemTest
::
_rgFactValuesLoiterTurns
},
{
"1
\t
0
\t
3
\t
19
\t
10
\t
20
\t
30
\t
1
\t
-10
\t
-20
\t
-30
\t
1
\r\n
"
,
sizeof
(
MissionItemTest
::
_rgFactValuesLoiterTime
)
/
sizeof
(
MissionItemTest
::
_rgFactValuesLoiterTime
[
0
]),
MissionItemTest
::
_rgFactValuesLoiterTime
},
{
"1
\t
0
\t
3
\t
21
\t
10
\t
20
\t
30
\t
1
\t
-10
\t
-20
\t
-30
\t
1
\r\n
"
,
sizeof
(
MissionItemTest
::
_rgFactValuesLand
)
/
sizeof
(
MissionItemTest
::
_rgFactValuesLand
[
0
]),
MissionItemTest
::
_rgFactValuesLand
},
{
"1
\t
0
\t
3
\t
22
\t
10
\t
20
\t
30
\t
1
\t
-10
\t
-20
\t
-30
\t
1
\r\n
"
,
sizeof
(
MissionItemTest
::
_rgFactValuesTakeoff
)
/
sizeof
(
MissionItemTest
::
_rgFactValuesTakeoff
[
0
]),
MissionItemTest
::
_rgFactValuesTakeoff
},
{
"1
\t
0
\t
2
\t
112
\t
10
\t
20
\t
30
\t
1
\t
-10
\t
-20
\t
-30
\t
1
\r\n
"
,
sizeof
(
MissionItemTest
::
_rgFactValuesConditionDelay
)
/
sizeof
(
MissionItemTest
::
_rgFactValuesConditionDelay
[
0
]),
MissionItemTest
::
_rgFactValuesConditionDelay
},
{
"1
\t
0
\t
2
\t
177
\t
10
\t
20
\t
30
\t
1
\t
-10
\t
-20
\t
-30
\t
1
\r\n
"
,
sizeof
(
MissionItemTest
::
_rgFactValuesDoJump
)
/
sizeof
(
MissionItemTest
::
_rgFactValuesDoJump
[
0
]),
MissionItemTest
::
_rgFactValuesDoJump
},
};
MissionItemTest
::
MissionItemTest
(
void
)
...
...
@@ -149,7 +132,11 @@ void MissionItemTest::_test(void)
if
(
factValue
->
name
==
fact
->
name
())
{
qDebug
()
<<
factValue
->
name
;
QCOMPARE
(
fact
->
value
().
toDouble
(),
factValue
->
value
);
if
(
strcmp
(
factValue
->
name
,
"Heading:"
)
==
0
)
{
QCOMPARE
(
fact
->
value
().
toDouble
()
*
(
M_PI
/
180.0
),
item
->
_yawRadians
());
}
else
{
QCOMPARE
(
fact
->
value
().
toDouble
(),
factValue
->
value
);
}
factCount
++
;
found
=
true
;
break
;
...
...
@@ -158,6 +145,7 @@ void MissionItemTest::_test(void)
QVERIFY
(
found
);
}
qDebug
()
<<
info
->
command
;
QCOMPARE
(
factCount
,
expected
->
cFactValues
);
// Validate that loading is working correctly
...
...
src/ui/MainWindow.qml
View file @
f34a7c6e
...
...
@@ -72,7 +72,7 @@ FlightDisplayView {
onShowSetupFirmware
:
setupViewLoader
.
item
.
showFirmwarePanel
()
onShowSetupParameters
:
setupViewLoader
.
item
.
showParametersPanel
()
onShowSetupSummary
:
setupViewLoader
.
item
.
showSummaryPanel
()
onShowSetupVehicleComponent
:
setupViewLoader
.
item
.
showVehicleComponentPanel
(
ve
c
hicleComponent
)
onShowSetupVehicleComponent
:
setupViewLoader
.
item
.
showVehicleComponentPanel
(
vehicleComponent
)
}
MainToolBar
{
...
...
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