How do you use UDP to communicate between computers?

Do you need to give information to your roscore that you can't transport with rosnodes?

UDP- Sockets

Author: Lucian Fairbrother

Do you need to give information to your roscore that you can't transport with rosnodes?

You may have trouble running certain libraries or code in your vnc environment, a UDP connection could allow you to run it somewhere else and broadcast it into your vnc. There are many reasons this could happen and UDP sockets are the solution. In our project we used multiple roscores to broadcast the locations of our robots. We send the robot coordinates over a UDP socket that the other roscore can then pickup and use.

image

Simple Sender

Here is an example of the most basic sender that you could use for your project. In this example the sender sends out a string to be picked up:

Simple Receiver

You need to run a receiver to pickup the information that your sender put out

My Sender

Often times you may want to create a sender node that will take information from your ROS environment and publish it to the outside world. Here is an example of how I went about doing this.

My Receiver

And here is the receiver we created to handle our sender

Overall UDP-sockets aren't very difficult to make. Ours simplified the complexity of our project and helped build modularity. Overall this receiver and sender acts as another Ros publisher and subscriber. It has the same function it instead builds a metaphorical over-arching roscore for both roscores the sender and receiver live in.

Last updated

Was this helpful?