ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

"thin clients" communicating with ROS

asked 2012-07-27 09:23:58 -0600

isherman gravatar image

One of my use-cases for ROS is that I'd like to have a 'thin client' on OS X that can communicate with our Ubuntu ROS master for some simple tasks: perhaps calling a service or querying a parameter from the parameter server.

But the overhead of installing and configuring ROS on our OS X machine is too much, especially because we're trying to build a releasable binary that is pretty much drag-and-drop install on OS X.

The first solution that comes to mind for me is a TCP server running in a ROS node on the Ubuntu machine that provides a limited interface to the ROS world for thin clients to call. Sort of like what ROSBridge tries to do for a web client. Do you know of any mature stacks that implement something like that? Is the idea of running a TCP server in a ROS node unpalatable / full of pitfalls? A sort of standardized interface to ROS for non-ROS clients seems like a common use case, but I don't have a great idea of the technical implications.

edit retag flag offensive close merge delete

Comments

The extreme basics of ROS (generating and sending messages, for example) build just fine on OS X, although I agree that it's a bit messy, and not necessarily suitable for straightaway deployment.

Mac gravatar image Mac  ( 2012-07-27 12:03:54 -0600 )edit

@Mac: I do have bare-bones ROS building on OS X, but it takes about an hour and requires various bits of troubleshooting to make it all the way through. If you have any shortcuts I'd be curious.

isherman gravatar image isherman  ( 2012-07-31 10:36:24 -0600 )edit

@JonMace, @ipso: I was nervous about the stability and maintenance of ROSBridge, but I was only aware of v1. v2 looks like it could do the trick. Exciting!

isherman gravatar image isherman  ( 2012-07-31 10:41:05 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted
4

answered 2012-07-27 13:29:30 -0600

updated 2012-07-29 09:59:11 -0600

Rosbridge is a perfect solution. You can write a client that connects to rosbridge using any language that has a websocket library. Websocket is a poor choice of name for the protocol because it implies use by web browsers only. Sure, it was designed for web browsers, but the protocol itself is just a layer on top of TCP and provides a number of useful properties.

As for the rosbridge ROS node - we have just released rosbridge v2.0 beta, which is the 'industrial strength' rosbridge. It has a much more robust server implementation and a more well defined protocol. We haven't yet officially released v2.0 on ROS.org so the information on the ROS wiki is still for v1.0. The most up to date resource is rosbridge.org (for both v1.0 and v2.0 of rosbridge). The source code repository for v2.0 is here.

To give you the gist of how rosbridge works, you can check out some example rosbridge commands on this page.

To actually write a client that connects to rosbridge, all you need is a websockets library. For example, the following python client connects and calls a ROS service. In the example we use the ws4py websocket client library.

from json import dumps
from ws4py.client.threadedclient import WebSocketClient

class GetLoggersClient(WebSocketClient):

     def get_loggers(self):
         msg = {'op': 'call_service', 'service': '/rosout/get_loggers'}
         self.send(dumps(msg))

     def opened(self):
         print "Connection opened..."
         self.get_loggers()

     def closed(self, code, reason=None):
         print code, reason

     def received_message(self, m):
         print "received", m

if __name__=="__main__":
     try:
         ws = GetLoggersClient('ws://127.0.0.1:9090/')
         ws.connect()
     except KeyboardInterrupt:
         ws.close()
edit flag offensive delete link more
1

answered 2012-07-27 09:59:40 -0600

ipso gravatar image

updated 2012-07-27 10:02:28 -0600

You mention rosbridge, any reason you can't use that to interface with your Ubuntu machine? Seems like it would work, judging from its wiki page:

rosbridge allows dynamic socket and web-socket based access to the full capabilities of ROS. A lightweight binding to Javascript for websocket-capable web browsers is included (ros.js), but access from any language supporting sockets and JSON is easy.

seems like 'any language' will do.

Sort of like what ROSBridge tries to do for a web client

And afaict it isn't limited to web clients.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2012-07-27 09:23:58 -0600

Seen: 1,706 times

Last updated: Jul 29 '12