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
b31c1856
Commit
b31c1856
authored
Aug 26, 2020
by
Valentin Platzgummer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
topic publishing issue solved
parent
591ba07e
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
29 deletions
+15
-29
qgroundcontrol.pro
qgroundcontrol.pro
+2
-3
RosBridgeClient.cpp
src/comm/ros_bridge/include/RosBridgeClient.cpp
+0
-16
com_private.cpp
src/comm/ros_bridge/include/com_private.cpp
+2
-9
topic_publisher.cpp
src/comm/ros_bridge/include/topic_publisher.cpp
+11
-1
No files found.
qgroundcontrol.pro
View file @
b31c1856
...
...
@@ -28,12 +28,11 @@ QGCROOT = $$PWD
DebugBuild
{
DESTDIR
=
$$
{
OUT_PWD
}
/
debug
DEFINES
+=
DEBUG
DEFINES
+=
ROS_BRIDGE_DEBUG
#
DEFINES
+=
ROS_BRIDGE_CLIENT_DEBUG
#
DEFINES
+=
ROS_BRIDGE_DEBUG
}
else
{
DESTDIR
=
$$
{
OUT_PWD
}
/
release
DEFINES
+=
ROS_BRIDGE_DEBUG
#
DEFINES
+=
ROS_BRIDGE_DEBUG
DEFINES
+=
NDEBUG
}
...
...
src/comm/ros_bridge/include/RosBridgeClient.cpp
View file @
b31c1856
...
...
@@ -122,10 +122,6 @@ void RosbridgeWsClient::run()
// ====================================================================================
if
(
std
::
chrono
::
high_resolution_clock
::
now
()
>
poll_time_point
)
{
poll_time_point
=
std
::
chrono
::
high_resolution_clock
::
now
()
+
poll_interval
;
#ifdef ROS_BRIDGE_DEBUG
std
::
cout
<<
"Starting new poll."
<<
std
::
endl
;
std
::
cout
<<
"connected: "
<<
this
->
isConnected
->
load
()
<<
std
::
endl
;
#endif
std
::
string
reset_status_task_name
=
"reset_status_task"
;
// Add status task if necessary.
auto
const
it
=
std
::
find_if
(
task_list
.
begin
(),
task_list
.
end
(),
...
...
@@ -133,16 +129,10 @@ void RosbridgeWsClient::run()
return
t
.
name
==
reset_status_task_name
;
});
if
(
it
==
task_list
.
end
()
){
#ifdef ROS_BRIDGE_DEBUG
std
::
cout
<<
"Adding status_task"
<<
std
::
endl
;
#endif
// Check connection status.
auto
status_set
=
std
::
make_shared
<
std
::
atomic_bool
>
(
false
);
auto
status_client
=
std
::
make_shared
<
WsClient
>
(
this
->
server_port_path
);
status_client
->
on_open
=
[
status_set
,
this
](
std
::
shared_ptr
<
WsClient
::
Connection
>
)
{
#ifdef ROS_BRIDGE_DEBUG
std
::
cout
<<
"status_client opened"
<<
std
::
endl
;
#endif
this
->
isConnected
->
store
(
true
);
status_set
->
store
(
true
);
};
...
...
@@ -190,9 +180,6 @@ void RosbridgeWsClient::run()
});
if
(
topics_it
==
task_list
.
end
()
){
// Call /rosapi/topics service.
#ifdef ROS_BRIDGE_DEBUG
std
::
cout
<<
"Adding reset_topics_task"
<<
std
::
endl
;
#endif
auto
topics_set
=
std
::
make_shared
<
std
::
atomic_bool
>
(
false
);
this
->
callService
(
"/rosapi/topics"
,
[
topics_set
,
this
](
std
::
shared_ptr
<
WsClient
::
Connection
>
connection
,
...
...
@@ -238,9 +225,6 @@ void RosbridgeWsClient::run()
});
if
(
services_it
==
task_list
.
end
()
){
// Call /rosapi/services service.
#ifdef ROS_BRIDGE_DEBUG
std
::
cout
<<
"Adding reset_services_task"
<<
std
::
endl
;
#endif
auto
services_set
=
std
::
make_shared
<
std
::
atomic_bool
>
(
false
);
this
->
callService
(
"/rosapi/services"
,
[
this
,
services_set
](
std
::
shared_ptr
<
WsClient
::
Connection
>
connection
,
...
...
src/comm/ros_bridge/include/com_private.cpp
View file @
b31c1856
...
...
@@ -19,11 +19,7 @@ std::size_t ros_bridge::com_private::getHash(const char *str)
bool
ros_bridge
::
com_private
::
getTopic
(
const
ros_bridge
::
com_private
::
JsonDoc
&
doc
,
std
::
string
&
topic
)
{
if
(
doc
.
HasMember
(
"topic"
)
&&
doc
[
"topic"
].
IsString
()
){
rapidjson
::
StringBuffer
sb
;
rapidjson
::
Writer
<
rapidjson
::
StringBuffer
>
writer
(
sb
);
doc
[
"topic"
].
Accept
(
writer
);
topic
=
sb
.
GetString
();
topic
=
doc
[
"topic"
].
GetString
();
return
true
;
}
else
return
false
;
...
...
@@ -41,10 +37,7 @@ bool ros_bridge::com_private::removeTopic(ros_bridge::com_private::JsonDoc &doc)
bool
ros_bridge
::
com_private
::
getType
(
const
ros_bridge
::
com_private
::
JsonDoc
&
doc
,
std
::
string
&
type
)
{
if
(
doc
.
HasMember
(
"type"
)
&&
doc
[
"type"
].
IsString
()
){
rapidjson
::
StringBuffer
sb
;
rapidjson
::
Writer
<
rapidjson
::
StringBuffer
>
writer
(
sb
);
doc
[
"type"
].
Accept
(
writer
);
type
=
sb
.
GetString
();
type
=
doc
[
"type"
].
GetString
();
return
true
;
}
else
return
false
;
...
...
src/comm/ros_bridge/include/topic_publisher.cpp
View file @
b31c1856
...
...
@@ -40,6 +40,16 @@ void ros_bridge::com_private::TopicPublisher::start()
bool
ret
=
com_private
::
getTopic
(
*
pJsonDoc
,
topic
);
assert
(
ret
);
(
void
)
ret
;
// Debug
rapidjson
::
StringBuffer
sb
;
rapidjson
::
Writer
<
rapidjson
::
StringBuffer
>
writer
(
sb
);
pJsonDoc
->
Accept
(
writer
);
std
::
cout
<<
"message: "
<<
sb
.
GetString
()
<<
std
::
endl
;
std
::
cout
<<
"topic: "
<<
topic
<<
std
::
endl
;
ret
=
com_private
::
removeTopic
(
*
pJsonDoc
);
assert
(
ret
);
(
void
)
ret
;
...
...
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