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
277c1618
Commit
277c1618
authored
Dec 12, 2014
by
Don Gagne
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1119 from mavlink/ptr_fix
Ptr fix - fixes #1117
parents
0f4a168f
00f95d77
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
21 deletions
+25
-21
UASWaypointManager.cc
src/uas/UASWaypointManager.cc
+3
-3
UASWaypointManager.h
src/uas/UASWaypointManager.h
+2
-1
Waypoint2DIcon.cc
src/ui/map/Waypoint2DIcon.cc
+19
-16
Waypoint2DIcon.h
src/ui/map/Waypoint2DIcon.h
+1
-1
No files found.
src/uas/UASWaypointManager.cc
View file @
277c1618
...
...
@@ -47,7 +47,7 @@ UASWaypointManager::UASWaypointManager(UAS* _uas)
current_state
(
WP_IDLE
),
current_partner_systemid
(
0
),
current_partner_compid
(
0
),
currentWaypointEditable
(
NULL
),
currentWaypointEditable
(),
protocol_timer
(
this
)
{
...
...
@@ -113,7 +113,7 @@ void UASWaypointManager::handleLocalPositionChanged(UASInterface* mav, double x,
{
Q_UNUSED
(
mav
);
Q_UNUSED
(
time
);
if
(
waypointsEditable
.
count
()
>
0
&&
currentWaypointEditable
&&
(
currentWaypointEditable
->
getFrame
()
==
MAV_FRAME_LOCAL_NED
||
currentWaypointEditable
->
getFrame
()
==
MAV_FRAME_LOCAL_ENU
))
if
(
waypointsEditable
.
count
()
>
0
&&
!
currentWaypointEditable
.
isNull
()
&&
(
currentWaypointEditable
->
getFrame
()
==
MAV_FRAME_LOCAL_NED
||
currentWaypointEditable
->
getFrame
()
==
MAV_FRAME_LOCAL_ENU
))
{
double
xdiff
=
x
-
currentWaypointEditable
->
getX
();
double
ydiff
=
y
-
currentWaypointEditable
->
getY
();
...
...
@@ -131,7 +131,7 @@ void UASWaypointManager::handleGlobalPositionChanged(UASInterface* mav, double l
Q_UNUSED
(
altWGS84
);
Q_UNUSED
(
lon
);
Q_UNUSED
(
lat
);
if
(
waypointsEditable
.
count
()
>
0
&&
currentWaypointEditable
&&
(
currentWaypointEditable
->
getFrame
()
==
MAV_FRAME_GLOBAL
||
currentWaypointEditable
->
getFrame
()
==
MAV_FRAME_GLOBAL_RELATIVE_ALT
))
if
(
waypointsEditable
.
count
()
>
0
&&
!
currentWaypointEditable
.
isNull
()
&&
(
currentWaypointEditable
->
getFrame
()
==
MAV_FRAME_GLOBAL
||
currentWaypointEditable
->
getFrame
()
==
MAV_FRAME_GLOBAL_RELATIVE_ALT
))
{
// TODO FIXME Calculate distance
double
dist
=
0
;
...
...
src/uas/UASWaypointManager.h
View file @
277c1618
...
...
@@ -35,6 +35,7 @@ This file is part of the QGROUNDCONTROL project
#include <QObject>
#include <QList>
#include <QTimer>
#include <QPointer>
#include "Waypoint.h"
#include "QGCMAVLink.h"
class
UAS
;
...
...
@@ -180,7 +181,7 @@ private:
QList
<
Waypoint
*>
waypointsViewOnly
;
///< local copy of current waypoint list on MAV
QList
<
Waypoint
*>
waypointsEditable
;
///< local editable waypoint list
Waypoint
*
currentWaypointEditable
;
///< The currently used waypoint
QPointer
<
Waypoint
>
currentWaypointEditable
;
///< The currently used waypoint
QList
<
mavlink_mission_item_t
*>
waypoint_buffer
;
///< buffer for waypoints during communication
QTimer
protocol_timer
;
///< Timer to catch timeouts
bool
standalone
;
///< If standalone is set, do not write to UAS
...
...
src/ui/map/Waypoint2DIcon.cc
View file @
277c1618
...
...
@@ -6,7 +6,7 @@
Waypoint2DIcon
::
Waypoint2DIcon
(
mapcontrol
::
MapGraphicItem
*
map
,
mapcontrol
::
OPMapWidget
*
parent
,
qreal
latitude
,
qreal
longitude
,
qreal
altitude
,
int
listindex
,
QString
name
,
QString
description
,
int
radius
)
:
mapcontrol
::
WayPointItem
(
internals
::
PointLatLng
(
latitude
,
longitude
),
altitude
,
description
,
map
),
parent
(
parent
),
waypoint
(
NULL
),
waypoint
(),
radius
(
radius
),
showAcceptanceRadius
(
true
),
showOrbit
(
false
),
...
...
@@ -55,7 +55,7 @@ void Waypoint2DIcon::SetHeading(float heading)
void
Waypoint2DIcon
::
updateWaypoint
()
{
if
(
waypoint
)
{
if
(
!
waypoint
.
isNull
()
)
{
// Store old size
static
QRectF
oldSize
;
...
...
@@ -97,13 +97,16 @@ QRectF Waypoint2DIcon::boundingRect() const
int
loiter
=
0
;
int
acceptance
=
0
;
internals
::
PointLatLng
coord
=
(
internals
::
PointLatLng
)
Coord
();
if
(
waypoint
&&
showAcceptanceRadius
&&
(
waypoint
->
getAction
()
==
(
int
)
MAV_CMD_NAV_WAYPOINT
))
{
acceptance
=
map
->
metersToPixels
(
waypoint
->
getAcceptanceRadius
(),
coord
);
}
if
(
waypoint
&&
((
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
);
if
(
!
waypoint
.
isNull
())
{
if
(
showAcceptanceRadius
&&
(
waypoint
->
getAction
()
==
(
int
)
MAV_CMD_NAV_WAYPOINT
))
{
acceptance
=
map
->
metersToPixels
(
waypoint
->
getAcceptanceRadius
(),
coord
);
}
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
);
}
}
int
width
=
qMax
(
picture
.
width
()
/
2
,
qMax
(
loiter
,
acceptance
));
...
...
@@ -156,7 +159,7 @@ void Waypoint2DIcon::drawIcon()
// If this is not a waypoint (only the default representation)
// or it is a waypoint, but not one where direction has no meaning
// then draw the heading indicator
if
(
!
waypoint
||
(
waypoint
&&
(
if
(
waypoint
.
isNull
()
||
(
waypoint
&&
(
(
waypoint
->
getAction
()
!=
(
int
)
MAV_CMD_NAV_TAKEOFF
)
&&
(
waypoint
->
getAction
()
!=
(
int
)
MAV_CMD_NAV_LAND
)
&&
(
waypoint
->
getAction
()
!=
(
int
)
MAV_CMD_NAV_LOITER_UNLIM
)
&&
...
...
@@ -171,7 +174,7 @@ void Waypoint2DIcon::drawIcon()
painter
.
drawLine
(
p
.
x
(),
p
.
y
(),
p
.
x
()
+
sin
(
Heading
()
/
180.0
f
*
M_PI
)
*
rad
,
p
.
y
()
-
cos
(
Heading
()
/
180.0
f
*
M_PI
)
*
rad
);
}
if
((
waypoint
!=
NULL
)
&&
(
waypoint
->
getAction
()
==
(
int
)
MAV_CMD_NAV_TAKEOFF
))
if
((
(
!
waypoint
.
isNull
())
)
&&
(
waypoint
->
getAction
()
==
(
int
)
MAV_CMD_NAV_TAKEOFF
))
{
// Takeoff waypoint
int
width
=
picture
.
width
()
-
penWidth
;
...
...
@@ -187,7 +190,7 @@ void Waypoint2DIcon::drawIcon()
painter
.
setPen
(
pen2
);
painter
.
drawRect
(
width
*
0.3
,
height
*
0.3
f
,
width
*
0.6
f
,
height
*
0.6
f
);
}
else
if
((
waypoint
!=
NULL
)
&&
(
waypoint
->
getAction
()
==
(
int
)
MAV_CMD_NAV_LAND
))
else
if
((
(
!
waypoint
.
isNull
())
)
&&
(
waypoint
->
getAction
()
==
(
int
)
MAV_CMD_NAV_LAND
))
{
// Landing waypoint
int
width
=
(
picture
.
width
())
/
2
-
penWidth
;
...
...
@@ -199,7 +202,7 @@ void Waypoint2DIcon::drawIcon()
painter
.
drawEllipse
(
p
,
width
,
height
);
painter
.
drawLine
(
p
.
x
()
-
width
/
2
,
p
.
y
()
-
height
/
2
,
2
*
width
,
2
*
height
);
}
else
if
((
waypoint
!=
NULL
)
&&
((
waypoint
->
getAction
()
==
(
int
)
MAV_CMD_NAV_LOITER_UNLIM
)
||
(
waypoint
->
getAction
()
==
(
int
)
MAV_CMD_NAV_LOITER_TIME
)
||
(
waypoint
->
getAction
()
==
(
int
)
MAV_CMD_NAV_LOITER_TURNS
)))
else
if
((
(
!
waypoint
.
isNull
())
)
&&
((
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 waypoint
int
width
=
(
picture
.
width
()
-
penWidth
)
/
2
;
...
...
@@ -211,7 +214,7 @@ void Waypoint2DIcon::drawIcon()
painter
.
drawEllipse
(
p
,
width
,
height
);
painter
.
drawPoint
(
p
);
}
else
if
((
waypoint
!=
NULL
)
&&
(
waypoint
->
getAction
()
==
(
int
)
MAV_CMD_NAV_RETURN_TO_LAUNCH
))
else
if
((
(
!
waypoint
.
isNull
())
)
&&
(
waypoint
->
getAction
()
==
(
int
)
MAV_CMD_NAV_RETURN_TO_LAUNCH
))
{
// Return to launch waypoint
int
width
=
picture
.
width
()
-
penWidth
;
...
...
@@ -284,7 +287,7 @@ void Waypoint2DIcon::paint(QPainter *painter, const QStyleOptionGraphicsItem *op
penBlack
.
setWidth
(
4
);
pen
.
setColor
(
color
);
if
((
waypoint
)
&&
(
waypoint
->
getAction
()
==
(
int
)
MAV_CMD_NAV_WAYPOINT
)
&&
showAcceptanceRadius
)
if
((
!
waypoint
.
isNull
()
)
&&
(
waypoint
->
getAction
()
==
(
int
)
MAV_CMD_NAV_WAYPOINT
)
&&
showAcceptanceRadius
)
{
QPen
redPen
=
QPen
(
pen
);
redPen
.
setColor
(
Qt
::
yellow
);
...
...
@@ -298,7 +301,7 @@ void Waypoint2DIcon::paint(QPainter *painter, const QStyleOptionGraphicsItem *op
painter
->
drawEllipse
(
QPointF
(
0
,
0
),
acceptance
,
acceptance
);
}
}
if
((
waypoint
)
&&
((
waypoint
->
getAction
()
==
(
int
)
MAV_CMD_NAV_LOITER_UNLIM
)
||
(
waypoint
->
getAction
()
==
(
int
)
MAV_CMD_NAV_LOITER_TIME
)
||
(
waypoint
->
getAction
()
==
(
int
)
MAV_CMD_NAV_LOITER_TURNS
)))
if
((
!
waypoint
.
isNull
()
)
&&
((
waypoint
->
getAction
()
==
(
int
)
MAV_CMD_NAV_LOITER_UNLIM
)
||
(
waypoint
->
getAction
()
==
(
int
)
MAV_CMD_NAV_LOITER_TIME
)
||
(
waypoint
->
getAction
()
==
(
int
)
MAV_CMD_NAV_LOITER_TURNS
)))
{
QPen
penDash
(
color
);
penDash
.
setWidth
(
1
);
...
...
src/ui/map/Waypoint2DIcon.h
View file @
277c1618
...
...
@@ -42,7 +42,7 @@ public:
protected:
mapcontrol
::
OPMapWidget
*
parent
;
///< Parent widget
Waypoint
*
waypoint
;
///< Waypoint data container this icon represents
QPointer
<
Waypoint
>
waypoint
;
///< Waypoint data container this icon represents
int
radius
;
///< Radius / diameter of the icon in pixels
bool
showAcceptanceRadius
;
bool
showOrbit
;
...
...
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