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
e96b743e
Commit
e96b743e
authored
Dec 05, 2010
by
Lionel Heng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed coordinate system issue in waypoint management for 3D view.
parent
7d8ebfd3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
18 deletions
+41
-18
WaypointList.cc
src/ui/WaypointList.cc
+2
-3
Pixhawk3DWidget.cc
src/ui/map3D/Pixhawk3DWidget.cc
+39
-15
No files found.
src/ui/WaypointList.cc
View file @
e96b743e
...
...
@@ -199,10 +199,9 @@ void WaypointList::add()
}
else
{
//isLocalWP = true;
Waypoint
*
wp
=
new
Waypoint
(
0
,
1.1
,
1.1
,
-
0.8
,
0.0
,
true
,
true
,
0.15
,
2000
);
Waypoint
*
wp
=
new
Waypoint
(
0
,
uas
->
getLongitude
(),
uas
->
getLatitude
(),
uas
->
getAltitude
(),
0.0
,
true
,
true
,
0.15
,
2000
);
uas
->
getWaypointManager
().
addWaypoint
(
wp
);
...
...
src/ui/map3D/Pixhawk3DWidget.cc
View file @
e96b743e
...
...
@@ -235,15 +235,23 @@ Pixhawk3DWidget::insertWaypoint(void)
{
if
(
uas
)
{
double
latitude
=
uas
->
getLatitude
();
double
longitude
=
uas
->
getLongitude
();
double
altitude
=
uas
->
getAltitude
();
double
x
,
y
;
QString
utmZone
;
Imagery
::
LLtoUTM
(
uas
->
getLatitude
(),
uas
->
getLongitude
(),
x
,
y
,
utmZone
);
std
::
pair
<
double
,
double
>
cursorWorldCoords
=
getGlobalCursorPosition
(
getMouseX
(),
getMouseY
(),
altitude
);
Imagery
::
UTMtoLL
(
cursorWorldCoords
.
first
,
cursorWorldCoords
.
second
,
utmZone
,
latitude
,
longitude
);
Waypoint
*
wp
=
new
Waypoint
(
0
,
cursorWorldCoords
.
first
,
cursorWorldCoords
.
second
,
-
altitude
);
longitude
,
latitude
,
altitude
);
uas
->
getWaypointManager
().
addWaypoint
(
wp
);
}
}
...
...
@@ -259,17 +267,25 @@ Pixhawk3DWidget::setWaypoint(void)
{
if
(
uas
)
{
double
latitude
=
uas
->
getLatitude
();
double
longitude
=
uas
->
getLongitude
();
double
altitude
=
uas
->
getAltitude
();
double
x
,
y
;
QString
utmZone
;
Imagery
::
LLtoUTM
(
uas
->
getLatitude
(),
uas
->
getLongitude
(),
x
,
y
,
utmZone
);
std
::
pair
<
double
,
double
>
cursorWorldCoords
=
getGlobalCursorPosition
(
getMouseX
(),
getMouseY
(),
altitude
);
Imagery
::
UTMtoLL
(
cursorWorldCoords
.
first
,
cursorWorldCoords
.
second
,
utmZone
,
latitude
,
longitude
);
const
QVector
<
Waypoint
*>
waypoints
=
uas
->
getWaypointManager
().
getWaypointList
();
Waypoint
*
waypoint
=
waypoints
.
at
(
selectedWpIndex
);
waypoint
->
setX
(
cursorWorldCoords
.
first
);
waypoint
->
setY
(
cursorWorldCoords
.
second
);
waypoint
->
setZ
(
-
altitude
);
waypoint
->
setX
(
longitude
);
waypoint
->
setY
(
latitude
);
waypoint
->
setZ
(
altitude
);
}
}
...
...
@@ -294,10 +310,10 @@ Pixhawk3DWidget::setWaypointAltitude(void)
double
newAltitude
=
QInputDialog
::
getDouble
(
this
,
tr
(
"Set altitude of waypoint %1"
).
arg
(
selectedWpIndex
),
tr
(
"Altitude (m):"
),
-
waypoint
->
getZ
(),
-
1000.0
,
1000.0
,
1
,
&
ok
);
tr
(
"Altitude (m):"
),
waypoint
->
getZ
(),
-
1000.0
,
1000.0
,
1
,
&
ok
);
if
(
ok
)
{
waypoint
->
setZ
(
-
newAltitude
);
waypoint
->
setZ
(
newAltitude
);
}
}
}
...
...
@@ -1049,7 +1065,7 @@ Pixhawk3DWidget::updateWaypoints(void)
osg
::
ref_ptr
<
osg
::
ShapeDrawable
>
sd
=
new
osg
::
ShapeDrawable
;
osg
::
ref_ptr
<
osg
::
Cylinder
>
cylinder
=
new
osg
::
Cylinder
(
osg
::
Vec3d
(
0.0
,
0.0
,
-
wp
->
getZ
()
/
2.0
),
new
osg
::
Cylinder
(
osg
::
Vec3d
(
0.0
,
0.0
,
wp
->
getZ
()
/
2.0
),
wp
->
getOrbit
(),
fabs
(
wp
->
getZ
()));
...
...
@@ -1072,14 +1088,21 @@ Pixhawk3DWidget::updateWaypoints(void)
sprintf
(
wpLabel
,
"wp%d"
,
i
);
geode
->
setName
(
wpLabel
);
double
wpX
,
wpY
;
Imagery
::
LLtoUTM
(
wp
->
getY
(),
wp
->
getX
(),
wpX
,
wpY
,
utmZone
);
if
(
i
<
list
.
size
()
-
1
)
{
double
nextWpX
,
nextWpY
;
Imagery
::
LLtoUTM
(
list
.
at
(
i
+
1
)
->
getY
(),
list
.
at
(
i
+
1
)
->
getX
(),
nextWpX
,
nextWpY
,
utmZone
);
osg
::
ref_ptr
<
osg
::
Geometry
>
geometry
=
new
osg
::
Geometry
;
osg
::
ref_ptr
<
osg
::
Vec3dArray
>
vertices
=
new
osg
::
Vec3dArray
;
vertices
->
push_back
(
osg
::
Vec3d
(
0.0
,
0.0
,
-
wp
->
getZ
()));
vertices
->
push_back
(
osg
::
Vec3d
(
list
.
at
(
i
+
1
)
->
getY
()
-
wp
->
getY
()
,
list
.
at
(
i
+
1
)
->
getX
()
-
wp
->
getX
()
,
-
list
.
at
(
i
+
1
)
->
getZ
()));
vertices
->
push_back
(
osg
::
Vec3d
(
0.0
,
0.0
,
wp
->
getZ
()));
vertices
->
push_back
(
osg
::
Vec3d
(
nextWpY
-
wpY
,
nextWpX
-
wpX
,
list
.
at
(
i
+
1
)
->
getZ
()));
geometry
->
setVertexArray
(
vertices
);
osg
::
ref_ptr
<
osg
::
Vec4Array
>
colors
=
new
osg
::
Vec4Array
;
...
...
@@ -1092,6 +1115,7 @@ Pixhawk3DWidget::updateWaypoints(void)
osg
::
ref_ptr
<
osg
::
LineWidth
>
linewidth
(
new
osg
::
LineWidth
());
linewidth
->
setWidth
(
2.0
f
);
geometry
->
getOrCreateStateSet
()
->
setAttributeAndModes
(
linewidth
,
osg
::
StateAttribute
::
ON
);
geometry
->
getOrCreateStateSet
()
->
setMode
(
GL_LIGHTING
,
osg
::
StateAttribute
::
OFF
);
geode
->
addDrawable
(
geometry
);
}
...
...
@@ -1099,8 +1123,8 @@ Pixhawk3DWidget::updateWaypoints(void)
osg
::
ref_ptr
<
osg
::
PositionAttitudeTransform
>
pat
=
new
osg
::
PositionAttitudeTransform
;
pat
->
setPosition
(
osg
::
Vec3d
(
wp
->
getY
()
-
robotY
,
wp
->
getX
()
-
robotX
,
pat
->
setPosition
(
osg
::
Vec3d
(
wp
Y
-
robotY
,
wp
X
-
robotX
,
robotZ
));
waypointsNode
->
addChild
(
pat
);
...
...
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