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
dd90aa0e
Commit
dd90aa0e
authored
Oct 19, 2010
by
hengli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bugs in 3D imagery. Still more unresolved bugs related to tile resolution.
parent
c6c4ef05
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
57 additions
and
18 deletions
+57
-18
MAVLinkSimulationLink.cc
src/comm/MAVLinkSimulationLink.cc
+4
-0
Imagery.cc
src/ui/map3D/Imagery.cc
+10
-6
QMap3DWidget.cc
src/ui/map3D/QMap3DWidget.cc
+15
-7
Texture.cc
src/ui/map3D/Texture.cc
+2
-3
TextureCache.cc
src/ui/map3D/TextureCache.cc
+1
-0
WebImage.cc
src/ui/map3D/WebImage.cc
+23
-2
WebImage.h
src/ui/map3D/WebImage.h
+2
-0
No files found.
src/comm/MAVLinkSimulationLink.cc
View file @
dd90aa0e
...
@@ -389,6 +389,10 @@ void MAVLinkSimulationLink::mainloop()
...
@@ -389,6 +389,10 @@ void MAVLinkSimulationLink::mainloop()
y
=
(
y
<
-
5.0
f
)
?
-
5.0
f
:
y
;
y
=
(
y
<
-
5.0
f
)
?
-
5.0
f
:
y
;
z
=
(
z
<
-
3.0
f
)
?
-
3.0
f
:
z
;
z
=
(
z
<
-
3.0
f
)
?
-
3.0
f
:
z
;
// position at Pixhawk lab @ ETHZ
x
+=
5247273.0
f
;
y
+=
465955.0
f
;
// Send back new setpoint
// Send back new setpoint
mavlink_message_t
ret
;
mavlink_message_t
ret
;
mavlink_msg_local_position_setpoint_pack
(
systemId
,
componentId
,
&
ret
,
spX
,
spY
,
spZ
,
spYaw
);
mavlink_msg_local_position_setpoint_pack
(
systemId
,
componentId
,
&
ret
,
spX
,
spY
,
spZ
,
spYaw
);
...
...
src/ui/map3D/Imagery.cc
View file @
dd90aa0e
...
@@ -214,6 +214,7 @@ Imagery::draw3D(double radius, double imageResolution,
...
@@ -214,6 +214,7 @@ Imagery::draw3D(double radius, double imageResolution,
centerTileX
,
centerTileY
,
zoomLevel
);
centerTileX
,
centerTileY
,
zoomLevel
);
UTMtoTile
(
maxX
,
maxY
,
utmZone
,
imageResolution
,
UTMtoTile
(
maxX
,
maxY
,
utmZone
,
imageResolution
,
maxTileX
,
minTileY
,
zoomLevel
);
maxTileX
,
minTileY
,
zoomLevel
);
if
(
maxTileX
-
minTileX
+
1
>
14
)
if
(
maxTileX
-
minTileX
+
1
>
14
)
{
{
minTileX
=
centerTileX
-
7
;
minTileX
=
centerTileX
-
7
;
...
@@ -235,6 +236,7 @@ Imagery::draw3D(double radius, double imageResolution,
...
@@ -235,6 +236,7 @@ Imagery::draw3D(double radius, double imageResolution,
imageBounds
(
c
,
r
,
imageResolution
,
x1
,
y1
,
x2
,
y2
,
x3
,
y3
,
x4
,
y4
);
imageBounds
(
c
,
r
,
imageResolution
,
x1
,
y1
,
x2
,
y2
,
x3
,
y3
,
x4
,
y4
);
TexturePtr
t
=
textureCache
->
get
(
tileURL
);
TexturePtr
t
=
textureCache
->
get
(
tileURL
);
if
(
!
t
.
isNull
())
if
(
!
t
.
isNull
())
{
{
t
->
draw
(
x1
-
xOrigin
,
y1
-
yOrigin
,
t
->
draw
(
x1
-
xOrigin
,
y1
-
yOrigin
,
...
@@ -249,6 +251,8 @@ Imagery::draw3D(double radius, double imageResolution,
...
@@ -249,6 +251,8 @@ Imagery::draw3D(double radius, double imageResolution,
bool
bool
Imagery
::
update
(
void
)
Imagery
::
update
(
void
)
{
{
textureCache
->
sync
();
return
true
;
return
true
;
}
}
...
@@ -257,7 +261,7 @@ Imagery::imageBounds(int32_t x, int32_t y, double imageResolution,
...
@@ -257,7 +261,7 @@ Imagery::imageBounds(int32_t x, int32_t y, double imageResolution,
double
&
x1
,
double
&
y1
,
double
&
x2
,
double
&
y2
,
double
&
x1
,
double
&
y1
,
double
&
x2
,
double
&
y2
,
double
&
x3
,
double
&
y3
,
double
&
x4
,
double
&
y4
)
double
&
x3
,
double
&
y3
,
double
&
x4
,
double
&
y4
)
{
{
int32_t
zoomLevel
=
1
7
-
static_cast
<
int32_t
>
(
rint
(
log2
(
imageResolution
)));
int32_t
zoomLevel
=
1
9
-
static_cast
<
int32_t
>
(
rint
(
log2
(
imageResolution
)));
int32_t
numTiles
=
static_cast
<
int32_t
>
(
exp2
(
static_cast
<
double
>
(
zoomLevel
)));
int32_t
numTiles
=
static_cast
<
int32_t
>
(
exp2
(
static_cast
<
double
>
(
zoomLevel
)));
double
lon1
=
360.0
*
(
static_cast
<
double
>
(
x
)
double
lon1
=
360.0
*
(
static_cast
<
double
>
(
x
)
...
@@ -273,10 +277,10 @@ Imagery::imageBounds(int32_t x, int32_t y, double imageResolution,
...
@@ -273,10 +277,10 @@ Imagery::imageBounds(int32_t x, int32_t y, double imageResolution,
*
2.0
*
M_PI
-
M_PI
);
*
2.0
*
M_PI
-
M_PI
);
QString
utmZone
;
QString
utmZone
;
LLtoUTM
(
lat
1
,
lon1
,
y1
,
x
1
,
utmZone
);
LLtoUTM
(
lat
2
,
lon1
,
x1
,
y
1
,
utmZone
);
LLtoUTM
(
lat
1
,
lon2
,
y2
,
x
2
,
utmZone
);
LLtoUTM
(
lat
2
,
lon2
,
x2
,
y
2
,
utmZone
);
LLtoUTM
(
lat
2
,
lon2
,
y3
,
x
3
,
utmZone
);
LLtoUTM
(
lat
1
,
lon2
,
x3
,
y
3
,
utmZone
);
LLtoUTM
(
lat
2
,
lon1
,
y4
,
x
4
,
utmZone
);
LLtoUTM
(
lat
1
,
lon1
,
x4
,
y
4
,
utmZone
);
}
}
double
double
...
@@ -302,7 +306,7 @@ Imagery::UTMtoTile(double northing, double easting, const QString& utmZone,
...
@@ -302,7 +306,7 @@ Imagery::UTMtoTile(double northing, double easting, const QString& utmZone,
UTMtoLL
(
northing
,
easting
,
utmZone
,
latitude
,
longitude
);
UTMtoLL
(
northing
,
easting
,
utmZone
,
latitude
,
longitude
);
zoomLevel
=
1
7
-
static_cast
<
int32_t
>
(
rint
(
log2
(
imageResolution
)));
zoomLevel
=
1
9
-
static_cast
<
int32_t
>
(
rint
(
log2
(
imageResolution
)));
int32_t
numTiles
=
static_cast
<
int32_t
>
(
exp2
(
static_cast
<
double
>
(
zoomLevel
)));
int32_t
numTiles
=
static_cast
<
int32_t
>
(
exp2
(
static_cast
<
double
>
(
zoomLevel
)));
double
x
=
longitude
/
180.0
;
double
x
=
longitude
/
180.0
;
...
...
src/ui/map3D/QMap3DWidget.cc
View file @
dd90aa0e
...
@@ -51,7 +51,7 @@ QMap3DWidget::QMap3DWidget(QWidget* parent)
...
@@ -51,7 +51,7 @@ QMap3DWidget::QMap3DWidget(QWidget* parent)
,
updateLastUnlockedPose
(
true
)
,
updateLastUnlockedPose
(
true
)
,
displayTarget
(
false
)
,
displayTarget
(
false
)
,
displayWaypoints
(
true
)
,
displayWaypoints
(
true
)
,
imagery
(
new
Imagery
)
,
imagery
(
0
)
{
{
setFocusPolicy
(
Qt
::
StrongFocus
);
setFocusPolicy
(
Qt
::
StrongFocus
);
...
@@ -223,7 +223,7 @@ QMap3DWidget::displayHandler(void)
...
@@ -223,7 +223,7 @@ QMap3DWidget::displayHandler(void)
if
(
displayImagery
)
if
(
displayImagery
)
{
{
drawImagery
(
robotX
,
robotY
,
"32
N
"
,
true
);
drawImagery
(
robotX
,
robotY
,
"32
T
"
,
true
);
}
}
glPopMatrix
();
glPopMatrix
();
...
@@ -389,9 +389,15 @@ QMap3DWidget::timer(void* clientData)
...
@@ -389,9 +389,15 @@ QMap3DWidget::timer(void* clientData)
void
void
QMap3DWidget
::
timerHandler
(
void
)
QMap3DWidget
::
timerHandler
(
void
)
{
{
if
(
imagery
.
isNull
())
{
imagery
.
reset
(
new
Imagery
);
}
double
timeLapsed
=
getTime
()
-
lastRedrawTime
;
double
timeLapsed
=
getTime
()
-
lastRedrawTime
;
if
(
timeLapsed
>
0.1
)
if
(
timeLapsed
>
0.1
)
{
{
imagery
->
update
();
forceRedraw
();
forceRedraw
();
lastRedrawTime
=
getTime
();
lastRedrawTime
=
getTime
();
}
}
...
@@ -598,6 +604,8 @@ QMap3DWidget::drawImagery(double originX, double originY, const QString& zone,
...
@@ -598,6 +604,8 @@ QMap3DWidget::drawImagery(double originX, double originY, const QString& zone,
glPushMatrix
();
glPushMatrix
();
glEnable
(
GL_BLEND
);
glEnable
(
GL_BLEND
);
glTranslatef
(
0
,
0
,
0.1
);
CameraPose
camPose
=
getCameraPose
();
CameraPose
camPose
=
getCameraPose
();
double
viewingRadius
=
camPose
.
distance
/
4000.0
*
3000.0
;
double
viewingRadius
=
camPose
.
distance
/
4000.0
*
3000.0
;
if
(
viewingRadius
<
100.0
)
if
(
viewingRadius
<
100.0
)
...
@@ -605,8 +613,8 @@ QMap3DWidget::drawImagery(double originX, double originY, const QString& zone,
...
@@ -605,8 +613,8 @@ QMap3DWidget::drawImagery(double originX, double originY, const QString& zone,
viewingRadius
=
100.0
;
viewingRadius
=
100.0
;
}
}
double
minResolution
=
0.25
;
double
minResolution
=
0.
1
25
;
double
centerResolution
=
camPose
.
distance
/
160.0
*
0.25
;
double
centerResolution
=
camPose
.
distance
/
160.0
;
double
maxResolution
=
2.0
;
double
maxResolution
=
2.0
;
double
resolution
=
minResolution
;
double
resolution
=
minResolution
;
...
@@ -619,7 +627,7 @@ QMap3DWidget::drawImagery(double originX, double originY, const QString& zone,
...
@@ -619,7 +627,7 @@ QMap3DWidget::drawImagery(double originX, double originY, const QString& zone,
resolution
=
maxResolution
;
resolution
=
maxResolution
;
}
}
imagery
->
draw3D
(
viewingRadius
,
resolution
,
originX
,
originY
,
camPose
.
yOffset
,
camPose
.
x
Offset
,
zone
);
imagery
->
draw3D
(
viewingRadius
,
resolution
,
originX
,
originY
,
camPose
.
xOffset
,
camPose
.
y
Offset
,
zone
);
if
(
prefetch
)
if
(
prefetch
)
{
{
...
@@ -627,13 +635,13 @@ QMap3DWidget::drawImagery(double originX, double originY, const QString& zone,
...
@@ -627,13 +635,13 @@ QMap3DWidget::drawImagery(double originX, double originY, const QString& zone,
{
{
imagery
->
prefetch3D
(
viewingRadius
/
2.0
,
resolution
/
2.0
,
imagery
->
prefetch3D
(
viewingRadius
/
2.0
,
resolution
/
2.0
,
originX
,
originY
,
originX
,
originY
,
camPose
.
yOffset
,
camPose
.
x
Offset
,
zone
);
camPose
.
xOffset
,
camPose
.
y
Offset
,
zone
);
}
}
if
(
resolution
*
2.0
<=
maxResolution
)
if
(
resolution
*
2.0
<=
maxResolution
)
{
{
imagery
->
prefetch3D
(
viewingRadius
*
2.0
,
resolution
*
2.0
,
imagery
->
prefetch3D
(
viewingRadius
*
2.0
,
resolution
*
2.0
,
originX
,
originY
,
originX
,
originY
,
camPose
.
yOffset
,
camPose
.
x
Offset
,
zone
);
camPose
.
xOffset
,
camPose
.
y
Offset
,
zone
);
}
}
}
}
...
...
src/ui/map3D/Texture.cc
View file @
dd90aa0e
...
@@ -55,13 +55,12 @@ Texture::sync(const WebImagePtr& image)
...
@@ -55,13 +55,12 @@ Texture::sync(const WebImagePtr& image)
glBindTexture
(
GL_TEXTURE_2D
,
id
);
glBindTexture
(
GL_TEXTURE_2D
,
id
);
glTexImage2D
(
GL_TEXTURE_2D
,
0
,
3
,
textureWidth
,
textureHeight
,
glTexImage2D
(
GL_TEXTURE_2D
,
0
,
3
,
textureWidth
,
textureHeight
,
0
,
GL_RGB
,
GL_UNSIGNED_BYTE
,
NULL
);
0
,
GL_RGB
A
,
GL_UNSIGNED_BYTE
,
NULL
);
}
}
glBindTexture
(
GL_TEXTURE_2D
,
id
);
glBindTexture
(
GL_TEXTURE_2D
,
id
);
glTexSubImage2D
(
GL_TEXTURE_2D
,
0
,
0
,
0
,
imageWidth
,
imageHeight
,
glTexSubImage2D
(
GL_TEXTURE_2D
,
0
,
0
,
0
,
imageWidth
,
imageHeight
,
GL_RGB
,
GL_UNSIGNED_BYTE
,
image
->
getData
());
GL_RGBA
,
GL_UNSIGNED_BYTE
,
image
->
getData
());
}
}
}
}
...
...
src/ui/map3D/TextureCache.cc
View file @
dd90aa0e
...
@@ -7,6 +7,7 @@ TextureCache::TextureCache(uint32_t _cacheSize)
...
@@ -7,6 +7,7 @@ TextureCache::TextureCache(uint32_t _cacheSize)
for
(
uint32_t
i
=
0
;
i
<
cacheSize
;
++
i
)
for
(
uint32_t
i
=
0
;
i
<
cacheSize
;
++
i
)
{
{
TexturePtr
t
(
new
Texture
);
TexturePtr
t
(
new
Texture
);
GLuint
id
;
GLuint
id
;
glGenTextures
(
1
,
&
id
);
glGenTextures
(
1
,
&
id
);
t
->
setID
(
id
);
t
->
setID
(
id
);
...
...
src/ui/map3D/WebImage.cc
View file @
dd90aa0e
#include "WebImage.h"
#include "WebImage.h"
#include <QDebug>
#include <QGLWidget>
WebImage
::
WebImage
()
WebImage
::
WebImage
()
:
state
(
WebImage
::
UNINITIALIZED
)
:
state
(
WebImage
::
UNINITIALIZED
)
,
sourceURL
(
""
)
,
sourceURL
(
""
)
...
@@ -46,13 +49,25 @@ WebImage::setSourceURL(const QString& url)
...
@@ -46,13 +49,25 @@ WebImage::setSourceURL(const QString& url)
const
uint8_t
*
const
uint8_t
*
WebImage
::
getData
(
void
)
const
WebImage
::
getData
(
void
)
const
{
{
return
image
->
bits
(
);
return
image
->
scanLine
(
0
);
}
}
void
void
WebImage
::
setData
(
const
QByteArray
&
data
)
WebImage
::
setData
(
const
QByteArray
&
data
)
{
{
image
->
loadFromData
(
data
);
QImage
tempImage
;
if
(
tempImage
.
loadFromData
(
data
))
{
if
(
image
.
isNull
())
{
image
=
QSharedPointer
<
QImage
>
(
new
QImage
);
}
*
image
=
QGLWidget
::
convertToGLFormat
(
tempImage
);
}
else
{
qDebug
()
<<
"# WARNING: cannot load image data for"
<<
sourceURL
;
}
}
}
int32_t
int32_t
...
@@ -67,6 +82,12 @@ WebImage::getHeight(void) const
...
@@ -67,6 +82,12 @@ WebImage::getHeight(void) const
return
image
->
height
();
return
image
->
height
();
}
}
int32_t
WebImage
::
getByteCount
(
void
)
const
{
return
image
->
byteCount
();
}
uint64_t
uint64_t
WebImage
::
getLastReference
(
void
)
const
WebImage
::
getLastReference
(
void
)
const
{
{
...
...
src/ui/map3D/WebImage.h
View file @
dd90aa0e
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
#include <inttypes.h>
#include <inttypes.h>
#include <QImage>
#include <QImage>
#include <QScopedPointer>
#include <QSharedPointer>
#include <QSharedPointer>
class
WebImage
class
WebImage
...
@@ -30,6 +31,7 @@ public:
...
@@ -30,6 +31,7 @@ public:
int32_t
getWidth
(
void
)
const
;
int32_t
getWidth
(
void
)
const
;
int32_t
getHeight
(
void
)
const
;
int32_t
getHeight
(
void
)
const
;
int32_t
getByteCount
(
void
)
const
;
uint64_t
getLastReference
(
void
)
const
;
uint64_t
getLastReference
(
void
)
const
;
void
setLastReference
(
uint64_t
value
);
void
setLastReference
(
uint64_t
value
);
...
...
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