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
1c144fb6
Commit
1c144fb6
authored
Nov 26, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2291 from DonLakeFlyer/MissionItemFix
Send mission item vehicle trashing float values
parents
135996b3
e81d0bf2
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
79 additions
and
55 deletions
+79
-55
MissionItem.cc
src/MissionManager/MissionItem.cc
+22
-0
MissionItemTest.cc
src/MissionManager/MissionItemTest.cc
+57
-46
MissionItemTest.h
src/MissionManager/MissionItemTest.h
+0
-9
No files found.
src/MissionManager/MissionItem.cc
View file @
1c144fb6
...
...
@@ -200,6 +200,28 @@ MissionItem::MissionItem(int sequenceNumber,
MissionItem
::
MissionItem
(
const
MissionItem
&
other
,
QObject
*
parent
)
:
QObject
(
parent
)
,
_rawEdit
(
false
)
,
_dirty
(
false
)
,
_sequenceNumber
(
0
)
,
_isCurrentItem
(
false
)
,
_distance
(
0.0
)
,
_homePositionSpecialCase
(
false
)
,
_homePositionValid
(
false
)
,
_altitudeRelativeToHomeFact
(
0
,
"Altitude is relative to home"
,
FactMetaData
::
valueTypeUint32
)
,
_commandFact
(
0
,
"Command:"
,
FactMetaData
::
valueTypeUint32
)
,
_frameFact
(
0
,
"Frame:"
,
FactMetaData
::
valueTypeUint32
)
,
_param1Fact
(
0
,
"Param1:"
,
FactMetaData
::
valueTypeDouble
)
,
_param2Fact
(
0
,
"Param2:"
,
FactMetaData
::
valueTypeDouble
)
,
_param3Fact
(
0
,
"Param3:"
,
FactMetaData
::
valueTypeDouble
)
,
_param4Fact
(
0
,
"Param4:"
,
FactMetaData
::
valueTypeDouble
)
,
_param5Fact
(
0
,
"Lat/X:"
,
FactMetaData
::
valueTypeDouble
)
,
_param6Fact
(
0
,
"Lon/Y:"
,
FactMetaData
::
valueTypeDouble
)
,
_param7Fact
(
0
,
"Alt/Z:"
,
FactMetaData
::
valueTypeDouble
)
,
_supportedCommandFact
(
0
,
"Command:"
,
FactMetaData
::
valueTypeUint32
)
,
_param1MetaData
(
FactMetaData
::
valueTypeDouble
)
,
_param2MetaData
(
FactMetaData
::
valueTypeDouble
)
,
_param3MetaData
(
FactMetaData
::
valueTypeDouble
)
,
_param4MetaData
(
FactMetaData
::
valueTypeDouble
)
,
_syncingAltitudeRelativeToHomeAndFrame
(
false
)
,
_syncingHeadingDegreesAndParam4
(
false
)
,
_syncingSupportedCommandAndCommand
(
false
)
...
...
src/MissionManager/MissionItemTest.cc
View file @
1c144fb6
...
...
@@ -25,68 +25,68 @@
#include "MissionItem.h"
const
MissionItemTest
::
ItemInfo_t
MissionItemTest
::
_rgItemInfo
[]
=
{
{
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
},
{
MAV_CMD_NAV_WAYPOINT
,
MAV_FRAME_GLOBAL_RELATIVE_ALT
},
{
MAV_CMD_NAV_LOITER_UNLIM
,
MAV_FRAME_GLOBAL_RELATIVE_ALT
},
{
MAV_CMD_NAV_LOITER_TURNS
,
MAV_FRAME_GLOBAL_RELATIVE_ALT
},
{
MAV_CMD_NAV_LOITER_TIME
,
MAV_FRAME_GLOBAL_RELATIVE_ALT
},
{
MAV_CMD_NAV_LAND
,
MAV_FRAME_GLOBAL_RELATIVE_ALT
},
{
MAV_CMD_NAV_TAKEOFF
,
MAV_FRAME_GLOBAL_RELATIVE_ALT
},
{
MAV_CMD_CONDITION_DELAY
,
MAV_FRAME_MISSION
},
{
MAV_CMD_DO_JUMP
,
MAV_FRAME_MISSION
},
};
const
MissionItemTest
::
FactValue_t
MissionItemTest
::
_rgFactValuesWaypoint
[]
=
{
{
"Altitude:"
,
-
30.0
},
{
"Hold:"
,
10.
0
},
{
"Altitude:"
,
70.1234567
},
{
"Hold:"
,
10.
1234567
},
};
const
MissionItemTest
::
FactValue_t
MissionItemTest
::
_rgFactValuesLoiterUnlim
[]
=
{
{
"Altitude:"
,
-
30.0
},
{
"Radius:"
,
30.
0
},
{
"Altitude:"
,
70.1234567
},
{
"Radius:"
,
30.
1234567
},
};
const
MissionItemTest
::
FactValue_t
MissionItemTest
::
_rgFactValuesLoiterTurns
[]
=
{
{
"Altitude:"
,
-
30.0
},
{
"Radius:"
,
30.
0
},
{
"Turns:"
,
10.
0
},
{
"Altitude:"
,
70.1234567
},
{
"Radius:"
,
30.
1234567
},
{
"Turns:"
,
10.
1234567
},
};
const
MissionItemTest
::
FactValue_t
MissionItemTest
::
_rgFactValuesLoiterTime
[]
=
{
{
"Altitude:"
,
-
30.0
},
{
"Radius:"
,
30.
0
},
{
"Hold:"
,
10.
0
},
{
"Altitude:"
,
70.1234567
},
{
"Radius:"
,
30.
1234567
},
{
"Hold:"
,
10.
1234567
},
};
const
MissionItemTest
::
FactValue_t
MissionItemTest
::
_rgFactValuesLand
[]
=
{
{
"Altitude:"
,
-
30.0
},
{
"Abort Alt:"
,
10.
0
},
{
"Heading:"
,
1.0
},
{
"Altitude:"
,
70.1234567
},
{
"Abort Alt:"
,
10.
1234567
},
{
"Heading:"
,
40.1234567
},
};
const
MissionItemTest
::
FactValue_t
MissionItemTest
::
_rgFactValuesTakeoff
[]
=
{
{
"Altitude:"
,
-
30.0
},
{
"Heading:"
,
1.0
},
{
"Pitch:"
,
10.
0
},
{
"Altitude:"
,
70.1234567
},
{
"Heading:"
,
40.1234567
},
{
"Pitch:"
,
10.
1234567
},
};
const
MissionItemTest
::
FactValue_t
MissionItemTest
::
_rgFactValuesConditionDelay
[]
=
{
{
"Hold:"
,
10.
0
},
{
"Hold:"
,
10.
1234567
},
};
const
MissionItemTest
::
FactValue_t
MissionItemTest
::
_rgFactValuesDoJump
[]
=
{
{
"Item #:"
,
10.0
},
{
"Repeat:"
,
20.0
},
{
"Item #:"
,
10.1234567
},
{
"Repeat:"
,
20.1234567
},
};
const
MissionItemTest
::
ItemExpected_t
MissionItemTest
::
_rgItemExpected
[]
=
{
{
"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
},
{
sizeof
(
MissionItemTest
::
_rgFactValuesWaypoint
)
/
sizeof
(
MissionItemTest
::
_rgFactValuesWaypoint
[
0
]),
MissionItemTest
::
_rgFactValuesWaypoint
},
{
sizeof
(
MissionItemTest
::
_rgFactValuesLoiterUnlim
)
/
sizeof
(
MissionItemTest
::
_rgFactValuesLoiterUnlim
[
0
]),
MissionItemTest
::
_rgFactValuesLoiterUnlim
},
{
sizeof
(
MissionItemTest
::
_rgFactValuesLoiterTurns
)
/
sizeof
(
MissionItemTest
::
_rgFactValuesLoiterTurns
[
0
]),
MissionItemTest
::
_rgFactValuesLoiterTurns
},
{
sizeof
(
MissionItemTest
::
_rgFactValuesLoiterTime
)
/
sizeof
(
MissionItemTest
::
_rgFactValuesLoiterTime
[
0
]),
MissionItemTest
::
_rgFactValuesLoiterTime
},
{
sizeof
(
MissionItemTest
::
_rgFactValuesLand
)
/
sizeof
(
MissionItemTest
::
_rgFactValuesLand
[
0
]),
MissionItemTest
::
_rgFactValuesLand
},
{
sizeof
(
MissionItemTest
::
_rgFactValuesTakeoff
)
/
sizeof
(
MissionItemTest
::
_rgFactValuesTakeoff
[
0
]),
MissionItemTest
::
_rgFactValuesTakeoff
},
{
sizeof
(
MissionItemTest
::
_rgFactValuesConditionDelay
)
/
sizeof
(
MissionItemTest
::
_rgFactValuesConditionDelay
[
0
]),
MissionItemTest
::
_rgFactValuesConditionDelay
},
{
sizeof
(
MissionItemTest
::
_rgFactValuesDoJump
)
/
sizeof
(
MissionItemTest
::
_rgFactValuesDoJump
[
0
]),
MissionItemTest
::
_rgFactValuesDoJump
},
};
MissionItemTest
::
MissionItemTest
(
void
)
...
...
@@ -102,24 +102,35 @@ void MissionItemTest::_test(void)
qDebug
()
<<
"Command:"
<<
info
->
command
;
MissionItem
*
item
=
new
MissionItem
(
info
->
sequenceNumber
,
MissionItem
*
item
=
new
MissionItem
(
1
,
info
->
command
,
info
->
frame
,
info
->
param1
,
info
->
param2
,
info
->
param3
,
info
->
param4
,
info
->
coordinate
.
latitude
()
,
info
->
coordinate
.
longitude
()
,
info
->
coordinate
.
altitude
()
,
info
->
autocontin
ue
,
info
->
isCurrentItem
);
10.1234567
,
20.1234567
,
30.1234567
,
40.1234567
,
50.1234567
,
60.1234567
,
70.1234567
,
tr
ue
,
false
);
// Validate the saving is working correctly
QString
savedItemString
;
QTextStream
saveStream
(
&
savedItemString
,
QIODevice
::
WriteOnly
);
item
->
save
(
saveStream
);
QCOMPARE
(
savedItemString
,
QString
(
expected
->
streamString
));
// Param floats to string with 18 digits or precision
QString
paramStrings
=
"10.1234567000000002
\t
"
"20.1234566999999984
\t
"
"30.1234566999999984
\t
"
"40.1234566999999984
\t
"
"50.1234566999999984
\t
"
"60.1234566999999984
\t
"
"70.1234567000000055"
;
QString
expectedItemString
=
QString
(
"1
\t
0
\t
%1
\t
%2
\t
%3
\t
1
\r\n
"
).
arg
(
info
->
frame
).
arg
(
info
->
command
).
arg
(
paramStrings
);
QCOMPARE
(
savedItemString
,
expectedItemString
);
// Validate that the fact values are correctly returned
size_t
factCount
=
0
;
...
...
src/MissionManager/MissionItemTest.h
View file @
1c144fb6
...
...
@@ -47,15 +47,7 @@ private slots:
private:
typedef
struct
{
int
sequenceNumber
;
QGeoCoordinate
coordinate
;
MAV_CMD
command
;
double
param1
;
double
param2
;
double
param3
;
double
param4
;
bool
autocontinue
;
bool
isCurrentItem
;
MAV_FRAME
frame
;
}
ItemInfo_t
;
...
...
@@ -65,7 +57,6 @@ private:
}
FactValue_t
;
typedef
struct
{
const
char
*
streamString
;
size_t
cFactValues
;
const
FactValue_t
*
rgFactValues
;
}
ItemExpected_t
;
...
...
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