Lab #2: Introduction to Turtlebots


The main objective of this lab is to familiarize you with basic control of the Turtlebot robot. You are welcome to copy code from the internet, but make sure to credit where it came from. I recommend you work in small groups. If you work in a small group, be sure to state everyone's name.


Upon successful completion of this lab, you will be able to:

  1. Run the turtlebot simulator in Gazebo
  2. Control the turtlebot via ROS messages in Python
  1. I recommend you use Gazebo for this lab. You're welcome to use Stage instead (lower graphics requirements and very similar commands as the physical robot) but please specify this in your submission so that it's graded correctly.
  2. In preparation for this lab, you have already gone through a tutorial on Gazebo. In class, Matt demonstrated bringing up Gazebo, running rviz, and using keyboard commands:
    roslaunch turtlebot_gazebo turtlebot_world.launch
    roslaunch turtlebot_rviz_launchers view_robot.launch
    roslaunch kobuki_keyop keyop.launch
  3. Download, a simple python script for making the turtlebot go forward. Make sure you can run it:
    and work to understand each line of the file
  4. Your job is to create two new python files. When I run, your turtlebot will move in a triangle, stop, and then the program will end. When I run, your turtlebot will move in an outward spiral until I hit Ctrl-C, at which point it will stop and the program will end.
    spiral picture
    You'll probably want to learn more about the Twist message in order to accomplish these tasks.
  5. For extra credit, see if you can create two turtlebots and get them executing the spiral pattern simultaneously.
Hand in
In Blackboard, please submit the following:
  1. A text or pdf file (not word, openoffice, etc.) with:
    • Your name
    • The names of any people you worked with (optional)
    • Any advice for someone who needs to do this lab (i.e., students next year)?
    • Any on-line references / websites you found particularly useful
  2. A video or screen capture of your code running the triangle, spiral and the (optional) extra credit. Instead of uploading the video to blackboard, please add a link as the final line of your text file with a URL to youtube, dropbox, etc.
  3. The code you wrote for the assignment:,, and anything else we'll need to run it. It doesn't need to be pretty, but it should be commented enough that we can understand what you did.
  1. Text file content: 10
  2. Code for triangle (correctness and quality): 30
  3. Code for spiral (correctness and quality): 35
  4. Videos/screencaptures of triangle and spiral (correctly shows what code does): 25
  5. Extra Credit: 20