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
7308bf55
Commit
7308bf55
authored
Jan 29, 2021
by
Valentin Platzgummer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nemo interface improved
parent
29514d84
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
753 additions
and
1108 deletions
+753
-1108
QGroundControl.AppImage
deploy/QGroundControl.AppImage
+0
-0
qgroundcontrol.pro
qgroundcontrol.pro
+0
-2
NemoInterface.cpp
src/MeasurementComplexItem/NemoInterface.cpp
+695
-672
TaskDispatcher.cpp
src/MeasurementComplexItem/nemo_interface/TaskDispatcher.cpp
+8
-3
TaskDispatcher.h
src/MeasurementComplexItem/nemo_interface/TaskDispatcher.h
+2
-3
rosbridge.cpp
src/MeasurementComplexItem/rosbridge/rosbridge.cpp
+42
-1
rosbridge.h
src/MeasurementComplexItem/rosbridge/rosbridge.h
+6
-0
routing.cpp
src/MeasurementComplexItem/routing.cpp
+0
-423
routing.h
src/MeasurementComplexItem/routing.h
+0
-4
No files found.
deploy/QGroundControl.AppImage
View file @
7308bf55
No preview for this file type
qgroundcontrol.pro
View file @
7308bf55
...
...
@@ -463,7 +463,6 @@ HEADERS += \
src
/
MeasurementComplexItem
/
nemo_interface
/
Task
.
h
\
src
/
MeasurementComplexItem
/
nemo_interface
/
TaskDispatcher
.
h
\
src
/
MeasurementComplexItem
/
nemo_interface
/
tileHelper
.
h
\
src
/
MeasurementComplexItem
/
routing
.
h
\
src
/
comm
/
ros_bridge
/
include
/
messages
/
nemo_msgs
/
labeled_progress
.
h
\
src
/
MeasurementComplexItem
/
nemo_interface
/
MeasurementTile
.
h
\
src
/
QmlControls
/
QmlUnitsConversion
.
h
\
...
...
@@ -539,7 +538,6 @@ SOURCES += \
src
/
MeasurementComplexItem
/
nemo_interface
/
MeasurementTile
.
cpp
\
src
/
MeasurementComplexItem
/
nemo_interface
/
Task
.
cpp
\
src
/
MeasurementComplexItem
/
nemo_interface
/
TaskDispatcher
.
cpp
\
src
/
MeasurementComplexItem
/
routing
.
cpp
\
src
/
Vehicle
/
VehicleEscStatusFactGroup
.
cc
\
src
/
MeasurementComplexItem
/
AreaData
.
cc
\
src
/
api
/
QGCCorePlugin
.
cc
\
...
...
src/MeasurementComplexItem/NemoInterface.cpp
View file @
7308bf55
This diff is collapsed.
Click to expand it.
src/MeasurementComplexItem/nemo_interface/TaskDispatcher.cpp
View file @
7308bf55
...
...
@@ -52,7 +52,11 @@ void TaskDispatcher::start() {
ULock
lk1
(
this
->
_mutex
);
if
(
!
_running
)
{
this
->
_running
=
true
;
_future
=
QtConcurrent
::
run
([
this
]()
mutable
{
return
this
->
run
();
});
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
));
});
lk1
.
unlock
();
}
}
...
...
@@ -61,8 +65,8 @@ void TaskDispatcher::stop() {
ULock
lk1
(
this
->
_mutex
);
if
(
_running
)
{
this
->
_running
=
false
;
_threadFuture
.
wait
();
lk1
.
unlock
();
this
->
_future
.
waitForFinished
();
}
}
...
...
@@ -88,7 +92,7 @@ std::size_t TaskDispatcher::pendingTasks() {
bool
TaskDispatcher
::
idle
()
{
return
this
->
pendingTasks
()
==
0
;
}
void
TaskDispatcher
::
run
()
{
void
TaskDispatcher
::
run
(
std
::
promise
<
void
>
p
)
{
while
(
true
)
{
ULock
lk1
(
this
->
_mutex
);
...
...
@@ -112,6 +116,7 @@ void TaskDispatcher::run() {
break
;
}
}
p
.
set_value
();
}
}
// namespace nemo_interface
src/MeasurementComplexItem/nemo_interface/TaskDispatcher.h
View file @
7308bf55
...
...
@@ -56,13 +56,12 @@ public:
bool
idle
();
protected:
void
run
();
void
run
(
std
::
promise
<
void
>
p
);
private:
QFuture
<
void
>
_future
;
std
::
deque
<
std
::
unique_ptr
<
Task
>>
_taskQueue
;
std
::
deque
<
std
::
promise
<
QVariant
>>
_promiseQueue
;
std
::
future
<
void
>
_threadFuture
;
bool
_running
;
std
::
mutex
_mutex
;
};
...
...
src/MeasurementComplexItem/rosbridge/rosbridge.cpp
View file @
7308bf55
...
...
@@ -37,7 +37,7 @@ void Rosbridge::start() {
_impl
->
moveToThread
(
_t
);
connect
(
_impl
,
&
RosbridgeImpl
::
stateChanged
,
this
,
&
Rosbridge
::
s
tateChanged
);
&
Rosbridge
::
_onImplS
tateChanged
);
connect
(
this
,
&
Rosbridge
::
_start
,
_impl
,
&
RosbridgeImpl
::
start
);
connect
(
this
,
&
Rosbridge
::
_stop
,
_impl
,
&
RosbridgeImpl
::
stop
);
...
...
@@ -173,6 +173,26 @@ void Rosbridge::waitForTopic(const QString &topic) {
}
}
bool
Rosbridge
::
waitForTopic
(
const
QString
&
topic
,
const
std
::
function
<
bool
()
>
&
condition
)
{
std
::
future
<
bool
>
fut
;
do
{
fut
=
topicAvailable
(
topic
);
// wait
while
(
true
)
{
auto
status
=
fut
.
wait_for
(
std
::
chrono
::
milliseconds
(
5
));
if
(
!
condition
())
{
return
false
;
}
if
(
status
==
std
::
future_status
::
ready
)
{
break
;
}
}
}
while
(
!
fut
.
get
());
return
true
;
}
void
Rosbridge
::
advertiseService
(
const
QString
&
service
,
const
QString
&
type
,
CallBackWReturn
callback
)
{
emit
_advertiseService
(
service
,
type
,
callback
);
...
...
@@ -244,6 +264,26 @@ void Rosbridge::waitForService(const QString &service) {
}
}
bool
Rosbridge
::
waitForService
(
const
QString
&
service
,
const
std
::
function
<
bool
()
>
&
condition
)
{
std
::
future
<
bool
>
fut
;
do
{
fut
=
serviceAvailable
(
service
);
// wait
while
(
true
)
{
auto
status
=
fut
.
wait_for
(
std
::
chrono
::
milliseconds
(
5
));
if
(
!
condition
())
{
return
false
;
}
if
(
status
==
std
::
future_status
::
ready
)
{
break
;
}
}
}
while
(
!
fut
.
get
());
return
true
;
}
Rosbridge
::
STATE
translate
(
RosbridgeImpl
::
STATE
s
)
{
switch
(
s
)
{
case
RosbridgeImpl
:
:
STATE
::
STOPPED
:
...
...
@@ -260,3 +300,4 @@ Rosbridge::STATE translate(RosbridgeImpl::STATE s) {
qCritical
()
<<
"unreachable branch!"
;
return
Rosbridge
::
STATE
::
STOPPED
;
}
void
Rosbridge
::
_onImplStateChanged
()
{
emit
stateChanged
();
}
src/MeasurementComplexItem/rosbridge/rosbridge.h
View file @
7308bf55
...
...
@@ -58,6 +58,8 @@ public:
void
unsubscribeAllTopics
();
void
waitForTopic
(
const
QString
&
topic
);
bool
waitForTopic
(
const
QString
&
topic
,
const
std
::
function
<
bool
()
>
&
condition
);
// Services.
void
advertiseService
(
const
QString
&
service
,
const
QString
&
type
,
...
...
@@ -75,6 +77,8 @@ public:
std
::
future
<
QJsonObject
>
getAdvertisedServices
();
void
waitForService
(
const
QString
&
service
);
bool
waitForService
(
const
QString
&
service
,
const
std
::
function
<
bool
()
>
&
condition
);
signals:
void
stateChanged
();
...
...
@@ -99,6 +103,8 @@ signals:
const
QJsonObject
&
args
=
QJsonObject
());
void
_unadvertiseService
(
const
QString
&
service
);
void
_unadvertiseAllServices
();
private
slots
:
void
_onImplStateChanged
();
private:
std
::
atomic
<
STATE
>
_state
;
...
...
src/MeasurementComplexItem/routing.cpp
deleted
100644 → 0
View file @
29514d84
This diff is collapsed.
Click to expand it.
src/MeasurementComplexItem/routing.h
deleted
100644 → 0
View file @
29514d84
#ifndef ROUTING_H
#define ROUTING_H
#endif // ROUTING_H
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