TurtleBot Networking Setup
Contents
- Confirm Connectivity
- ROS_MASTER_URI
- ROS_HOSTNAME
- ROS_MASTER_URI
- ROS_HOSTNAME
- Restart turtlebot service
- Verify connectivity from TurtleBot to ROS master
- Verify connectivity between ROS nodes on TurtleBot laptop
- Verify connectivity from workstation to ROS master
- Verify connectivity from workstation to TurtleBot laptop
- Verify connectivity from TurtleBot laptop to workstation
- VPN
- Alternate Network Interface
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.
Determining IP address
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
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
ROS_MASTER_URI
On TurtleBot Laptop set ROS_MASTER_URI:
echo export ROS_MASTER_URI=http://IP_OF_TURTLEBOT:11311 >> ~/.bashrc
Note: Replace IP_OF_TURTLEBOT with actual IP address of TurtleBot that was determined in previous step.
ROS_HOSTNAME
On the TurtleBot laptop set ROS_HOSTNAME to IP address of laptop.
echo export ROS_HOSTNAME=IP_OF_TURTLEBOT >> ~/.bashrc
Workstation Setup
ROS_MASTER_URI
The ROS master runs on the TurtleBot laptop, so on workstation set ROS_MASTER_URI to point to TurtleBot laptop:
echo export ROS_MASTER_URI=http://IP_OF_TURTLEBOT:11311 >> ~/.bashrc
ROS_HOSTNAME
On workstation set ROS_HOSTNAME to match IP address of workstation.
echo export ROS_HOSTNAME=IP_OF_WORKSTATION >> ~/.bashrc
Verify ROS connectivity
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.
Restart turtlebot service
After changing ROS_MASTER_URI and ROS_HOSTNAME on laptop, restart turtlebot server so it will use new settings. Open new command line terminal on TurtleBot laptop and run:
sudo service turtlebot stop sudo service turtlebot start
Verify connectivity 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!
Check that the turtlebot service is started
sudo service turtlebot start
Also make sure ROS_MASTER_URI is set correctly
echo $ROS_MASTER_URI
Verify connectivity between ROS nodes on TurtleBot laptop
In 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 connectivity from workstation to ROS master
Open new command line terminal on workstation and run:
rostopic list
If you don't see list of topics check value of ROS_MASTER_URI.
Verify connectivity from workstation to TurtleBot laptop
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 TurtleBot laptop.
Verify connectivity from TurtleBot laptop 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 laptop 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.
Troubleshooting
VPN
For convenience and security it is often recommended to setup up a VPN to which both your robot and workstation can connect. If you do so, set the ROS_HOSTNAME to be the address on the VPN. Once you have setup the VPN you can set the turtlebot service to use it by following the instructions for an alternate network interface.
Alternate Network Interface
Check - this may not be functional for groovy |
If you are using a different network adapter besides wlan0 (the default wireless), such as the ethernet port or a USB dongle, expand the instructions below, regardless of whether you are using a VPN service.
Do the following
roscd turtlebot_bringup/upstart sudo install.sh tun0
If you get an error that looks like:
sudo: install.sh: command not found
try typing:
sudo ./install.bash tun0
If you are using openvpn, the device is setup as tun0.
If you are using a wireless dongle or ethernet device identify the network interface you want to use and replace tun0 with it. Other common alternatives would be wlan1 and eth0.
What Next?
Bring-up TurtleBot or return to TurtleBot main page.