Specification of ROS_MASTER_URI and ROS_HOSTNAME
Hello everyone,
I would like to us ros for multiple robot instances, but have some doubts about the network setup. The idea is to have two robots that are communicating in a network. Each of them have seperate control packages that should run local on the robots. However they should be able to send information in the form of the rostopics topic1 and topic2. Accordingly we want to create following setup:
robot1 192.168.1.1
locally running ros-package: control1
subscribing topic2
publishing topic1
robot2 192.168.1.2
locally running ros-package: control2
subscribing topic1
publishing topic2
As we need one ros-master to control the communication, we choose 192.168.1.1 as master. Therefore we execute locally on robot 1:
export ROS_MASTER_URI=http://192.168.1.1:11311
export ROS_HOSTNAME=192.168.1.1
export ROS_IP=192.168.1.1
roscore
In order to connect to the ROS-master, we execute locally on robot2:
export ROS_MASTER_URI=http://192.1.1.1:11311
export ROS_IP=192.168.1.2
export ROS_HOSTNAME=192.168.1.2
Afterwards we execute the controllers locally. My question is:
- Does the shown workflow lead to the desired behavior (controllers running locally).
- Why are the ROS_MASTER_URI and ROS_HOSTNAME defined seperately
- Why do we need to specify ROS_IP and ROS_HOSTNAME
Thanks a lot for unravel my confusion.
I hate to just point to documentation, but just to make sure you've seen it: wiki/ROS/NetworkSetup and wiki/ROS/Tutorials/MultipleMachines. That should clear up some of your questions.
Also: don't use
ROS_HOSTNAME
if you're not setting a hostname. UseROS_IP
for that. And don't use them both. If you only have IP addressing, useROS_IP
. If you have a working DNS, useROS_HOSTNAME
.