Interfacing RP2 with Rosbridge_suite to another Non-Ros computer via ethernet

asked 2015-08-18 15:48:58 -0600

borias23 gravatar image

Hi everybody

I have been struggling all day to try to make things work. I am not very experience when it comes to servers etc I have ROS Indigo in my raspberry pi 2 installed with the openssh packages client and server installed. I installed rosbridge_suite and followed the first example with roslibjs ( ). I have an ethernet cable which comunicates with my computer and I have set a static Ip address on the RP2. On my computer side I have MAC and windows and ubuntu virtual machines. In the Ubuntu one I have set a static Ip two so they have bidirectional communication which I have also tested.

The thing is that when I open simple.html file on Safari(mac), chrome(windows) or Firefox(ubuntu) i cant manage to make them to communicate. I have also seen another similar post concerning Non-Ros top side connection but I couldn't manage to make it work. I have tried to connect with 8080 and 9090 ports playing with firewalls etc. In the Mac and chrome browsers I get:

[Error] WebSocket network error: No se ha podido completar la operaciĆ³n. Imposible acceder a la red (simple.html, line 0) [Log] Connection to websocket server closed. (simple.html, line 26) which means that the connection couldnt be completed and that it was impossible to connect.

and in ubuntu:

Firefox can't establish a connection to the server at wss://x.x.x.x:9090/. roslib.js:1 "Error connecting to websocket server: " error { target: WebSocket, eventPhase: 0, bubbles: false, cancelable: false, defaultPrevented: false, timeStamp: 1439929433337991, originalTarget: WebSocket, explicitOriginalTarget: WebSocket, isTrusted: true, NONE: 0, CAPTURING_PHASE: 1 } simple.html:22 "Connection to websocket server closed."

I think I might forgot to install some other software in the RP side

Thank you very much for your help I really appreciate it :D

edit retag flag offensive close merge delete


In your example it looks like you are making a wss connection instead of a ws connection: are you running rosbridge correctly with certs to use encryption? Are those certs trusted or allowed by your browsers?

rtoris288 gravatar image rtoris288  ( 2015-08-19 08:35:40 -0600 )edit

I have tried both ws and wss. I have tried connecting the RP2 directly through an ethernet cable and through a router but none worked. For the router connection I got a timeout error. I'm sorry but It's the first time that I use a websocket so Im not so familiar. What do you mean with cert trusted?

borias23 gravatar image borias23  ( 2015-08-19 08:58:24 -0600 )edit

wss is like HTTPS, it requires server-side certificates to provide encryption. In your case, you will not need them so be sure to use ws://x.x.x.x:9090. Are you able to ping the address correctly from the client?

rtoris288 gravatar image rtoris288  ( 2015-08-19 09:16:43 -0600 )edit

Hi. Yes I can ping my computer from the raspberry. In my ubuntu machine (in the computer side) I have a static address so I have a bidirectional connection with the RP2 and I can access both with ssh. Thank you for your help

borias23 gravatar image borias23  ( 2015-08-19 10:38:53 -0600 )edit

If rosbridge is running on the RP2, you will need to make sure you can ping/connect the address of the RP2 instead of the IP of the computer from the RP2. Can you update the question with what you are launching on the RP2 and what the connection line looks like in your JavaScript?

rtoris288 gravatar image rtoris288  ( 2015-08-19 12:46:17 -0600 )edit

Sorry for the delay. In the raspberrypi I am launching the roscore and all the commands that can be found in this tutorial: and in the client side I use the simple.html file. In the client side I get a timeout error

borias23 gravatar image borias23  ( 2015-08-20 06:51:31 -0600 )edit

It workeddd!!! Finally! After 3 days of constatly trying It worked! It was the firewall on the RP2 which was blocking the connection. I thought I took care of that before but aparently not. Thank you anyway for your help rtoris288 :D

borias23 gravatar image borias23  ( 2015-08-20 10:20:17 -0600 )edit