[Documentation] [TitleIndex] [WordIndex

One Way Broadcasting Issues

Problem

You are trying to connect two machines and finding the pubsub communications only go one way (echo from one side works, but reversing the communication, it fails on the other side).

Ros nodes generally need some help providing the correct information about which interface they are operating on to the ros master. It probably could be smarter than it is, but if you use the following, it will help roscpp nodes resolve to each other.

Solution

Using IP Addresses

If you have fixed ip addresses, set the ROS_IP variable on both machines and make sure you use the ip addresses for ROS_MASTER_URI as well.

Master (192.168.1.100):

export ROS_MASTER_URI=http://localhost:11311
export ROS_IP=192.168.1.100

Client (192.168.1.101)

export ROS_MASTER_URI=http://192.168.1.100:11311
export ROS_IP=192.168.1.101

Using Hostnames

Useful if you have dhcp settings, or you are spanning multimaster across several network interfaces.

Master (foo):

export ROS_MASTER_URI=http://foo:11311
export ROS_HOSTNAME=foo

Client (192.168.1.101)

export ROS_MASTER_URI=http://foo:11311
export ROS_HOSTNAME=bar

If you're doing this with static ips, make sure the hostnames are stored in both machine's host's files (/etc/hosts or C:\WINDOWS\system32\drivers\etc\hosts.

Master:

192.168.1.101 bar

Client

192.168.1.100 foo

OR ensure they are being served by your lan's DNS Server.

Other

This does not work for a virtual machine (e.g. virtualbox) running NAT. Use bridged networking instead.

See also:


2024-11-23 17:59