Note: This tutorial assumes that you have completed the previous tutorials: Workstation Installation.
(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

Network Configuration

Description: Get turtlebot and your workstation chatting to each other.

Keywords: turtlebot installation

Tutorial Level: INTERMEDIATE

ROS requires bidirectional networking between all computers attached to the network and does not have security built in. Using a VPN is recommended.

For more information see ROS/NetworkSetup and ROS/EnvironmentVariables

For this tutorial you must know the IP of the netbook on TurtleBot (IP_OF_TURTLEBOT). You will also need the IP of your personal computer/workstation (IP_OF_WORKSTATION). If the hostname is properly resolved on both computers, you don't need to set this.

Ultimately you will need to configure ROS_MASTER_URI and ROS_HOSTNAME correctly with these ip addresses to ensure the ros communication channels can find each other.

Determining IP addresses

IfConfig

Get the ip addresses of both your turtlebot pc and the workstation pc (more help) .

To determine a computer's IP address and network interface in linux:

  • ifconfig

You will see something like:

  • lo        Link encap:Local Loopback  
              inet addr:127.0.0.1  Mask:255.0.0.0
              inet6 addr: ::1/128 Scope:Host
              UP LOOPBACK RUNNING  MTU:16436  Metric:1
              RX packets:6658055 errors:0 dropped:0 overruns:0 frame:0
              TX packets:6658055 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0 
              RX bytes:587372914 (587.3 MB)  TX bytes:587372914 (587.3 MB)
    
    wlan1     Link encap:Ethernet  HWaddr 48:5d:60:75:58:90  
              inet addr:10.0.129.17  Bcast:10.0.129.255  Mask:255.255.254.0
              inet6 addr: fe80::4a5d:60ff:fe75:5890/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:101983 errors:0 dropped:0 overruns:0 frame:0
              TX packets:37244 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:49326141 (49.3 MB)  TX bytes:7588044 (7.5 MB)
  • the network interface for the wireless card is wlan1

  • the IP address of the computer is 10.0.129.17

Confirm Connectivity

Ensure that you can ping between machines (more help) .

Ping from the laptop to the workstation and back by IP, or fully resolved hostname. From TurtleBot laptop ping workstation/desktop using IP_OF_WORKSTATION

  • ping IP_OF_WORKSTATION

    Note: Replace IP_OF_TURTLEBOT with actual IP address of TurtleBot that was determined in previous step.

From workstation ping TurtleBot using IP_OF_TURTLEBOT

  • ping IP_OF_TURTLEBOT

Turtlebot Setup

The instructions differ depending on whether you have a prepared usb derived release, from debs, or from source.

Live Usb Installation

Debs Installation

Source Installation

Live USB Installation

> echo export ROS_HOSTNAME=IP_OF_TURTLEBOT >> ~/.bashrc
> sudo sh -c 'echo export ROS_HOSTNAME=IP_OF_TURTLEBOT >> /etc/ros/setup.sh'

.

Depending on your distributor or the usb iso, you should not need to do anything. The turtlebot service will automagically detect when your network comes up and down and configure variables appropriately.

Deb Installation

You should export the variables inside your work space setup script.

> echo export ROS_MASTER_URI=http://IP_OF_TURTLEBOT:11311 >> ~/.bashrc
> echo export ROS_HOSTNAME=IP_OF_TURTLEBOT >> ~/.bashrc

Finally, bring down turtlebot if you have already launched it and relaunch.

Source Installation

You should export the variables inside your workspace setup script.

> echo export ROS_MASTER_URI=http://IP_OF_TURTLEBOT:11311 >> ~/turtlebot/devel/setup.sh
> echo export ROS_HOSTNAME=IP_OF_TURTLEBOT >> ~/turtlebot/devel/setup.sh

Finally, bring down turtlebot if you have already launched it and relaunch.

Workstation Setup

You should export the variables inside your workspace setup script. Note that the meaning of the ROS_MASTER_URI changes here - the master is in the turtlebot!

> echo export ROS_MASTER_URI=http://IP_OF_TURTLEBOT:11311 >> ~/.bashrc
> echo export ROS_HOSTNAME=IP_OF_WORKSTATION >> ~/.bashrc

Verification

The following section is not strictly necessary. However, if there is a problem with the ROS networking setup between the TurtleBot and workstation, it will be easier to identify it early.

Be sure to relaunch turtlebot if you have manually set these variables.

Verify from TurtleBot to ROS master

On TurtleBot laptop, make sure it can contact ROS master by running:

> rostopic list

If you get the following error:

ERROR: Unable to communicate with master!

If you see this, your turtlebot has not yet been started - refer to the TurtleBot Bringup tutorial.

Also make sure ROS_MASTER_URI is set correctly

> echo $ROS_MASTER_URI

Verify between ROS nodes on TurtleBot

In a new terminal on TurtleBot laptop run:

> rostopic echo /diagnostics

If you don't get a response a warning like

WARNING: topic [/diagnostics] does not appear to be published yet

Check that ROS_HOSTNAME is set correctly on TurtleBot laptop.

> echo $ROS_HOSTNAME

Verify from workstation to TurtleBot

Open a new command line terminal on workstation and run:

> rostopic list

If you don't see list of topics check the value of ROS_MASTER_URI.

On workstation run:

> rostopic echo /diagnostics

If you don't get a warning that topic has not been published, then verify that ROS_HOSTNAME is set correctly on the TurtleBot laptop.

Verify from TurtleBot to Workstation

Finally, check that TurtleBot laptop can get data from ROS node running on workstation.

On workstation run:

> rostopic pub -r10 /hello std_msgs/String "hello"

On TurtleBot run

> rostopic echo /hello

The message "hello" begin printed about 10 times a second. If not, check the ROS_HOSTNAME setting on the workstation computer.

What Next?

Wiki: turtlebot/Tutorials/hydro/Network Configuration (last edited 2013-11-11 22:57:31 by Cosmo Harrigan)