Advertising a service via Rosbridge?

359 views
Skip to first unread message

AAgg

unread,
Mar 6, 2013, 5:48:10 AM3/6/13
to rosbrid...@googlegroups.com
Hello Rosbridge users,
Is it possible to advertise a service via rosbridge (version1 or version2), analogous to
"ros::ServiceServer service = n.advertiseService("add_two_ints", add);"?

I am trying to create generic sensor modules using rosbridge, for which I need to advertise services that other ros based clients can call.

I would appreciate any sample code snippet in python or java or C.

Thanks,

Russell Toris

unread,
Mar 6, 2013, 5:18:20 PM3/6/13
to rosbrid...@googlegroups.com
Currently the ROSBRIDGE 2.0 protocol does not support the advertisement of services. The current protocol itself can be found at http://kforge.ros.org/rosbridge/trac/raw-attachment/wiki/WikiStart/rosbridge%20protocol%20specification.pdf

I am less familiar with the ROSBRIDGE v1 protocol, but judging by the specification (http://code.google.com/p/brown-ros-pkg/wiki/RosbridgeProtocolMarkdown) it does not appear to support this feature either.

Best,

Russell


--
You received this message because you are subscribed to the Google Groups "Rosbridge Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rosbridge-use...@googlegroups.com.
To post to this group, send email to rosbrid...@googlegroups.com.
Visit this group at http://groups.google.com/group/rosbridge-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.





--
Russell Toris
Graduate Student | WPI Department of Computer Science
(203) 984-4571 | rct...@wpi.edu
http://users.wpi.edu/~rctoris/

Chad Jenkins

unread,
Mar 6, 2013, 5:56:58 PM3/6/13
to rosbrid...@googlegroups.com

Hi AAgg,

Is this functionality an absolute must for your application?  Advertising services in this manner sort of breaks the client/server assumptions of the current versions of rosbridge.  The protocol would need to be modified or rethought to support this.

That said, contributions are welcome   :)

Chad
___

achintag...@gmail.com

unread,
Mar 7, 2013, 5:17:51 PM3/7/13
to rosbrid...@googlegroups.com
Dear Russell and Chad,
Thanks for your replies.
I somehow understand the motivation behind not having rosbridge clients advertise services. For my application I could use a combination of a msg and srv as a workaround. Although not very neat, it will work for now.

However, it would be really cool to have such a functionality. I think mine is a very general case and having the rosbridge clients advertise srv is desirable. I thought about advertising a srv via the rosbridge server and then managing communication with the appropriate rosbridge client via socket communication. However, blocking the rosbridge server while it completes the request is just wrong.
Do you have any other suggestions?

Thanks,
Achint

felixm...@gmail.com

unread,
Mar 23, 2013, 6:48:42 AM3/23/13
to rosbrid...@googlegroups.com, achintag...@gmail.com
Dear all,

I'd like to join this discussion as I'm just having the same problem.
I use rosbridgeV2 for communication between ROS and Matlab, where Matlab provides some computation that I would like to call from ROS as if it were a Service.
At the moment I use a ROS->Matlab and then Matlab->ROS topic communication where the ROS node just sleeps after publishing until an anser_received flag is set within the ROS subscription callback.

This works for me so far, but I wanted to +1 for the support of non-ROS-ServiceServers ;-)

With best regards,
Felix

Chad Jenkins

unread,
Mar 24, 2013, 7:43:50 PM3/24/13
to rosbrid...@googlegroups.com

Hi Achint and Felix,

Here is a quick response.  Russell knows much more about the details and can definitely provide a more thorough response.

I definitely agree with both of you this would be a great feature to have and would be widely used.  I am just unsure how to do this properly without reinventing RPC or causing bloat in the protocol. 

Ideally, ROSTCP should be the protocol for bidirectional communications that supports services.  However, ROSTCP has no specific definition, other than its implementation in ROS.  Further, if ROS was truly portable across computing environments, this would likely resolve the situation.

More importantly that the client/server model, rosbridge does not manage namespaces, which is needed for one-to-one communication between requesters and responders.  Specifically, multiple rosbridge clients advertising the same service would cause an error (Russell did a great job of explaining this in a separate conversation).  Support for namespacing would require a rethinking of the core rosbridge assumptions, or could be supported through a different mechanism (such as the one Felix described).

Chad
___

Russell Toris

unread,
Mar 24, 2013, 8:27:27 PM3/24/13
to rosbrid...@googlegroups.com
Looks like Chad summed things up pretty well!

The problem really lies in the way rosbridge is currently thought of. Since it is really based on a server/client model, having clients act as a 'service' to a ROS system begins to get tricky. For topics and messages, there is a many-to-many relationship. Many nodes/clients can subscribe to a particular topic (e.g., /rosout) and many nodes/clients can also publish to the same topic (e.g., /cmd_vel). Services, on the other hand, have a many-to-one relationship. For example, if I am a node and I advertise /do_something, many nodes/clients can make a request to /do_something. However, no other nodes/clients can advertise /do_something since then you would not know where to forward the request. In a simple case, if rosbridge server only had one client, this problem does not matter. However, if you have multiple clients, you have to have a way of ensuring this does not get violated.

Russell
rct...@wpi.edu | http://users.wpi.edu/~rctoris/

Chad Jenkins

unread,
Apr 4, 2013, 6:34:10 PM4/4/13
to rosbrid...@googlegroups.com

It seems that many rosbridge users are asking for client-side service advertisement.  Given this demand, Russell has started an issue for discussion on github:

  https://github.com/RobotWebTools/rosbridge_suite/issues/34

Please feel free to participate in this discussion.

My initial inclination is for rosbridge to support a single client advertising services with no guarantees beyond that.

Chad
___

felixm...@gmail.com

unread,
Apr 5, 2013, 2:09:24 AM4/5/13
to rosbrid...@googlegroups.com
Cool, thanks guys!

For us, the assumption to have only one client advertising a service is absolutely sufficient (for the time being ;-)

Let us know, how we can help?
Reply all
Reply to author
Forward
0 new messages