Networking TurtleBot 3 and the remote computer

The TurtleBot 3 and remote computer must be configured to set up communications on the same network. Each computer's IP address should be identified and used to establish the ROS environment variable for the communication system. The following figure shows how these variables are identified:

Networking TurtleBot 3 and the remote computer

TurtleBot 3 and remote computer ROS network configuration

Note that the TurtleBot 3 and the remote computer identify the remote computer IP address as the ROS_MASTER_URI variable. This setup is different than that for the ROS variables for TurtleBot 2. For TurtleBot 3, the Master resides on the remote computer.

The next two sections will step through the network configuration setup process.

Remote computer network setup

The remote computer should be set to connect to the same network as the TurtleBot 3. Determine the remote computer's IP address on that network by typing:

$ ifconfig

From the screen output, look for the IP address of this computer on the wireless network:

wlan0     Link encap:Ethernet HWaddr 9c:b6:d0:0f:6f:89
          inet addr:192.168.11.139  Bcast:192.168.11.255  Mask:255.255.255.0

The IP address for our remote computer on our Buffalo router network is 192.168.11.139, as shown in the preceding output. Your IP address will be different.

With the IP addresses of the remote computer, use the following commands with your specific IP addresses and assign the ROS_MASTER_URI and ROS_HOSTNAME variables:

$ export ROS_MASTER_URI=http://<IP address of remote computer>:11311
$ export ROS_HOSTNAME=<IP address of remote computer>

We recommend that you add these commands to the .bashrc script file of the remote computer so the ROS environment variables will always be set correctly. Use your favorite editor to add these lines to the .bashrc script, then save the file and run the following command:

$ source ~/.bashrc

To check that the ROS environment variables are set correctly, type:

$ env | grep ROS

Next, it is necessary to establish the TurtleBot 3 network configuration.

TurtleBot 3 network setup

While the Raspberry Pi is still connected to the monitor, keyboard, and mouse, set up TurtleBot's network configuration to always select the desired network on power up. Be sure that the Raspberry Pi is connected to the network that you plan to use for communication from the remote computer.

On the main menu of Ubuntu MATE, find the System option, pull down the menu and select Preferences. From the Preferences option, select Internet and Network, then Network Connections. Select the network connection you will be using and hit the Edit button. A pop-up window should appear. Make sure that the General tab is selected. A screen similar to the following screenshot should be displayed:

TurtleBot 3 network setup

TurtleBot 3 network setup

Check the top two checkboxes in this window to set the network to always connect to your desired network. Then click on the Save button in the lower-right corner. Other network connections can be disabled by unchecking these two boxes for those network connections. Then close the network connection window.

Next, find the IP address of TurtleBot 3 using the following command:

$ ifconfig

From the screen output, look for the wlan settings similar to the following:

wlan0     Link encap:Ethernet HWaddr b8:27:eb:b4:87:c4
          inet addr:192.168.11.127  Bcast:192.168.1.255  Mask:255.255.255.0

The IP address for our TurtleBot 3 on our Buffalo router network is 192.168.11.127, as shown in the preceding output. Your IP address will be different.

With the IP addresses of the remote computer and the TurtleBot, use the following commands with your specific IP addresses and assign the ROS_MASTER_URI and ROS_HOSTNAME variables:

$ export ROS_MASTER_URI=http://<IP address of remote computer>:11311
$ export ROS_HOSTNAME=<IP address of TurtleBot 3>

We recommend that you modify these commands in the .bashrc script file for TurtleBot 3 so the ROS environment variables will always be set correctly. To open this script, type:

$ pluma ~/.bashrc

Look for the two lines at the end of the .bashrc script that assign the ROS_MASTER_URI and ROS_HOSTNAME variables. Change the word localhost to the appropriate IP address indicated previously. Save and close the script and then, run the following command:

$ source ~/.bashrc

To check that the ROS environment variables are set correctly, type:

$ env | grep ROS

One last check on the TurtleBot 3 will finish setting up the SSH connection from the Raspberry Pi.

SSH connection

While the Raspberry Pi is still connected to the monitor, keyboard, and mouse, check to make sure that you can SSH from the remote computer to the TurtleBot 3 SBC. On the Raspberry Pi, use the following command to check the SSH status:

$ sudo service ssh status

The output should show Active: active (running) when SSH is working properly. If the screen output lists Active: inactive (dead), the following command will restart the SSH services:

$ sudo service ssh restart

This command is only a temporary fix for the problem. To have SSH work automatically on boot up, use the following command:

$ sudo systemctl enable ssh

Next, the communication between the TurtleBot 3 and the remote computer will be verified.

Testing the SSH communication

To test the connection between your remote computer and TurtleBot 3, try to establish an SSH connection from your remote computer to the TurtleBot 3 by typing the following command on your remote computer:

$ ssh <username>@<IP address of TurtleBot>

For the authors' Raspberry Pi, the user account was set up with the username turtlebot3. The username for your Raspberry Pi can be found with the whoami command.

Troubleshooting your network connection

If an SSH connection cannot be established, check the following details:

  • Both the Raspberry Pi and remote computer are set to the same network
  • All network setup for the Raspberry Pi and remote computer were completed as described in the Remote computer network setup and TurtleBot 3 network setup sections
  • The SSH service on the Raspberry Pi is set to automatically boot up on power up

If all of these troubleshooting steps have been completed, try to ping the TurtleBot with the following command:

$ ping <IP address of TurtleBot>

If the ping communication can be established but SSH does not work, then it is recommended to remove and re-install the openssh software on the Raspberry Pi. The following commands should be typed on the Raspberry Pi:

$ sudo apt-get remove openssh-client openssh-server
$ sudo apt-get install openssh-client openssh-server

Retry SSHing to the TurtleBot 3. When you have successfully established a communication link, the window prompt of the TurtleBot Raspberry Pi will be seen on the remote computer.

When you are able to SSH from the remote computer to the TurtleBot 3, proceed to the next section to operate TurtleBot 3 with the keyboard. You will no longer need the monitor, keyboard, and mouse connected to your TurtleBot 3.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset