Is it possible to run the Rosbridge as standalone Websocket-Server?

asked 2021-06-28 12:39:32 -0600

Instead of running the rosbridge-suite as a ROS 2-node I'd like to run it as standalone service on a cloud instance that my robot connects to. So ideally I would have a ROS 2-node that gets the domain/IP of my server instance in the cloud where I then run the WebSocket-Server so a browser can connect to that as well.

Only quick workaround for ROS-1 that I can think of is that I run a second roscore in the cloud and I code a custom ros-node on the robot so I can forward everything I need from the local roscore on the robot to the cloud and then to a WebServer and from there to the browser of the user but that will not work for ROS 2 because there is no ROS master with a fixed IP I could connect to.

Is there another way or do I need to build my own ros-node that connects to a WebServer that I build as alternative solution?

edit retag flag offensive close merge delete


Is ROS necessary on the cloud server? Does something like the websockets python package suffice?

pvl gravatar image pvl  ( 2021-06-29 02:44:36 -0600 )edit

Yes, that would be another alternative solution. But it would be something where I have to program the server-part myself. Instead of python-websockets I would probably build something with TypeScript ontop of express and its WebSocket implementation or use aiohttp for Python but I am looking for a solution that I can just use without the need to code the protocol and just have a high-level api, like roslibpy or roslib.js but as a server, not a client. If there is no solution yet I will start a new project and build that...

brean gravatar image brean  ( 2021-06-29 03:05:47 -0600 )edit

I am not sure I understand the problem correctly. Do you want to have a remote websocket server with custom messages/interface. Inside the ROS node you can connect to that, but the connection is separate from ROS. Or do you want to access ROS message/service/actions remotely using ros_bridge?

pvl gravatar image pvl  ( 2021-06-29 05:00:51 -0600 )edit

I want to access my robot from the web. To simplify network issues I like to run roswebbridge in the cloud because I don't want to run a websocket-server on the robot (its IP can change and firewall might get tricky, so I think it makes sense to run the websocket-server standalone in the cloud).

I don't want a custom message/interface but I think I need to build one because there is nothing that allows me to access the ROS-messages/actions/services remotely as standalone solution (the ros-websuite runs as a ros node, so it has to run on the robot for ros-2 or with a second ros1-roscore in the cloud that I forward the robot data to).

brean gravatar image brean  ( 2021-06-29 05:59:57 -0600 )edit

Thank you, that clarifies the intent. You could also make a custom client that allows the server to connect to ros_bridge. It can share the robot's IP address for example. That might save you reimplementing the ros_bridge solution. Another possible solution might be to give the robot a static IP address. The cannot comment on the firewall rules, because they are highly situational.

pvl gravatar image pvl  ( 2021-06-29 06:12:32 -0600 )edit

Thank you. So I think my lowest-effort option is to run ros2 on the robot, and another ros2-instance on the cloud that also runs ros-webbridge so I can run roslibpy on the robot to forward my local robot topics/actions/services from the robot to the cloud and also connect to that cloud instance from a browser using roslib.js.

brean gravatar image brean  ( 2021-06-29 06:26:45 -0600 )edit