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

Revision history [back]

click to hide/show revision 1
initial version

You can't set ROS_IP to the IP of another host. That's doesn't work. ROS_IP and ROS_HOSTNAME describe the host your setting them on. Only ROS_MASTER_URI can point to another host.

And you don't need ROS_IP and ROS_HOSTNAME. If you have working DNS for all participating hosts, use ROS_HOSTNAME, if you don't, use ROS_IP.

I have 2 devices one is the publisher(Device B | 169.254.1.22) is on ros1 and on the subscriber side which is the second device(Device A | 169.254.1.21)

[..]

Below is the exports I tried On Device A terminal

export ROS_MASTER_URI=http://169.254.1.22:11311
export ROS_HOSTNAME=169.254.1.22
export ROS_IP=169.254.1.22

You can't set ROS_IP to the IP of another host. That's doesn't work. ROS_IP and ROS_HOSTNAME describe the host your setting them on. Only ROS_MASTER_URI can point to another host.

And you don't need ROS_IP and ROS_HOSTNAME. If you have working DNS for all participating hosts, use ROS_HOSTNAME, if you don't, use ROS_IP.

I have 2 devices one is the publisher(Device B | 169.254.1.22) is on ros1 and on the subscriber side which is the second device(Device A | 169.254.1.21)

[..]

Below is the exports I tried On Device A terminal

export ROS_MASTER_URI=http://169.254.1.22:11311
export ROS_HOSTNAME=169.254.1.22
export ROS_IP=169.254.1.22

You can't set ROS_IP to the IP of another host. That's doesn't work. ROS_IP and ROS_HOSTNAME describe the host your setting them on. on (ie: on "Device A" you set them to configure "Device A"s properties). Only ROS_MASTER_URI can point to another host.

And you don't need ROS_IP and ROS_HOSTNAME. If you have working DNS for all participating hosts, use ROS_HOSTNAME, if you don't, use ROS_IP.

I have 2 devices one is the publisher(Device B | 169.254.1.22) is on ros1 and on the subscriber side which is the second device(Device A | 169.254.1.21)

[..]

Below is the exports I tried On Device A terminal

export ROS_MASTER_URI=http://169.254.1.22:11311
export ROS_HOSTNAME=169.254.1.22
export ROS_IP=169.254.1.22

You can't set ROS_IP to the IP of another host. That's doesn't work. ROS_IP and ROS_HOSTNAME describe the host your setting them on (ie: on "Device A" you set them to configure "Device A"s properties). Only ROS_MASTER_URI can point to another host.

And you don't need both ROS_IP and ROS_HOSTNAME. If you have working DNS for all participating hosts, use ROS_HOSTNAME, if you don't, use ROS_IP.

I have 2 devices one is the publisher(Device B | 169.254.1.22) is on ros1 and on the subscriber side which is the second device(Device A | 169.254.1.21)

[..]

Below is the exports I tried On Device A terminal

export ROS_MASTER_URI=http://169.254.1.22:11311
export ROS_HOSTNAME=169.254.1.22
export ROS_IP=169.254.1.22

You can't set ROS_IP to the IP of another host. That's doesn't work. ROS_IP and ROS_HOSTNAME describe the host your setting them on (ie: on "Device A" you set them to configure "Device A"s properties). Only ROS_MASTER_URI can point to another host.

And you don't need both ROS_IP and ROS_HOSTNAME. If you have working DNS for all participating hosts, hosts (ie: all hosts running ROS nodes can resolve the hostname of all other hosts running ROS nodes), use ROS_HOSTNAME, if you don't, use ROS_IP.

I have 2 devices one is the publisher(Device B | 169.254.1.22) is on ros1 and on the subscriber side which is the second device(Device A | 169.254.1.21)

[..]

Below is the exports I tried On Device A terminal

export ROS_MASTER_URI=http://169.254.1.22:11311
export ROS_HOSTNAME=169.254.1.22
export ROS_IP=169.254.1.22

You can't set ROS_IP to the IP of another host. That's doesn't work. ROS_IP and ROS_HOSTNAME describe the host your setting them on (ie: on "Device A" you set them to configure "Device A"s properties). Only ROS_MASTER_URI can point to another host.

And you don't need both ROS_IP and ROS_HOSTNAME. If you have working DNS for all participating hosts (ie: all hosts running ROS nodes can resolve the hostname of all other hosts running ROS nodes), use ROS_HOSTNAME, if you don't, use ROS_IP.


Edit:

Below is the exports I tried On Device A terminal

export ROS_MASTER_URI=http://169.254.1.22:11311
export ROS_HOSTNAME=169.254.1.21
export ROS_IP=169.254.1.21

On Device B terminal

export ROS_MASTER_URI=http://169.254.1.21:11311
export ROS_HOSTNAME=169.254.1.22
export ROS_IP=169.254.1.22

This may have been unclear, but you typically only start a single roscore (it's possible to start more, but that's advanced usage, which I don't believe you need or should try just yet).

Choose which machine will run roscore, then set ROS_MASTER_URI to point to its IP. So if "device A" is going to run roscore, set ROS_MASTER_URI on "device B" to http://169.254.1.21:11311 (ie: point it to "device A"). Now on the other host (ie: the one not running roscore), set ROS_MASTER_URI to point to itself, not to the other host.

And as I wrote earlier: you don't need both ROS_IP and ROS_HOSTNAME. Use ROS_IP (unless you have a working DNS server).

I have 2 devices one is the publisher(Device B | 169.254.1.22) is on ros1 and on the subscriber side which is the second device(Device A | 169.254.1.21)

[..]

Below is the exports I tried On Device A terminal

export ROS_MASTER_URI=http://169.254.1.22:11311
export ROS_HOSTNAME=169.254.1.22
export ROS_IP=169.254.1.22

You can't set ROS_IP to the IP of another host. That's doesn't work. ROS_IP and ROS_HOSTNAME describe the host your setting them on (ie: on "Device A" you set them to configure "Device A"s properties). Only ROS_MASTER_URI can point to another host.

And you don't need both ROS_IP and ROS_HOSTNAME. If you have working DNS for all participating hosts (ie: all hosts running ROS nodes can resolve the hostname of all other hosts running ROS nodes), use ROS_HOSTNAME, if you don't, use ROS_IP.


Edit:

Below is the exports I tried On Device A terminal

export ROS_MASTER_URI=http://169.254.1.22:11311
export ROS_HOSTNAME=169.254.1.21
export ROS_IP=169.254.1.21

On Device B terminal

export ROS_MASTER_URI=http://169.254.1.21:11311
export ROS_HOSTNAME=169.254.1.22
export ROS_IP=169.254.1.22

This may have been unclear, but you typically only start a single roscore (it's possible to start more, but that's advanced usage, which I don't believe you need or should try just yet).

Choose which machine will run roscore, then set ROS_MASTER_URI to point to its IP. So if "device A" is going to run roscore, set ROS_MASTER_URI on "device B" to http://169.254.1.21:11311 (ie: point it to "device A"). Now on the other host (ie: the one not running roscore), set ROS_MASTER_URI to point to itself, not to the other host.

And as I wrote earlier: you don't need both ROS_IP and ROS_HOSTNAME. Use ROS_IP (unless you have a working DNS server).

With roscore on "device A", we'd end up with:

  • device A

    export ROS_MASTER_URI=http://169.254.1.21:11311
    export ROS_IP=169.254.1.21
    
  • device B

    export ROS_MASTER_URI=http://169.254.1.21:11311
    export ROS_IP=169.254.1.22