Your goal in this project is to get comfortable programming the Turtlebot3 robot. You'll be asked to program the robot to perform one or more behaviors. Additionally, in the process, you'll learn about tools and strategies for debugging robot programs. If you have any questions about this project or find yourself getting stuck, please post on the course Slack or send a Slack DM to the teaching team. Even if you don't find yourself hitting roadblocks, feel free to share with your peers what's working well for you.
This assignment is to be completed individually. You can get help from your fellow classmates setting up your programming environment and completing the ROS beginner tutorials. For the meat of this problem set (programming Turtlebot3 behaviors), you can ask your fellow classmates for general advice or tips on ROS/robot programming, however, the work of programming the robot's behavior must be done by you (no sharing code, no copying code, no looking at other people's code).
You'll submit this project using Github Classroom (both the code and the writeup).
You'll want to put the warmup_project
git repo within your ~/catkin_ws/src/
directory (where ROS packages should be located).
Please put all of your code in a scripts
directory within warmup_project
.
When grading your code, we'll be looking for:
For each of the behaviors you program for your robot, we ask that you record your robot performing that behavior in a rosbag. Please record only the /scan
and /cmd_vel
ROS topics so that your bagfiles aren't enormous. Please put all of your rosbags in a bags
directory within warmup_project
with a name that will help us easily identify which behavior you've recorded. For ease of use, here's how to record a rosbag:
$ rosbag record -O filename.bag topic-names
For mor information on rosbags, please refer to the ROS Resources page.
Please modify the README.md
file as your writeup for this project. Also, feel free to checkout this Mastering Markdown Github Guide page for tips on how to style your README.md. Your writeup should include:
Here is a list of the files that you are likely to make/edit during this project:
warmup_project/bags/drive_square.bag
warmup_project/bags/wall_follower_demo.bag
warmup_project/bags/person_follower_demo.bag
warmup_project/scripts/drive_square.py
warmup_project/scripts/wall_follower.py
warmup_project/scripts/person_follower.py
warmup_project/README.md
The warmup project will be graded as follows:
We will consider your latest commit before 11:00 AM CST as your submission for each deadline. Do not forget to push your changes to your git repo.
Before you're ready to program your robot, you'll need to take the following steps:
warmup_project
, putting it within your ~/catkin_ws/src/
directory (where ROS packages should be located).In order to run your code for this project on the physical turltebots, you'll likely have at least 3 terminals running: one running roscore, one used to launch and run bringup, and one running the program you've written to control the robot. Here's an example of what the commands used to run these three tasks may look like.
First terminal: run roscore.
$ roscore
Second terminal: SSH into your Turtlebot3 and run bringup using the bringup
alias.
$ ssh pi@IP_OF_TURTLEBOT
$ bringup
Third terminal: run your program to control the robot. For example, if my robot wall following code is in the scripts/wall_follower.py
file, my package name is warmup_project
and my script name is wall_follower.py
.
$ rosrun [package-name] [name-of-your-script]
wall_follower.py
for the name of your python script) in order to make your python script executable.
Your goal is to write a ROS node that commands the Turtlebot3 robot to drive a square path. You can accomplish this by using either timing (e.g., move forward for a fixed amount of time then make a 90 degree turn four times) or using Turtlebot3's odometry (check out the /odom
topic). You can choose which approach to take, however, we will point out that using timing is significantly easier. The following are good examples of what you can expect your drive in a square behavior to look like:
Tips:
Your goal is to write a script that follows a person (or its closets object) while maintaining a safe distance. We recommend that you use the /scan
rostopic, which contains the data from the robot's LiDAR to determine the robot's relative position to what's surrounding it. Pay close attention to how your robot determines where a person is and make sure your robot is facing the supposed person once it gets to the safe distance. The behavior should look somewhat like the following:
Tips:
/scan
ROS topic.Your goal with this robot behavior is to 1) have your robot navigate close to a wall, 2) drive alongside the wall at an approximately fixed distance, and 3) handle corners. If we were to put the robot in a square room, we would expect it to run around the room (following the walls) indefinitely. Here is an example of what your wall follower implementation may look like:
Tips:
While your final deliverables will all need to be derived from working with the physical turtlebots, you may use the Gazebo simulator to work on the warmup project if you want to. For example, you could prototype a "driving in a square" beahvior in simulation, test it on the physical turtlebots, and then capture your deliverables with your code running on a physical turtlebot. Here are some examples of the person follower and wall follwer in the Gazebo simulator.
Running your code in simulation will look very similar to running your code on the physical robot. The only difference is that you will be loading a Gazebo world using a ROS launch file rather than running bringup on the physical bot.
First terminal: run roscore.
$ roscore
Second terminal: launch and run the Gazebo simulator with a specific world file. For the wall follower, you'll use the turtlebot3_in_room.launch
launch file I've provided in the warmup_project
ROS package. For the other robot behaviors, you can use the turtlebot3_empty_world.launch
launch file in the turtlebot3_gazebo
ROS package.
roslaunch [package-name] [launch-file-name]
Third terminal: run your program to control the robot. For example, if my robot wall following code is in the `scripts/wall_follower.py` file, my package name is warmup_project
and my script name is wall_follower.py
.
$ rosrun [package-name] [name-of-your-script]
The design of this course project was influenced by Paul Ruvolo and his Fall 2020 A Computational Introduction to Robotics course taught at Olin College of Engineering. The gifs providing examples of the robot behaviors are used with permission from former students Ting-Han Lin, Samir Rajani, Emilia Lim, Josephine Passananti, and Elizabeth Singer.