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

Can ROS messages be exchanged between a nonROS machine ?

asked 2018-06-28 08:15:57 -0500

aks gravatar image

Currently i am working with ROS2 which is based on DDS. So I have ROS2 installed on 1 machine and on the other I have a DDS implementation. So basically I can exchange messages through DDS and I do not explicitly need to have ROS2 also installed on the 2nd machine.

Could tihs be also possible with ROS 1 ? Since ROS is based on a Master/ Slave system, could it be possible somehow to exchange info between a nonROS machine by exchanging IP address or something ?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2018-06-28 09:01:01 -0500

lucascoelho gravatar image

Yes, it is possible. One of the most widely used methods for accomplishing this is using rosbridge. There are lots of clients for rosbridge in many different programming languages. So, you can run rosbridge_server in your ROS1 computer and then use a rosbridge_client of your preference in your non-ROS computer.

edit flag offensive delete link more


Thank you. I will study more about it and come back to you :)

aks gravatar image aks  ( 2018-06-28 10:09:19 -0500 )edit

Just out of curiosity, can the non ROS machine also be a Windows machine and does both the machines need to be in the same network to communicate like in ROS2 ? @lucascoelho

aks gravatar image aks  ( 2018-06-28 14:37:42 -0500 )edit

Not sure if I understood you, but ROS1 does not runs in Windows natively. You can use a rosbridge client, as I said, in the Windows side to communicate with your ROS machine. And yes, using rosbridge they don't need to be in the same network (assuming no firewalls). Let me know if it was clear.

lucascoelho gravatar image lucascoelho  ( 2018-06-28 15:39:26 -0500 )edit

I guess I understood it. The only unclear point is that do i then need to implement socket programming in my ROS node as well ? e.g. I have a ROS node communicating with ROS server and the node is exchanging messages with a Windows based client. Could you direct me to some examples or literature ?

aks gravatar image aks  ( 2018-06-28 15:46:41 -0500 )edit

If you read the installation section here, it states that a working ROS installation is required within the network. So now I am a bit confused. @lucascoelho could you explain the difference between what you said and this statement ?

aks gravatar image aks  ( 2018-06-28 15:58:08 -0500 )edit

Since you want to use a python client and you have opted for roslibpy, you need both rosbridge and tf2_web_republished. In this link you can find installation and run instructions

lucascoelho gravatar image lucascoelho  ( 2018-06-28 18:01:02 -0500 )edit

Here is an example on how to read a topic using roslibpy

lucascoelho gravatar image lucascoelho  ( 2018-06-28 18:01:50 -0500 )edit

@lucascoelho : As soon as I run the tf2_web_republisher, it gives me a segmentation fault(core dumped) error. I am using ROS Kinetic. Did you ever face this problem ?

aks gravatar image aks  ( 2018-09-26 10:48:44 -0500 )edit

answered 2018-06-28 18:34:42 -0500

tfoote gravatar image

This is a bit of an ill posed question as a "nonROS" machines are hard to define. As soon as you install or implement something that talks the ROS protocol it then makes it a non-"nonROS", or just a ROS machine.

As with any protocol you can implement it in different ways or with different languages. This is very clear as we have pure C/C++ implementations, pure python impelementations and pure java implementations to name a few.

If you were to implement on top of your DDS library enough to talk to the ROS system, you would effectively be writing a partial ROS 2 Client Library like the existing rclpy or rclcpp. Thus you wouldn't be using the most common implementation but you'd still be talking the ROS(2) protocol and thus from your question you'd be a "ROS machine". To that end though I would

It's also quite possible to bridge to another communication protocol such as a websockets based stream (ala rosbridge) or any other custom protocol (such as rosserial)

These are not talking the pure ROS protocol but are designed to be able to communicate ROS messages over another channel.

So for any generic machine that you want to communicate with a ROS system you can choose to use an existing ROS client library and integrate that into your system, implement your own client library(or partial implementation for the subset of features you need), or bridge to another protocol and forward messages back and forth.

From a practical standpoint it's is quite possible to communicate with ROS 2 just using pure DDS messages. But in reality you will effectively need to implement all of the functionality built into the existing client libraries, validate and test them. We've worked hard and have extensive testing to validate and cross validate all the of the existing implementations. There are a lot of corner cases under the hood that can catch you off guard until you get into the nuts and bolts of the implementation. In most cases it will be noteably more work to reimplement it all versus installing the ROS2 libraries necessary and integrating them. If you want to use a different DDS vendor there is an abstraction at the middleware level to allow adding support for a different vendor. And there are quite a few projects in the community for adding new language bindings on top of the core impelementation that the language specific implementations can leverage.

edit flag offensive delete link more


@tfoote : Thank you for such a detailed explanation. I implemented DDS as I could not use ROS2 API's for my use case as to use a ROS2 API, there should be full ROS2 installation on the same machine which shouldnt be the case in the project i am working on else my first try was always using ROS2 APIs

aks gravatar image aks  ( 2018-06-29 10:49:01 -0500 )edit

Question Tools



Asked: 2018-06-28 08:15:57 -0500

Seen: 786 times

Last updated: Jun 28 '18