One of the powerful things about ROS is that it allows distribution of nodes (computation processes) over more than one computer system. This can be for convenience (eg., you can run the Rviz visualization node on your workstation with a nice big monitor, while roscore and other nodes are running on a mobile robot), or for sharing CPU workload.
To make this work, you need to setup ROS networking between the systems; this page outlines how to setup networking between a mobile robot (in our case, Oculus Prime) and a workstation on the same LAN.
First, install Chrony on both machines to synchronize time:
$ sudo apt-get install chrony
$ sudo ntpdate ntp.ubuntu.com
The robot will typically have roscore
running on it, so it be the MASTER system. Define ROS_HOSTNAME by editing your robot’s regular user ‘~/.bashrc
’ file, and add the following line:
ROS_HOSTNAME=[robot_hostname].local
(Replace '[robot_hostname]'
with the robot’s hostname, which is usually 'prime'
for pre-configured systems). Then, from a command prompt on the robot, do:
$ source ~/.bashrc
Then, make sure the robot knows how to map the IP address of the workstation hostname, by adding a line to your ‘/etc/hosts
’ file. Eg.:
192.168.0.99 workstation_hostname
(Replace the numerical address and ‘workstation_hostname’ with the LAN ip address and actual hostname of the workstation. You’ll need to be root to edit the file.)
On the remote workstation, add the following lines to your ‘~/.bashrc
’ file:
ROS_HOSTNAME=[workstation_hostname].local
ROS_MASTER_URI=http://[robot_hostname]:11311
Replacing [workstation_hostname] and [robot_hostname] with appropriate values. Then do:
$ source ~/.bashrc
Again, make sure the workstation knows how to map the IP address of the robot hostname, by adding a line to your ‘/etc/hosts
’ file. Eg.:
192.168.0.99 robot_hostname
(Replace the numerical address and ‘robot_hostname’ with the LAN ip address and actual hostname of the robot.)
NEXT: Tutorial: Navigation Using Rviz