How to publish topics with received json object using Rosbridge library?
Hi all,
Due to certain network configurations on the robot side, which I am not allowed to modify whatsoever, its ROS_MASTER_URI is set to http://localhost:11311 which subsequently cannot share topics across the network, I am trying to use Rosbridge to work around such limitation. Unfortunately Rosbridge_suite does not offer much documentation on how to do it.
Taking for instance to subscribe a laserScan topic from the robot side and publish it at my client side, what I've achieved so far are the following:
Launch rosbridge_tcp by the robot side
use Python socket to subscribe to robot's topic and decode the Json formatted string into Python object by my client side
I can acquire elements within the received and de-serialized Python object
I have the topic advertised using rosbridge library capabilities' protocol and advertise module
I have the topic published using rosbridge library capabilities' publish module
But at this point, there is nothing publishing at my client side. What should be the proper way to publish any topic? Thank you in advance!
Just making sure: you have seen the Basic ROS functionality with roslibjs tutorial that is linked from the Running Rosbridge tutorial?
@gvdhoorn Thank you for your reply. In fact, since I am developing on Python, I hadn't looked into the tutorial you pointed out. But if I can conclude from what this article teaches me about publishing topic, I would infer that we still need to fill in a great number of ...
attributes so as to publish the topic. I do not think this is what Rosbridge's authors intended for the user to implement, but by going through the test codes, I am reluctantly forced to belive that this is exactly the route we should take to publish any arbitrary topic.
rosbridge_suite
provides the bridge that allows any external program to communicate with it over a JSON/TCP socket. It is not a drop-in replacement of a regular ROS client library (such asroscpp
orrospy
). Clients will have to implement some things themselves. An example for C# is .... follesoe/rosbridge_client_dot_net. That makes things relatively simple, but it's still not a full ROS client lib.
Seeing as you're working in Python, you could try and see whether using rosbridge_library simplifies some of the work of interacting with a
rosbridge_server
.But as
rosbridge
is quite limited, it will probably never reach parity withrospy
orroscpp
.@Megacephalo , can you attach the
HTML
code used to subscribe/publish on aROS Topic
usingROS Bridge
?@Ruben Alves: @Megacephalo is using Python as his client library. Where would the html be used?