Ask Your Question
0

Is it possible with ROS2 to send and recieve UDP messages to a certain IP address ?

asked 2018-05-24 09:37:43 -0500

aks gravatar image

updated 2018-05-25 02:00:52 -0500

Would it be possible to send and recieve ROS2 messages to a certain ip address ?

e.g. I have a ROS2 listener node which can subscribe messages from a certain IP address and then do some calculations and publish the message to the same IP address.

NOTE : THE OTHER SYSTEM IS NOT A ROS NODE RATHER ANOTHER TOOL.

EDIT:

I have attached a picture to make it understand better.image description Basically it is ROS2 instead of ROS. There is one node in ROS2 performing some calculations with the help of the values coming from another function that is my own simulation tool. Now i want to exchange data between ROS2 and the simulation tool through DDS. In the tool there is a possiblity to integrate any external tool (in this case ROS2) through the python code. What is the best aproach to do this ?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-05-24 13:00:12 -0500

tfoote gravatar image

updated 2018-05-25 12:56:52 -0500

tldr: In general you can run a process on a remote but routeable IP that can subscribe to a message, process the data, and then publish a follow up message. That is the standard way that ROS nodes operate.

Your question is not clear and has some conflicting statements.

If you define a ROS2 message as a data structure you can send it to any address using your own custom UDP data protocol.

If you want to send a ROS2 message using the ROS2 protocols the far end would be considered a ROS2 node at that point. So your assertion that the other end is not a ROS node is conflicting. Any executable can be turned into a ROS2 node by just using the ROS2 libraries for IO inside your process. ROS2 nodes can be run on a machine with a specific IP, but you cannot send things to the specific address it goes through the topic discovery and connections.

Edit with new info:

It is possible to interact with a ROS2 system by sending pure DDS messages. ROS2 just defines conventions for using DDS. If you publish the right datatype on the right topic it will be compatible with ROS2 listeners. And you can do the same for subscribing. The .msg files automatically generate .idl files that you can used for understanding the DDS datatypes natively.

However besides very trivial cases you will have to do a lot of the implementations of the ROS2 standards which means implementing a large part of the ROS2 client library implementations and I'd encourage you to consider just using the client libraries in your "non ROS2" process.

In particular I don't believe there's any commonly used python DDS implementation for you to leverage. But we do provide a python implementation of the ROS2 API in rclpy that you can import inside your python tool to interact with ROS2 directly.

edit flag offensive delete link more

Comments

@tfoote I have updated the question. Maybe now it is better to understand.

aks gravatar imageaks ( 2018-05-25 02:01:27 -0500 )edit

@tfoote where can I find this python implementation which i could import in my tool ?

aks gravatar imageaks ( 2018-06-04 04:48:24 -0500 )edit

It's rclpy The rclpy demo is probably a good place to start.

tfoote gravatar imagetfoote ( 2018-06-04 05:00:38 -0500 )edit

@tfoote a doubt regarding the orginal question...how is it possible to make the ros nodes send and recieve data to/from a particular IP address and port number (through UDP) ? Is there an example appliaction for that ?

aks gravatar imageaks ( 2018-06-04 05:07:04 -0500 )edit

@tfoote could you explain more about the solution? I have a same problem, I have ROS2 on my Windows machine and I want to sent message from ROS2 windows machine to another machine which has Ubuntu as a operation system on it. Both PC are in the same network. I also have installed FASTRTPS on my Linux machine. BUT I do not know how can I have a communication from one machine to another machine?

Look forward to hearing from you

golizheh_66 gravatar imagegolizheh_66 ( 2019-10-10 10:06:31 -0500 )edit

Please don't ask a question in an answer. Your setup is not the same. Please ask your own question with a full explaination of how to reproduce it so someone can understand your situation fully to be able to try to offer advice. https://wiki.ros.org/Support

tfoote gravatar imagetfoote ( 2019-10-10 13:19:09 -0500 )edit

You can use a custom transport in your ROS node. You will have to implement that transport yourself ROS does not provide that capability, but it doesn't prevent you from doing that within the node.

tfoote gravatar imagetfoote ( 2019-10-10 13:20:29 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2018-05-24 09:37:43 -0500

Seen: 419 times

Last updated: May 25 '18