How to Connect to the OU TurtleBots

These instructions are designed for your use with the CS desktop computers and TurtleBot 2 mobile robots in REPF B4.

Connecting to an OU TurtleBot

The following steps should be followed to get a TurtleBot running and connected to one of the desktop computers in the lab.

  1. Check to make sure that the following are set up correctly and ready to go.
    1. TurtleBot base is turned on.
      1. Unplug the base from its power adapter and move the TurtleBot to the location where it will be used by picking up the base with two hands. Do not pick up the TurtleBot by the 3D sensor. The sensor is not a handle! Carrying the robot by the sensor risks damage to the components of the robot, including any laptop that may be carried in the tower. If the robot is damaged due to carrying the robot by the sensor, you will be responsible for the replacement cost of the damaged hardware.
      2. After you place the robot on the floor for use, turn on the power switch next to the power jack. Do not place the robot base on any elevated surface, including a desk, table, or workbench. It is too easy to knock the robot off the surface, or to have the robot unexpectedly drive off the surface, causing it to fall and become damaged. If the robot is damaged due to placement on an elevated surface, you will be responsible for the replacement cost of the damaged hardware.
    2. TurtleBot laptop is turned on, awake, and connected to WIFI@OU.
      1. Select a laptop computer that matches the base you are using.
        1. If you are using a TurtleBot with a tower in which all of the plates are black and roughly hexagonal, you must use the smaller laptops that can fit horizontally within the tower. (See 3.1 below.)
        2. If you are using a TurtleBot with a tower in which some of the plates are black hexes and some are white circles, you must use the larger laptops that will not fit horizontally within the tower of the other bases.
      2. If the laptop is not already on, open the lid and turn on using the power button.
      3. Log in using the same username and password as for the desktop computers and click on the WiFi icon near the top, right corner of the user window. Ensure that the laptop WiFi is connected to WIFI@OU, not OUGUEST, or other available WiFi networks.
      4. Open a terminal on the laptop and use the ip addr command to get the IP address of the laptop. This will be of the form 10.194.19.something, where something differs from laptop to laptop. Keep track of this IP address. It will be used below and referred to as IP_OF_TURTLEBOT. (When you see this in the commands below, don't type in the string "IP_OF_TURTLEBOT", type in the IP address you recorded for the TurtleBot laptop.)
    3. TurtleBot laptop is connected to its base via one USB cable and to its 3D sensor via a second USB cable.
      1. After you have noted the IP address of the laptop, close it up and place it into the tower of the TurtleBot horizontally on the lowest plate of the tower. If you place the laptop at a diagonal within the tower and/or on a plate other than the lowest one, you risk damaging the tower and/or the laptop. If the tower and/or laptop are damaged due to your incorrect placement of the laptop within the tower, you will be responsible for the replacement cost of the damaged hardware.
      2. After you have placed the laptop in the tower at the correct location, attach the USB cables and ensure that they are away from the floor and secure within the tower.
    4. Desktop computer is connected to the Internet via Ethernet.
      1. Ensure that the Ethernet cable is connected to the desktop computer and to its Ethernet jack in the wall.
      2. Open a terminal on the desktop and use the ip addr command to get the IP address of the desktop. This will be of the form 10.194.19.something, where something differs from desktop to desktop. Keep track of this IP address. It will be used below and referred to as IP_OF_PC. (When you see this in the commands below, don't type in the string"IP_OF_PC", type in the IP address you recorded for the desktop PC you are using.)

    At this point, everything should be set up and ready for you to start communicating between the desktop system and the laptop to control the robot.

  2. Establish a connection between the desktop and laptop.
    1. Open a terminal on the desktop computer and connect to the laptop using the ssh command as follows: ssh -Y IP_OF_TURTLEBOT.
    2. If the desktop computer reports that there is no route to host, recheck steps 1.2 and 1.3, above.

The desktop computer should now be connected to an OU TurtleBot and you should be able to start using it. Any commands you type in the terminal opened in step 2 will run on the TurtleBot laptop. Note that you can follow step 2, above, for as many terminals as you need for running code on the laptop. Some code, such as that talking to the sensors and motors directly (e.g., bringing up the TurtleBot base or connecting to the 3D sensor) should be run on the laptop. Other code, particularly that with large memory and/or computational demands such as heavy processing of data streams, substantial deliberation, or graphical displays for the user, should be run on the desktop computer instead.

Setting Up Your ROS Environment

The first time you use a given desktop or laptop, you will need to configure your ROS environment. Please perform the following steps. Note that this is for both desktops and laptops (on the robots), so that if you sit down to use these systems for the first time, you will need to carry out these instructions once on the desktop you're at and again on the laptop that you're using, but note the different options for each.

  1. Prepare a catkin workspace.
    source /opt/ros/melodic/setup.bash
    mkdir -p ~/catkin_ws/src
    cd ~/catkin_ws/
    catkin_make
    rsync -rl /usr/local/turtlebot/ .
    catkin_make
    source ~/catkin_ws/devel/setup.bash
  2. Edit your .bashrc using a text editor of your choice. Note that your .bashrc is located in your home directory (~).
    1. On a robot laptop edit the last four lines of your .bashrc to be the following.
      source /opt/ros/melodic/setup.bash
      source ~/catkin_ws/devel/setup.bash
      export ROS_MASTER_URI=http://localhost:11311
      export ROS_HOSTNAME=IP_OF_TURTLEBOT
    2. On a desktop edit the last four lines of your .bashrc to be the following.
      source /opt/ros/melodic/setup.bash
      source ~/catkin_ws/devel/setup.bash
      export ROS_MASTER_URI=http://IP_OF_TURTLEBOT:11311
      export ROS_HOSTNAME=IP_OF_PC
    After you have edited your .bashrc, you will need to source it for it to take effect in that terminal window. After that, it will automatically be sourced when new terminal windows are opened.

Things to Try

The following commands can be run in various combinations to get the TurtleBot doing things. Pick and choose to get the results you want. Note that some later commands on this list require the use of earlier commands. For example, to do navigation, you would start up the TurtleBot, start up gmapping, then start up navigation.

Using an OU TurtleBot

You must follow these directions when using OU TurtleBots.

  1. Before you command the TurtleBot to move, be sure to unplug both the laptop and the base from their power supplies and close the laptop and stow it safely within the tower as demonstrated in class. When stowed, the laptop should not extend beyond the front of the robot's base in order to minimize the possibility of damage to the laptop.
  2. When you have finished using the TurtleBot, please return it to its starting location and plug in both the laptop and the base. Be sure to turn off the base.