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
0dd18040
Commit
0dd18040
authored
Feb 04, 2021
by
Valentin Platzgummer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nemo.cpp: deadlock when calling stop during synchronization removed
parent
faf642f3
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
107 additions
and
114 deletions
+107
-114
MeasurementComplexItem.cc
src/MeasurementComplexItem/MeasurementComplexItem.cc
+1
-0
MeasurementComplexItem.h
src/MeasurementComplexItem/MeasurementComplexItem.h
+1
-1
NemoInterface.cpp
src/MeasurementComplexItem/NemoInterface.cpp
+99
-75
NemoInterface.h
src/MeasurementComplexItem/NemoInterface.h
+0
-2
MeasurementArea.cc
src/MeasurementComplexItem/geometry/MeasurementArea.cc
+2
-21
MeasurementArea.h
src/MeasurementComplexItem/geometry/MeasurementArea.h
+1
-4
ProgressArray.h
src/MeasurementComplexItem/geometry/ProgressArray.h
+0
-1
TaskDispatcher.cpp
src/MeasurementComplexItem/nemo_interface/TaskDispatcher.cpp
+2
-8
TaskDispatcher.h
src/MeasurementComplexItem/nemo_interface/TaskDispatcher.h
+1
-2
No files found.
src/MeasurementComplexItem/MeasurementComplexItem.cc
View file @
0dd18040
#include "MeasurementComplexItem.h"
#include "AreaData.h"
#include "CircularGenerator.h"
#include "LinearGenerator.h"
#include "NemoInterface.h"
...
...
src/MeasurementComplexItem/MeasurementComplexItem.h
View file @
0dd18040
...
...
@@ -9,9 +9,9 @@
#include "QGCQGeoCoordinate.h"
#include "SettingsFact.h"
#include "AreaData.h"
#include "geometry/ProgressArray.h"
class
AreaData
;
class
RoutingThread
;
class
RoutingResult
;
...
...
src/MeasurementComplexItem/NemoInterface.cpp
View file @
0dd18040
This diff is collapsed.
Click to expand it.
src/MeasurementComplexItem/NemoInterface.h
View file @
0dd18040
...
...
@@ -13,8 +13,6 @@
#include "TilePtrArray.h"
#include "geometry/ProgressArray.h"
// Singelton class used to interface measurement devices implementing the nemo
// interface.
class
NemoInterface
:
public
QObject
{
Q_OBJECT
class
Impl
;
...
...
src/MeasurementComplexItem/geometry/MeasurementArea.cc
View file @
0dd18040
...
...
@@ -15,6 +15,8 @@
#include "QGCLoggingCategory.h"
#include "QmlObjectListHelper.h"
#include "MeasurementComplexItem/nemo_interface/MeasurementTile.h"
#ifndef MAX_TILES
#define MAX_TILES 1000
#endif
...
...
@@ -602,27 +604,6 @@ void MeasurementArea::setState(MeasurementArea::STATE s) {
}
}
void
MeasurementArea
::
updateIds
(
const
QList
<
TileDiff
>
&
array
)
{
for
(
const
auto
&
diff
:
array
)
{
auto
it
=
_indexMap
.
find
(
diff
.
oldTile
.
id
());
if
(
it
!=
_indexMap
.
end
())
{
int
tileIndex
=
it
->
second
;
auto
*
tile
=
_tiles
->
value
<
MeasurementTile
*>
(
tileIndex
);
if
(
diff
.
oldTile
.
coordinateList
()
==
tile
->
coordinateList
())
{
// Change id and update _tileMap.
const
auto
newId
=
diff
.
newTile
.
id
();
tile
->
setId
(
newId
);
_indexMap
.
erase
(
it
);
auto
ret
=
_indexMap
.
insert
(
std
::
make_pair
(
newId
,
tileIndex
));
Q_ASSERT
(
ret
.
second
==
true
/*insert success?*/
);
Q_UNUSED
(
ret
);
}
}
}
}
bool
getTiles
(
const
FPolygon
&
area
,
Length
tileHeight
,
Length
tileWidth
,
Area
minTileArea
,
std
::
vector
<
FPolygon
>
&
tiles
,
BoundingBox
&
bbox
)
{
...
...
src/MeasurementComplexItem/geometry/MeasurementArea.h
View file @
0dd18040
...
...
@@ -6,10 +6,8 @@
#include <QTimer>
#include "GeoArea.h"
#include "MeasurementComplexItem/nemo_interface/MeasurementTile.h"
#include "ProgressArray.h"
#include "TileDiff.h"
#include "ProgressArray.h"
#include "SettingsFact.h"
class
MeasurementArea
:
public
GeoArea
{
...
...
@@ -61,7 +59,6 @@ signals:
void
progressChanged
();
public
slots
:
void
updateIds
(
const
QList
<
TileDiff
>
&
array
);
void
updateProgress
(
const
ProgressArray
&
array
);
Q_INVOKABLE
void
randomProgress
();
Q_INVOKABLE
void
resetProgress
();
...
...
src/MeasurementComplexItem/geometry/ProgressArray.h
View file @
0dd18040
...
...
@@ -2,7 +2,6 @@
#define PROGRESSARRAY_H
#include <QVector>
#include <tuple>
#include "comm/ros_bridge/include/messages/nemo_msgs/labeled_progress.h"
...
...
src/MeasurementComplexItem/nemo_interface/TaskDispatcher.cpp
View file @
0dd18040
...
...
@@ -52,11 +52,7 @@ void TaskDispatcher::start() {
ULock
lk1
(
this
->
_mutex
);
if
(
!
_running
)
{
this
->
_running
=
true
;
auto
p
=
std
::
make_shared
<
std
::
promise
<
void
>>
();
_threadFuture
=
p
->
get_future
();
QtConcurrent
::
run
([
this
,
p
=
std
::
move
(
p
)]()
mutable
{
return
this
->
run
(
std
::
move
(
*
p
));
});
QtConcurrent
::
run
([
this
]()
mutable
{
return
this
->
run
();
});
lk1
.
unlock
();
}
}
...
...
@@ -65,7 +61,6 @@ void TaskDispatcher::stop() {
ULock
lk1
(
this
->
_mutex
);
if
(
_running
)
{
this
->
_running
=
false
;
_threadFuture
.
wait
();
lk1
.
unlock
();
}
}
...
...
@@ -92,7 +87,7 @@ std::size_t TaskDispatcher::pendingTasks() {
bool
TaskDispatcher
::
idle
()
{
return
this
->
pendingTasks
()
==
0
;
}
void
TaskDispatcher
::
run
(
std
::
promise
<
void
>
p
)
{
void
TaskDispatcher
::
run
()
{
while
(
true
)
{
ULock
lk1
(
this
->
_mutex
);
...
...
@@ -116,7 +111,6 @@ void TaskDispatcher::run(std::promise<void> p) {
break
;
}
}
p
.
set_value
();
}
}
// namespace nemo_interface
src/MeasurementComplexItem/nemo_interface/TaskDispatcher.h
View file @
0dd18040
...
...
@@ -56,12 +56,11 @@ public:
bool
idle
();
protected:
void
run
(
std
::
promise
<
void
>
p
);
void
run
();
private:
std
::
deque
<
std
::
unique_ptr
<
Task
>>
_taskQueue
;
std
::
deque
<
std
::
promise
<
QVariant
>>
_promiseQueue
;
std
::
future
<
void
>
_threadFuture
;
bool
_running
;
std
::
mutex
_mutex
;
};
...
...
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