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
830d7dee
Commit
830d7dee
authored
Sep 10, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1860 from DonLakeFlyer/MissionWork
Mission work
parents
00b393ba
faa7500c
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
180 additions
and
119 deletions
+180
-119
Fact.cc
src/FactSystem/Fact.cc
+36
-12
Fact.h
src/FactSystem/Fact.h
+5
-2
FactMetaData.cc
src/FactSystem/FactMetaData.cc
+34
-0
FactMetaData.h
src/FactSystem/FactMetaData.h
+4
-0
MissionItem.cc
src/MissionItem.cc
+88
-85
MissionItem.h
src/MissionItem.h
+11
-18
Waypoint2DIcon.cc
src/ui/map/Waypoint2DIcon.cc
+2
-2
No files found.
src/FactSystem/Fact.cc
View file @
830d7dee
...
...
@@ -28,25 +28,49 @@
#include <QtQml>
Fact
::
Fact
(
void
)
:
_componentId
(
-
1
),
_value
(
0
),
_type
(
FactMetaData
::
valueTypeInt32
),
_metaData
(
NULL
)
Fact
::
Fact
(
QObject
*
parent
)
:
QObject
(
parent
)
,
_componentId
(
-
1
)
,
_value
(
0
)
,
_type
(
FactMetaData
::
valueTypeInt32
)
,
_metaData
(
NULL
)
{
FactMetaData
*
metaData
=
new
FactMetaData
(
_type
,
this
);
setMetaData
(
metaData
);
}
Fact
::
Fact
(
int
componentId
,
QString
name
,
FactMetaData
::
ValueType_t
type
,
QObject
*
parent
)
:
QObject
(
parent
),
_name
(
name
),
_componentId
(
componentId
),
_value
(
0
),
_type
(
type
),
_metaData
(
NULL
)
Fact
::
Fact
(
int
componentId
,
QString
name
,
FactMetaData
::
ValueType_t
type
,
QObject
*
parent
)
:
QObject
(
parent
)
,
_name
(
name
)
,
_componentId
(
componentId
)
,
_value
(
0
)
,
_type
(
type
)
,
_metaData
(
NULL
)
{
FactMetaData
*
metaData
=
new
FactMetaData
(
_type
,
this
);
setMetaData
(
metaData
);
}
Fact
::
Fact
(
const
Fact
&
other
,
QObject
*
parent
)
:
QObject
(
parent
)
{
*
this
=
other
;
}
const
Fact
&
Fact
::
operator
=
(
const
Fact
&
other
)
{
_name
=
other
.
_name
;
_componentId
=
other
.
_componentId
;
_value
=
other
.
_value
;
_type
=
other
.
_type
;
if
(
_metaData
&&
other
.
_metaData
)
{
*
_metaData
=
*
other
.
_metaData
;
}
else
{
_metaData
=
NULL
;
}
return
*
this
;
}
void
Fact
::
forceSetValue
(
const
QVariant
&
value
)
...
...
src/FactSystem/Fact.h
View file @
830d7dee
...
...
@@ -40,9 +40,12 @@ class Fact : public QObject
Q_OBJECT
public:
Fact
(
void
);
Fact
(
QObject
*
parent
=
NULL
);
Fact
(
int
componentId
,
QString
name
,
FactMetaData
::
ValueType_t
type
,
QObject
*
parent
=
NULL
);
Fact
(
const
Fact
&
other
,
QObject
*
parent
=
NULL
);
const
Fact
&
operator
=
(
const
Fact
&
other
);
Q_PROPERTY
(
int
componentId
READ
componentId
CONSTANT
)
Q_PROPERTY
(
QString
name
READ
name
CONSTANT
)
Q_PROPERTY
(
QVariant
value
READ
value
WRITE
setValue
NOTIFY
valueChanged
USER
true
)
...
...
src/FactSystem/FactMetaData.cc
View file @
830d7dee
...
...
@@ -32,6 +32,20 @@
#include <limits>
FactMetaData
::
FactMetaData
(
QObject
*
parent
)
:
QObject
(
parent
),
_group
(
"*Default Group"
),
_type
(
valueTypeInt32
),
_defaultValue
(
0
),
_defaultValueAvailable
(
false
),
_min
(
_minForType
()),
_max
(
_maxForType
()),
_minIsDefaultForType
(
true
),
_maxIsDefaultForType
(
true
)
{
}
FactMetaData
::
FactMetaData
(
ValueType_t
type
,
QObject
*
parent
)
:
QObject
(
parent
),
_group
(
"*Default Group"
),
...
...
@@ -46,6 +60,26 @@ FactMetaData::FactMetaData(ValueType_t type, QObject* parent) :
}
FactMetaData
::
FactMetaData
(
const
FactMetaData
&
other
,
QObject
*
parent
)
:
QObject
(
parent
)
{
*
this
=
other
;
}
const
FactMetaData
&
FactMetaData
::
operator
=
(
const
FactMetaData
&
other
)
{
_group
=
other
.
_group
;
_type
=
other
.
_type
;
_defaultValue
=
other
.
_defaultValue
;
_defaultValueAvailable
=
other
.
_defaultValueAvailable
;
_min
=
other
.
_min
;
_max
=
other
.
_max
;
_minIsDefaultForType
=
other
.
_minIsDefaultForType
;
_maxIsDefaultForType
=
other
.
_maxIsDefaultForType
;
return
*
this
;
}
QVariant
FactMetaData
::
defaultValue
(
void
)
{
if
(
_defaultValueAvailable
)
{
...
...
src/FactSystem/FactMetaData.h
View file @
830d7dee
...
...
@@ -52,7 +52,11 @@ public:
valueTypeDouble
}
ValueType_t
;
FactMetaData
(
QObject
*
parent
=
NULL
);
FactMetaData
(
ValueType_t
type
,
QObject
*
parent
=
NULL
);
FactMetaData
(
const
FactMetaData
&
other
,
QObject
*
parent
=
NULL
);
const
FactMetaData
&
operator
=
(
const
FactMetaData
&
other
);
// Property accessors
QString
name
(
void
)
{
return
_name
;
}
...
...
src/MissionItem.cc
View file @
830d7dee
...
...
@@ -60,28 +60,28 @@ MissionItem::MissionItem(QObject* parent,
:
QObject
(
parent
)
,
_sequenceNumber
(
sequenceNumber
)
,
_coordinate
(
coordinate
)
,
_yawRadians
(
param4
)
,
_frame
(
frame
)
,
_action
(
action
)
,
_autocontinue
(
autocontinue
)
,
_isCurrentItem
(
isCurrentItem
)
,
_orbit
(
param3
)
,
_param1
(
param1
)
,
_param2
(
param2
)
,
_reachedTime
(
0
)
,
_yawFact
(
NULL
)
,
_yaw
Radians
Fact
(
NULL
)
{
_yawFact
=
new
Fact
(
0
,
"Heading:"
,
FactMetaData
::
valueTypeDouble
,
this
);
_pitchFact
=
new
Fact
(
0
,
"Pitch:"
,
FactMetaData
::
valueTypeDouble
,
this
);
_loiterRadiusFact
=
new
Fact
(
0
,
"Radius:"
,
FactMetaData
::
valueTypeDouble
,
this
);
_param1Fact
=
new
Fact
(
0
,
QString
(),
FactMetaData
::
valueTypeDouble
,
this
);
_param2Fact
=
new
Fact
(
0
,
QString
(),
FactMetaData
::
valueTypeDouble
,
this
);
_yawRadiansFact
=
new
Fact
(
0
,
"Heading:"
,
FactMetaData
::
valueTypeDouble
,
this
);
_loiterOrbitRadiusFact
=
new
Fact
(
0
,
"Radius:"
,
FactMetaData
::
valueTypeDouble
,
this
);
_param1Fact
=
new
Fact
(
0
,
QString
(),
FactMetaData
::
valueTypeDouble
,
this
);
_param2Fact
=
new
Fact
(
0
,
QString
(),
FactMetaData
::
valueTypeDouble
,
this
);
setParam1
(
param1
);
setParam2
(
param2
);
setYawRadians
(
param4
);
setLoiterOrbitRadius
(
param3
);
// FIXME: Need to fill out more meta data
_
yawMetaData
=
new
FactMetaData
(
FactMetaData
::
valueTypeDouble
,
this
);
_
yawMetaData
->
setUnits
(
"degrees"
);
FactMetaData
*
yawMetaData
=
new
FactMetaData
(
FactMetaData
::
valueTypeDouble
,
this
);
yawMetaData
->
setUnits
(
"degrees"
);
_pitchMetaData
=
new
FactMetaData
(
FactMetaData
::
valueTypeDouble
,
this
);
_pitchMetaData
->
setUnits
(
"degrees"
);
...
...
@@ -92,8 +92,8 @@ MissionItem::MissionItem(QObject* parent,
_holdTimeMetaData
=
new
FactMetaData
(
FactMetaData
::
valueTypeDouble
,
this
);
_holdTimeMetaData
->
setUnits
(
"seconds"
);
_loiter
RadiusMetaData
=
new
FactMetaData
(
FactMetaData
::
valueTypeDouble
,
this
);
_loiter
RadiusMetaData
->
setUnits
(
"meters"
);
FactMetaData
*
loiterOrbit
RadiusMetaData
=
new
FactMetaData
(
FactMetaData
::
valueTypeDouble
,
this
);
loiterOrbit
RadiusMetaData
->
setUnits
(
"meters"
);
_loiterTurnsMetaData
=
new
FactMetaData
(
FactMetaData
::
valueTypeInt32
,
this
);
_loiterTurnsMetaData
->
setUnits
(
"count"
);
...
...
@@ -110,14 +110,28 @@ MissionItem::MissionItem(QObject* parent,
_jumpRepeatMetaData
=
new
FactMetaData
(
FactMetaData
::
valueTypeInt32
,
this
);
_jumpRepeatMetaData
->
setUnits
(
"count"
);
_yawFact
->
setMetaData
(
_yawMetaData
);
_pitchFact
->
setMetaData
(
_pitchMetaData
);
_loiterRadiusFact
->
setMetaData
(
_loiterRadiusMetaData
);
_yawRadiansFact
->
setMetaData
(
yawMetaData
);
_loiterOrbitRadiusFact
->
setMetaData
(
loiterOrbitRadiusMetaData
);
}
MissionItem
::
MissionItem
(
const
MissionItem
&
other
)
:
QObject
(
NULL
)
MissionItem
::
MissionItem
(
const
MissionItem
&
other
,
QObject
*
parent
)
:
QObject
(
parent
)
{
_yawRadiansFact
=
new
Fact
(
this
);
_loiterOrbitRadiusFact
=
new
Fact
(
this
);
_param1Fact
=
new
Fact
(
this
);
_param2Fact
=
new
Fact
(
this
);
_pitchMetaData
=
new
FactMetaData
(
this
);
_acceptanceRadiusMetaData
=
new
FactMetaData
(
this
);
_holdTimeMetaData
=
new
FactMetaData
(
this
);
_loiterTurnsMetaData
=
new
FactMetaData
(
this
);
_loiterSecondsMetaData
=
new
FactMetaData
(
this
);
_delaySecondsMetaData
=
new
FactMetaData
(
this
);
_jumpSequenceMetaData
=
new
FactMetaData
(
this
);
_jumpRepeatMetaData
=
new
FactMetaData
(
this
);
*
this
=
other
;
}
...
...
@@ -130,15 +144,25 @@ const MissionItem& MissionItem::operator=(const MissionItem& other)
_sequenceNumber
=
other
.
_sequenceNumber
;
_isCurrentItem
=
other
.
_isCurrentItem
;
_coordinate
=
other
.
_coordinate
;
_yawRadians
=
other
.
_yawRadians
;
_frame
=
other
.
_frame
;
_action
=
other
.
_action
;
_autocontinue
=
other
.
_autocontinue
;
_orbit
=
other
.
_orbit
;
_param1
=
other
.
_param1
;
_param2
=
other
.
_param2
;
_reachedTime
=
other
.
_reachedTime
;
*
_yawRadiansFact
=
*
other
.
_yawRadiansFact
;
*
_loiterOrbitRadiusFact
=
*
other
.
_loiterOrbitRadiusFact
;
*
_param1Fact
=
*
other
.
_param1Fact
;
*
_param2Fact
=
*
other
.
_param2Fact
;
*
_pitchMetaData
=
*
other
.
_pitchMetaData
;
*
_acceptanceRadiusMetaData
=
*
other
.
_acceptanceRadiusMetaData
;
*
_holdTimeMetaData
=
*
other
.
_holdTimeMetaData
;
*
_loiterTurnsMetaData
=
*
other
.
_loiterTurnsMetaData
;
*
_loiterSecondsMetaData
=
*
other
.
_loiterSecondsMetaData
;
*
_delaySecondsMetaData
=
*
other
.
_delaySecondsMetaData
;
*
_jumpSequenceMetaData
=
*
other
.
_jumpSequenceMetaData
;
*
_jumpRepeatMetaData
=
*
other
.
_jumpRepeatMetaData
;
return
*
this
;
}
...
...
@@ -154,7 +178,7 @@ void MissionItem::save(QTextStream &saveStream)
position
=
position
.
arg
(
y
(),
0
,
'g'
,
18
);
position
=
position
.
arg
(
z
(),
0
,
'g'
,
18
);
QString
parameters
(
"%1
\t
%2
\t
%3
\t
%4"
);
parameters
=
parameters
.
arg
(
_param1
,
0
,
'g'
,
18
).
arg
(
_param2
,
0
,
'g'
,
18
).
arg
(
_orbit
,
0
,
'g'
,
18
).
arg
(
_yawRadians
,
0
,
'g'
,
18
);
parameters
=
parameters
.
arg
(
getParam2
(),
0
,
'g'
,
18
).
arg
(
getParam2
(),
0
,
'g'
,
18
).
arg
(
loiterOrbitRadius
(),
0
,
'g'
,
18
).
arg
(
yawRadians
()
,
0
,
'g'
,
18
);
// FORMAT: <INDEX> <CURRENT WP> <COORD FRAME> <COMMAND> <PARAM1> <PARAM2> <PARAM3> <PARAM4> <PARAM5/X/LONGITUDE> <PARAM6/Y/LATITUDE> <PARAM7/Z/ALTITUDE> <AUTOCONTINUE> <DESCRIPTION>
// as documented here: http://qgroundcontrol.org/waypoint_protocol
saveStream
<<
this
->
sequenceNumber
()
<<
"
\t
"
<<
this
->
isCurrentItem
()
<<
"
\t
"
<<
this
->
getFrame
()
<<
"
\t
"
<<
this
->
getAction
()
<<
"
\t
"
<<
parameters
<<
"
\t
"
<<
position
<<
"
\t
"
<<
this
->
getAutoContinue
()
<<
"
\r\n
"
;
//"\t" << this->getDescription() << "\r\n";
...
...
@@ -168,9 +192,9 @@ bool MissionItem::load(QTextStream &loadStream)
setIsCurrentItem
(
wpParams
[
1
].
toInt
()
==
1
?
true
:
false
);
_frame
=
(
MAV_FRAME
)
wpParams
[
2
].
toInt
();
_action
=
(
MAV_CMD
)
wpParams
[
3
].
toInt
();
_param1
=
wpParams
[
4
].
toDouble
(
);
_param2
=
wpParams
[
5
].
toDouble
(
);
_orbit
=
wpParams
[
6
].
toDouble
(
);
setParam1
(
wpParams
[
4
].
toDouble
()
);
setParam2
(
wpParams
[
5
].
toDouble
()
);
setLoiterOrbitRadius
(
wpParams
[
6
].
toDouble
()
);
setYawRadians
(
wpParams
[
7
].
toDouble
());
setLatitude
(
wpParams
[
8
].
toDouble
());
setLongitude
(
wpParams
[
9
].
toDouble
());
...
...
@@ -253,7 +277,7 @@ void MissionItem::setAction(int /*MAV_CMD*/ action)
if
(
_action
==
MAV_CMD_NAV_TAKEOFF
)
{
// We default to 15 degrees minimum takeoff pitch
_param1
=
15.0
;
setParam1
(
15.0
)
;
}
emit
changed
(
this
);
...
...
@@ -291,21 +315,14 @@ void MissionItem::setIsCurrentItem(bool isCurrentItem)
void
MissionItem
::
setAcceptanceRadius
(
double
radius
)
{
if
(
_param2
!=
radius
)
{
_param2
=
radius
;
emit
changed
(
this
);
emit
valueStringsChanged
(
valueStrings
());
}
setParam2
(
radius
);
}
void
MissionItem
::
setParam1
(
double
param1
)
{
//// // qDebug() << "SENDER:" << QObject::sender();
//// // qDebug() << "PARAM1 SET REQ:" << param1;
if
(
_param1
!=
param1
)
if
(
getParam1
()
!=
param1
)
{
_param1
=
param1
;
_param1
Fact
->
setValue
(
param1
)
;
emit
changed
(
this
);
emit
valueStringsChanged
(
valueStrings
());
}
...
...
@@ -313,9 +330,9 @@ void MissionItem::setParam1(double param1)
void
MissionItem
::
setParam2
(
double
param2
)
{
if
(
_param2
!=
param2
)
if
(
getParam2
()
!=
param2
)
{
_param2
=
param2
;
_param2
Fact
->
setValue
(
param2
)
;
emit
valueStringsChanged
(
valueStrings
());
emit
changed
(
this
);
}
...
...
@@ -323,20 +340,12 @@ void MissionItem::setParam2(double param2)
void
MissionItem
::
setParam3
(
double
param3
)
{
if
(
_orbit
!=
param3
)
{
_orbit
=
param3
;
emit
valueStringsChanged
(
valueStrings
());
emit
changed
(
this
);
}
setLoiterOrbitRadius
(
param3
);
}
void
MissionItem
::
setParam4
(
double
param4
)
{
if
(
_yawRadians
!=
param4
)
{
_yawRadians
=
param4
;
emit
changed
(
this
);
emit
valueStringsChanged
(
valueStrings
());
}
setYawRadians
(
param4
);
}
void
MissionItem
::
setParam5
(
double
param5
)
...
...
@@ -366,10 +375,10 @@ void MissionItem::setParam7(double param7)
}
}
void
MissionItem
::
setLoiterOrbit
(
double
orbit
)
void
MissionItem
::
setLoiterOrbit
Radius
(
double
radius
)
{
if
(
_orbit
!=
orbit
)
{
_
orbit
=
orbit
;
if
(
loiterOrbitRadius
()
!=
radius
)
{
_
loiterOrbitRadiusFact
->
setValue
(
radius
)
;
emit
valueStringsChanged
(
valueStrings
());
emit
changed
(
this
);
}
...
...
@@ -377,20 +386,12 @@ void MissionItem::setLoiterOrbit(double orbit)
void
MissionItem
::
setHoldTime
(
int
holdTime
)
{
if
(
_param1
!=
holdTime
)
{
_param1
=
holdTime
;
emit
valueStringsChanged
(
valueStrings
());
emit
changed
(
this
);
}
setParam1
(
holdTime
);
}
void
MissionItem
::
setHoldTime
(
double
holdTime
)
{
if
(
_param1
!=
holdTime
)
{
_param1
=
holdTime
;
emit
changed
(
this
);
emit
valueStringsChanged
(
valueStrings
());
}
setParam1
(
holdTime
);
}
bool
MissionItem
::
specifiesCoordinate
(
void
)
const
...
...
@@ -508,30 +509,30 @@ QStringList MissionItem::valueStrings(void)
switch
(
_action
)
{
case
MAV_CMD_NAV_WAYPOINT
:
list
<<
_oneDecimalString
(
_coordinate
.
altitude
())
<<
_oneDecimalString
(
_yawRadians
*
(
180.0
/
M_PI
))
<<
_oneDecimalString
(
_param2
)
<<
_oneDecimalString
(
_param1
);
list
<<
_oneDecimalString
(
_coordinate
.
altitude
())
<<
_oneDecimalString
(
yawDegrees
())
<<
_oneDecimalString
(
getParam2
())
<<
_oneDecimalString
(
getParam1
()
);
break
;
case
MAV_CMD_NAV_LOITER_UNLIM
:
list
<<
_oneDecimalString
(
_yawRadians
*
(
180.0
/
M_PI
))
<<
_oneDecimalString
(
_orbit
);
list
<<
_oneDecimalString
(
yawRadians
()
*
(
180.0
/
M_PI
))
<<
_oneDecimalString
(
loiterOrbitRadius
()
);
break
;
case
MAV_CMD_NAV_LOITER_TURNS
:
list
<<
_oneDecimalString
(
_yawRadians
*
(
180.0
/
M_PI
))
<<
_oneDecimalString
(
_orbit
)
<<
_oneDecimalString
(
_param1
);
list
<<
_oneDecimalString
(
yawRadians
()
*
(
180.0
/
M_PI
))
<<
_oneDecimalString
(
loiterOrbitRadius
())
<<
_oneDecimalString
(
getParam1
()
);
break
;
case
MAV_CMD_NAV_LOITER_TIME
:
list
<<
_oneDecimalString
(
_yawRadians
*
(
180.0
/
M_PI
))
<<
_oneDecimalString
(
_orbit
)
<<
_oneDecimalString
(
_param1
);
list
<<
_oneDecimalString
(
yawRadians
()
*
(
180.0
/
M_PI
))
<<
_oneDecimalString
(
loiterOrbitRadius
())
<<
_oneDecimalString
(
getParam1
()
);
break
;
case
MAV_CMD_NAV_RETURN_TO_LAUNCH
:
break
;
case
MAV_CMD_NAV_LAND
:
list
<<
_oneDecimalString
(
_coordinate
.
altitude
())
<<
_oneDecimalString
(
_yawRadians
*
(
180.0
/
M_PI
));
list
<<
_oneDecimalString
(
_coordinate
.
altitude
())
<<
_oneDecimalString
(
yawRadians
()
*
(
180.0
/
M_PI
));
break
;
case
MAV_CMD_NAV_TAKEOFF
:
list
<<
_oneDecimalString
(
_coordinate
.
altitude
())
<<
_oneDecimalString
(
_yawRadians
*
(
180.0
/
M_PI
))
<<
_oneDecimalString
(
_param1
);
list
<<
_oneDecimalString
(
_coordinate
.
altitude
())
<<
_oneDecimalString
(
yawRadians
()
*
(
180.0
/
M_PI
))
<<
_oneDecimalString
(
getParam1
()
);
break
;
case
MAV_CMD_CONDITION_DELAY
:
list
<<
_oneDecimalString
(
_param1
);
list
<<
_oneDecimalString
(
getParam1
()
);
break
;
case
MAV_CMD_DO_JUMP
:
list
<<
_oneDecimalString
(
_param1
)
<<
_oneDecimalString
(
_param2
);
list
<<
_oneDecimalString
(
getParam1
())
<<
_oneDecimalString
(
getParam2
()
);
break
;
default:
break
;
...
...
@@ -588,36 +589,38 @@ QmlObjectListModel* MissionItem::facts(void)
_param2Fact
->
setMetaData
(
_acceptanceRadiusMetaData
);
_param1Fact
->
_setName
(
"Hold:"
);
_param1Fact
->
setMetaData
(
_holdTimeMetaData
);
model
->
append
(
_yawFact
);
model
->
append
(
_yaw
Radians
Fact
);
model
->
append
(
_param2Fact
);
model
->
append
(
_param1Fact
);
break
;
case
MAV_CMD_NAV_LOITER_UNLIM
:
model
->
append
(
_yawFact
);
model
->
append
(
_loiterRadiusFact
);
model
->
append
(
_yaw
Radians
Fact
);
model
->
append
(
_loiter
Orbit
RadiusFact
);
break
;
case
MAV_CMD_NAV_LOITER_TURNS
:
_param1Fact
->
_setName
(
"Turns:"
);
_param1Fact
->
setMetaData
(
_loiterTurnsMetaData
);
model
->
append
(
_yawFact
);
model
->
append
(
_loiterRadiusFact
);
model
->
append
(
_yaw
Radians
Fact
);
model
->
append
(
_loiter
Orbit
RadiusFact
);
model
->
append
(
_param1Fact
);
break
;
case
MAV_CMD_NAV_LOITER_TIME
:
_param1Fact
->
_setName
(
"Seconds:"
);
_param1Fact
->
setMetaData
(
_loiterSecondsMetaData
);
model
->
append
(
_yawFact
);
model
->
append
(
_loiterRadiusFact
);
model
->
append
(
_yaw
Radians
Fact
);
model
->
append
(
_loiter
Orbit
RadiusFact
);
model
->
append
(
_param1Fact
);
break
;
case
MAV_CMD_NAV_RETURN_TO_LAUNCH
:
break
;
case
MAV_CMD_NAV_LAND
:
model
->
append
(
_yawFact
);
model
->
append
(
_yaw
Radians
Fact
);
break
;
case
MAV_CMD_NAV_TAKEOFF
:
model
->
append
(
_yawFact
);
model
->
append
(
_pitchFact
);
_param1Fact
->
_setName
(
"Pitch:"
);
_param1Fact
->
setMetaData
(
_pitchMetaData
);
model
->
append
(
_yawRadiansFact
);
model
->
append
(
_param1Fact
);
break
;
case
MAV_CMD_CONDITION_DELAY
:
_param1Fact
->
_setName
(
"Seconds:"
);
...
...
@@ -639,14 +642,14 @@ QmlObjectListModel* MissionItem::facts(void)
double
MissionItem
::
yawRadians
(
void
)
const
{
return
_yawRadians
;
return
_yawRadians
Fact
->
value
().
toDouble
()
;
}
void
MissionItem
::
setYawRadians
(
double
yaw
)
{
if
(
_yawRadians
!=
yaw
)
if
(
yawRadians
()
!=
yaw
)
{
_yawRadians
=
yaw
;
_yawRadians
Fact
->
setValue
(
yaw
)
;
emit
yawChanged
(
yaw
);
emit
changed
(
this
);
emit
valueStringsChanged
(
valueStrings
());
...
...
@@ -656,7 +659,7 @@ void MissionItem::setYawRadians(double yaw)
double
MissionItem
::
yawDegrees
(
void
)
const
{
return
_yawRadians
*
(
180.0
/
M_PI
);
return
yawRadians
()
*
(
180.0
/
M_PI
);
}
void
MissionItem
::
setYawDegrees
(
double
yaw
)
...
...
src/MissionItem.h
View file @
830d7dee
...
...
@@ -53,7 +53,7 @@ public:
int
frame
=
MAV_FRAME_GLOBAL
,
int
action
=
MAV_CMD_NAV_WAYPOINT
);
MissionItem
(
const
MissionItem
&
other
);
MissionItem
(
const
MissionItem
&
other
,
QObject
*
parent
=
NULL
);
~
MissionItem
();
const
MissionItem
&
operator
=
(
const
MissionItem
&
other
);
...
...
@@ -125,23 +125,23 @@ public:
bool
getAutoContinue
()
const
{
return
_autocontinue
;
}
double
getLoiterOrbit
()
const
{
return
_
orbit
;
double
loiterOrbitRadius
()
const
{
return
_
loiterOrbitRadiusFact
->
value
().
toDouble
()
;
}
double
getAcceptanceRadius
()
const
{
return
_param2
;
return
getParam2
()
;
}
double
getHoldTime
()
const
{
return
_param1
;
return
getParam1
()
;
}
double
getParam1
()
const
{
return
_param1
;
return
_param1
Fact
->
value
().
toDouble
()
;
}
double
getParam2
()
const
{
return
_param2
;
return
_param2
Fact
->
value
().
toDouble
()
;
}
double
getParam3
()
const
{
return
_orbit
;
return
loiterOrbitRadius
()
;
}
double
getParam4
()
const
{
return
yawRadians
();
...
...
@@ -195,7 +195,7 @@ public:
void
setFrame
(
int
_frame
);
void
setAutocontinue
(
bool
autoContinue
);
void
setCurrent
(
bool
_current
);
void
setLoiterOrbit
(
double
_orbit
);
void
setLoiterOrbit
Radius
(
double
radius
);
void
setParam1
(
double
_param1
);
void
setParam2
(
double
_param2
);
void
setParam3
(
double
param3
);
...
...
@@ -226,27 +226,20 @@ private:
int
_sequenceNumber
;
QGeoCoordinate
_coordinate
;
double
_yawRadians
;
int
_frame
;
int
_action
;
bool
_autocontinue
;
bool
_isCurrentItem
;
double
_orbit
;
double
_param1
;
double
_param2
;
quint64
_reachedTime
;
Fact
*
_yawFact
;
Fact
*
_pitchFact
;
Fact
*
_loiterRadiusFact
;
Fact
*
_yawRadiansFact
;
Fact
*
_loiterOrbitRadiusFact
;
Fact
*
_param1Fact
;
Fact
*
_param2Fact
;
FactMetaData
*
_yawMetaData
;
FactMetaData
*
_pitchMetaData
;
FactMetaData
*
_acceptanceRadiusMetaData
;
FactMetaData
*
_holdTimeMetaData
;
FactMetaData
*
_loiterRadiusMetaData
;
FactMetaData
*
_loiterTurnsMetaData
;
FactMetaData
*
_loiterSecondsMetaData
;
FactMetaData
*
_delaySecondsMetaData
;
...
...
src/ui/map/Waypoint2DIcon.cc
View file @
830d7dee
...
...
@@ -104,7 +104,7 @@ QRectF Waypoint2DIcon::boundingRect() const
}
if
(((
waypoint
->
getAction
()
==
(
int
)
MAV_CMD_NAV_LOITER_UNLIM
)
||
(
waypoint
->
getAction
()
==
(
int
)
MAV_CMD_NAV_LOITER_TIME
)
||
(
waypoint
->
getAction
()
==
(
int
)
MAV_CMD_NAV_LOITER_TURNS
)))
{
loiter
=
map
->
metersToPixels
(
waypoint
->
getLoiterOrbit
(),
coord
);
loiter
=
map
->
metersToPixels
(
waypoint
->
loiterOrbitRadius
(),
coord
);
}
}
...
...
@@ -306,7 +306,7 @@ void Waypoint2DIcon::paint(QPainter *painter, const QStyleOptionGraphicsItem *op
penDash
.
setWidth
(
1
);
//penDash.setStyle(Qt::DotLine);
// A negative radius indicates counter-clockwise rotation, but we still want to draw it positive
const
int
loiter
=
map
->
metersToPixels
(
fabs
(
waypoint
->
getLoiterOrbit
()),
Coord
());
const
int
loiter
=
map
->
metersToPixels
(
fabs
(
waypoint
->
loiterOrbitRadius
()),
Coord
());
if
(
loiter
>
picture
.
width
()
/
2
)
{
painter
->
setPen
(
penBlack
);
...
...
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