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.
- Check to make sure that the following are set up correctly and ready to go.
- TurtleBot base is turned on.
- 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.
- 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.
- TurtleBot laptop is turned on, awake, and connected to WIFI@OU.
- Select a laptop computer that matches the base you are using.
- 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.)
- 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.
- If the laptop is not already on, open the lid and turn on using the power button.
- 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.
- 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.)
- TurtleBot laptop is connected to its base via one USB cable and to its 3D sensor via a second USB cable.
- 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.
- 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.
- Desktop computer is connected to the Internet via Ethernet.
- Ensure that the Ethernet cable is connected to the desktop computer and to its Ethernet jack in the wall.
- 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.
- Establish a connection between the desktop and laptop.
- Open a terminal on the desktop computer and connect to the laptop using the
ssh
command as follows: ssh -Y IP_OF_TURTLEBOT
.
- 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.
- 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
- Edit your
.bashrc
using a text editor of your choice. Note that your .bashrc
is located in your home directory (~
).
- 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
- 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.
- Minimal startup. Start up TurtleBot nodes by entering the following command on the laptop (required):
roslaunch turtlebot_bringup minimal.launch
- Hardware status. Start up the dashboard by entering the following command on the desktop (preferably):
rqt -s kobuki_dashboard
- Visualization of nodes/communication. Show the graph of communicating nodes by entering the following command on the desktop (preferably):
rosrun rqt_graph rqt_graph
- Teleoperation. Start keyboard teleoperation by entering the following command on either the desktop or laptop:
roslaunch turtlebot_teleop keyboard_teleop.launch
- 3D sensing. Start up 3D sensor services by entering the following command on the laptop (required):
roslaunch turtlebot_bringup 3dsensor.launch
- Visualization of robot in sensed environment. Start RViz by entering the following command on the desktop (strongly recommended):
roslaunch turtlebot_rviz_launchers view_robot.launch
- Mapping. Start gmapping by entering the following command on the laptop (strongly recommended):
roslaunch turtlebot_navigation gmapping_demo.launch
- Navigation. Start navigation by entering the following command on the desktop (recommended):
roslaunch turtlebot_rviz_launchers view_navigation.launch
Using an OU TurtleBot
You must follow these directions when using OU TurtleBots.
- 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.
- 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.