Today's Goal: The objective of this lab is for you to learn the basics of how to control, program, and care for your Turtlebot. This will involve (a) an intro to the Turtlebot Hardware and its operating system ROS (b) an intro to basics of controlling your Turtlebot from the command line and from a remote laptop (c) modifying code that we give you to make the robot move in a predictable pattern, i.e. a square (d) discussion of logistics of this class and safety/rules for your robot.
Part 0: Partners and Robots: From this point on, all labs and psets will be done in pairs, and two sets of pairs will share one specific robot. You should now follow the instructions to get started with Git. Follow the instructions here to set up your Turtlebot computer user and GitHub repositories: Getting Started 0: Git and Users.
Part 1: We will first give a brief intro to the Turtlebot and ROS system, then follow the instructions Getting Started 1: Turtlebot Basics on how to turn on/off and connect to your Turtlebot. Also CAREFULLY READ all the rules on how to make sure you don't damage your robot.
In your cloned repository, you will find three scripts: goForwardAvoidBump.py, turnLeft.py, and sensorCatalog.py.
- On the Turtlebot netbook, launch the ros script
roslaunch lab-1.launch.xml in order to be able to launch ROS nodes controlling the Kobuki base sensors so that you can send commands to the Turtlebot's wheel motors. Instructions can be found here: Getting Started 1: Turtlebot Basics
- SSH into the Turtlebot's netbook. Read and run goForwardAvoidBump.py from your local (personal) machine. BE PREPARED TO PRESS CTRL+C (or command+c for OSX users). This script causes the robot to move indefinitely forward, until it bumps something, at which point it should stop.
- Read and run turnLeft.py.
- Read sensorCatalog.py.
- Take a quick read through Getting Started 2: ROS, Turtlebot Sensors, and Code. You will want to reread this again before Pset 1.
Part 2: Modify this code so that:
- The robot moves in a square and then stops.
- If the robot bumps into anything while moving in a square shape, the robot stops.
Demonstrate your working code to one of the teaching staff.
Part 3: Create a file called "README.txt" in your repository. Add your names to this file, and add this file to your git repository, along with your code from today. Commit this code (
git commit -m "Your commit message"), and push it to GitHub (
git push origin master). This is an important step, as this will be how you hand in assignments from now on.
Optional Extensions: Once you have this working, try extensions like
- Create a publisher for the ROS node '/mobile_base/commands/sound'. Add the line "from kobuki_msgs.msg import Sound". Then you can publish sounds (e.g. Sound.ON) to make the robot beep on command!
- Make the robot move in a "S" shape (smooth shape)
- Make robot move in a square indefinitely, unless bumped. Observe your robot repeating this square motion -- is its motion precise?
- Make the bump sensor only cause temporary time out in movement (5 second stop), and then go back to previous movement.