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
6354c28a
Commit
6354c28a
authored
Dec 10, 2011
by
Lionel Heng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
QGC now receives and displays RGBD images via extended MAVLINK messages over UDP.
parent
31696fda
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
16 deletions
+42
-16
UAS.cc
src/uas/UAS.cc
+4
-0
UAS.h
src/uas/UAS.h
+5
-0
UASInterface.h
src/uas/UASInterface.h
+1
-0
Pixhawk3DWidget.cc
src/ui/map3D/Pixhawk3DWidget.cc
+32
-16
No files found.
src/uas/UAS.cc
View file @
6354c28a
...
...
@@ -983,6 +983,10 @@ void UAS::receiveExtendedMessage(LinkInterface* link, std::tr1::shared_ptr<googl
{
pointCloud
.
CopyFrom
(
*
message
);
}
else
if
(
message
->
GetTypeName
()
==
rgbdImage
.
GetTypeName
())
{
rgbdImage
.
CopyFrom
(
*
message
);
}
}
#endif
...
...
src/uas/UAS.h
View file @
6354c28a
...
...
@@ -132,6 +132,10 @@ public:
px
::
PointCloudXYZRGB
getPointCloud
()
const
{
return
pointCloud
;
}
px
::
RGBDImage
getRGBDImage
()
const
{
return
rgbdImage
;
}
#endif
friend
class
UASWaypointManager
;
...
...
@@ -216,6 +220,7 @@ protected: //COMMENTS FOR TEST UNIT
#ifdef QGC_PROTOBUF_ENABLED
px
::
PointCloudXYZRGB
pointCloud
;
px
::
RGBDImage
rgbdImage
;
#endif
QMap
<
int
,
QMap
<
QString
,
QVariant
>*
>
parameters
;
///< All parameters
...
...
src/uas/UASInterface.h
View file @
6354c28a
...
...
@@ -96,6 +96,7 @@ public:
#ifdef QGC_PROTOBUF_ENABLED
virtual
px
::
PointCloudXYZRGB
getPointCloud
()
const
=
0
;
virtual
px
::
RGBDImage
getRGBDImage
()
const
=
0
;
#endif
virtual
bool
isArmed
()
const
=
0
;
...
...
src/ui/map3D/Pixhawk3DWidget.cc
View file @
6354c28a
...
...
@@ -1219,25 +1219,41 @@ float colormap_jet[128][3] = {
void
Pixhawk3DWidget
::
updateRGBD
(
double
robotX
,
double
robotY
,
double
robotZ
)
{
px
::
RGBDImage
rgbdImage
=
uas
->
getRGBDImage
();
px
::
PointCloudXYZRGB
pointCloud
=
uas
->
getPointCloud
();
// QSharedPointer<QByteArray> rgb = freenect->getRgbData();
// if (!rgb.isNull()) {
// rgbImage->setImage(640, 480, 1,
// GL_RGB, GL_RGB, GL_UNSIGNED_BYTE,
// reinterpret_cast<unsigned char *>(rgb->data()),
// osg::Image::NO_DELETE);
// rgbImage->dirty();
// }
rgbImage
->
setImage
(
rgbdImage
.
cols
(),
rgbdImage
.
rows
(),
1
,
GL_LUMINANCE
,
GL_LUMINANCE
,
GL_UNSIGNED_BYTE
,
reinterpret_cast
<
unsigned
char
*>
(
&
(
*
(
rgbdImage
.
mutable_imagedata1
()))[
0
]),
osg
::
Image
::
NO_DELETE
);
rgbImage
->
dirty
();
// QSharedPointer<QByteArray> coloredDepth = freenect->getColoredDepthData();
// if (!coloredDepth.isNull()) {
// depthImage->setImage(640, 480, 1,
// GL_RGB, GL_RGB, GL_UNSIGNED_BYTE,
// reinterpret_cast<unsigned char *>(coloredDepth->data()),
// osg::Image::NO_DELETE);
// depthImage->dirty();
// }
QByteArray
coloredDepth
(
rgbdImage
.
cols
()
*
rgbdImage
.
rows
()
*
3
,
0
);
for
(
uint32_t
r
=
0
;
r
<
rgbdImage
.
rows
();
++
r
)
{
const
float
*
depth
=
reinterpret_cast
<
const
float
*>
(
rgbdImage
.
imagedata2
().
c_str
()
+
r
*
rgbdImage
.
step2
());
uint8_t
*
pixel
=
reinterpret_cast
<
uint8_t
*>
(
coloredDepth
.
data
())
+
r
*
rgbdImage
.
cols
()
*
3
;
for
(
uint32_t
c
=
0
;
c
<
rgbdImage
.
cols
();
++
c
)
{
if
(
depth
[
c
]
!=
0
)
{
int
idx
=
fminf
(
depth
[
c
],
10.0
f
)
/
10.0
f
*
127.0
f
;
idx
=
127
-
idx
;
pixel
[
0
]
=
colormap_jet
[
idx
][
2
]
*
255.0
f
;
pixel
[
1
]
=
colormap_jet
[
idx
][
1
]
*
255.0
f
;
pixel
[
2
]
=
colormap_jet
[
idx
][
0
]
*
255.0
f
;
}
pixel
+=
3
;
}
}
depthImage
->
setImage
(
rgbdImage
.
cols
(),
rgbdImage
.
rows
(),
1
,
GL_RGB
,
GL_RGB
,
GL_UNSIGNED_BYTE
,
reinterpret_cast
<
unsigned
char
*>
(
coloredDepth
.
data
()),
osg
::
Image
::
NO_DELETE
);
depthImage
->
dirty
();
osg
::
Geometry
*
geometry
=
rgbd3DNode
->
getDrawable
(
0
)
->
asGeometry
();
...
...
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