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
77f6b92c
Commit
77f6b92c
authored
Feb 08, 2012
by
hengli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added mutexes to prevent malformed protobuf data.
parent
dba8b932
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
17 deletions
+36
-17
UAS.cc
src/uas/UAS.cc
+8
-0
UAS.h
src/uas/UAS.h
+20
-8
UASInterface.h
src/uas/UASInterface.h
+8
-8
QGCRGBDView.cc
src/ui/QGCRGBDView.cc
+0
-1
No files found.
src/uas/UAS.cc
View file @
77f6b92c
...
...
@@ -1031,25 +1031,33 @@ void UAS::receiveExtendedMessage(LinkInterface* link, std::tr1::shared_ptr<googl
if
(
message
->
GetTypeName
()
==
pointCloud
.
GetTypeName
())
{
receivedPointCloudTimestamp
=
QGC
::
groundTimeSeconds
();
pointCloudMutex
.
lock
();
pointCloud
.
CopyFrom
(
*
message
);
pointCloudMutex
.
unlock
();
emit
pointCloudChanged
(
this
);
}
else
if
(
message
->
GetTypeName
()
==
rgbdImage
.
GetTypeName
())
{
receivedRGBDImageTimestamp
=
QGC
::
groundTimeSeconds
();
rgbdImageMutex
.
lock
();
rgbdImage
.
CopyFrom
(
*
message
);
rgbdImageMutex
.
unlock
();
emit
rgbdImageChanged
(
this
);
}
else
if
(
message
->
GetTypeName
()
==
obstacleList
.
GetTypeName
())
{
receivedObstacleListTimestamp
=
QGC
::
groundTimeSeconds
();
obstacleListMutex
.
lock
();
obstacleList
.
CopyFrom
(
*
message
);
obstacleListMutex
.
unlock
();
emit
obstacleListChanged
(
this
);
}
else
if
(
message
->
GetTypeName
()
==
path
.
GetTypeName
())
{
receivedPathTimestamp
=
QGC
::
groundTimeSeconds
();
pathMutex
.
lock
();
path
.
CopyFrom
(
*
message
);
pathMutex
.
unlock
();
emit
pathChanged
(
this
);
}
}
...
...
src/uas/UAS.h
View file @
77f6b92c
...
...
@@ -135,39 +135,47 @@ public:
bool
getSelected
()
const
;
#ifdef QGC_PROTOBUF_ENABLED
px
::
PointCloudXYZRGB
getPointCloud
()
const
{
px
::
PointCloudXYZRGB
getPointCloud
()
{
QMutexLocker
locker
(
&
pointCloudMutex
);
return
pointCloud
;
}
px
::
PointCloudXYZRGB
getPointCloud
(
qreal
&
receivedTimestamp
)
const
{
px
::
PointCloudXYZRGB
getPointCloud
(
qreal
&
receivedTimestamp
)
{
receivedTimestamp
=
receivedPointCloudTimestamp
;
QMutexLocker
locker
(
&
pointCloudMutex
);
return
pointCloud
;
}
px
::
RGBDImage
getRGBDImage
()
const
{
px
::
RGBDImage
getRGBDImage
()
{
QMutexLocker
locker
(
&
rgbdImageMutex
);
return
rgbdImage
;
}
px
::
RGBDImage
getRGBDImage
(
qreal
&
receivedTimestamp
)
const
{
px
::
RGBDImage
getRGBDImage
(
qreal
&
receivedTimestamp
)
{
receivedTimestamp
=
receivedRGBDImageTimestamp
;
QMutexLocker
locker
(
&
rgbdImageMutex
);
return
rgbdImage
;
}
px
::
ObstacleList
getObstacleList
()
const
{
px
::
ObstacleList
getObstacleList
()
{
QMutexLocker
locker
(
&
obstacleListMutex
);
return
obstacleList
;
}
px
::
ObstacleList
getObstacleList
(
qreal
&
receivedTimestamp
)
const
{
px
::
ObstacleList
getObstacleList
(
qreal
&
receivedTimestamp
)
{
receivedTimestamp
=
receivedObstacleListTimestamp
;
QMutexLocker
locker
(
&
obstacleListMutex
);
return
obstacleList
;
}
px
::
Path
getPath
()
const
{
px
::
Path
getPath
()
{
QMutexLocker
locker
(
&
pathMutex
);
return
path
;
}
px
::
Path
getPath
(
qreal
&
receivedTimestamp
)
const
{
px
::
Path
getPath
(
qreal
&
receivedTimestamp
)
{
receivedTimestamp
=
receivedPathTimestamp
;
QMutexLocker
locker
(
&
pathMutex
);
return
path
;
}
#endif
...
...
@@ -257,15 +265,19 @@ protected: //COMMENTS FOR TEST UNIT
#ifdef QGC_PROTOBUF_ENABLED
px
::
PointCloudXYZRGB
pointCloud
;
QMutex
pointCloudMutex
;
qreal
receivedPointCloudTimestamp
;
px
::
RGBDImage
rgbdImage
;
QMutex
rgbdImageMutex
;
qreal
receivedRGBDImageTimestamp
;
px
::
ObstacleList
obstacleList
;
QMutex
obstacleListMutex
;
qreal
receivedObstacleListTimestamp
;
px
::
Path
path
;
QMutex
pathMutex
;
qreal
receivedPathTimestamp
;
#endif
...
...
src/uas/UASInterface.h
View file @
77f6b92c
...
...
@@ -95,14 +95,14 @@ public:
virtual
bool
getSelected
()
const
=
0
;
#ifdef QGC_PROTOBUF_ENABLED
virtual
px
::
PointCloudXYZRGB
getPointCloud
()
const
=
0
;
virtual
px
::
PointCloudXYZRGB
getPointCloud
(
qreal
&
receivedTimestamp
)
const
=
0
;
virtual
px
::
RGBDImage
getRGBDImage
()
const
=
0
;
virtual
px
::
RGBDImage
getRGBDImage
(
qreal
&
receivedTimestamp
)
const
=
0
;
virtual
px
::
ObstacleList
getObstacleList
()
const
=
0
;
virtual
px
::
ObstacleList
getObstacleList
(
qreal
&
receivedTimestamp
)
const
=
0
;
virtual
px
::
Path
getPath
()
const
=
0
;
virtual
px
::
Path
getPath
(
qreal
&
receivedTimestamp
)
const
=
0
;
virtual
px
::
PointCloudXYZRGB
getPointCloud
()
=
0
;
virtual
px
::
PointCloudXYZRGB
getPointCloud
(
qreal
&
receivedTimestamp
)
=
0
;
virtual
px
::
RGBDImage
getRGBDImage
()
=
0
;
virtual
px
::
RGBDImage
getRGBDImage
(
qreal
&
receivedTimestamp
)
=
0
;
virtual
px
::
ObstacleList
getObstacleList
()
=
0
;
virtual
px
::
ObstacleList
getObstacleList
(
qreal
&
receivedTimestamp
)
=
0
;
virtual
px
::
Path
getPath
()
=
0
;
virtual
px
::
Path
getPath
(
qreal
&
receivedTimestamp
)
=
0
;
#endif
virtual
bool
isArmed
()
const
=
0
;
...
...
src/ui/QGCRGBDView.cc
View file @
77f6b92c
...
...
@@ -52,7 +52,6 @@ void QGCRGBDView::clearData(void)
qDebug
()
<<
offlineImg
.
load
(
":/images/status/colorbars.png"
);
glImage
=
QGLWidget
::
convertToGLFormat
(
offlineImg
);
qDebug
()
<<
"cleardata"
<<
offlineImg
.
isNull
()
<<
offlineImg
.
width
()
<<
offlineImg
.
height
();
}
void
QGCRGBDView
::
contextMenuEvent
(
QContextMenuEvent
*
event
)
...
...
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