Warmup Project

Objectives


Your goal in this project is to get comfortable programming the Turtlebot3 robot in the Gazebo simulator. 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.

Learning Goals

Logistics

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).


Deliverables


You'll submit this project on Github (both the code and the writeup). Fork our starter git repo to get our starter code and so that we can track your project. You'll want to put the warmup_project git repo within your ~/catkin_ws/src/ directory (where ROS packages should be located).

Note: If you're new to Github, please make an account and familiarize yourself with the basics of Github. This is a link to the Hello World Github Guide, which presents the fundamentals of using Github. The free version of Github should be enough for the purposes of this course. However, if you would like, you can get the pro version as a student from here for free.

Code

Please put all of your code in a scripts directory within warmup_project.

When grading your code, we'll be looking for:

rosbags

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.

Writeup

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:

Note: We highly recommend that you do not leave the writeup of this project to the last minute. You will have a much better writeup if you write incrementally, as you progress through the project. Writing up your work as you go may even help you think through your robot programs and improve the implementation and organization of your robot programs.

Here is a list of the files that you are likely to make/edit during this project:

warmup_project/bags/wall_follower_demo.bag
warmup_project/bags/person_follower_demo.bag
warmup_project/scripts/drive_square.py
warmup_project/scripts/wall_follwer.py
warmup_project/scripts/person_follower.py
warmup_project/README.md

Grading

The warmup project will be graded as follows:


Deadlines & Submission


Submission

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.


Getting Started


Before you're ready to program your robot, you'll need to take the following steps:


Running Your Code


In order to run your code for this project, you'll likely have at least 3 terminals running: one running roscore, one used to launch and run the Gazebo simulator, 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: 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_follwer.py.

$ rosrun [package-name] [name-of-your-script]
Note: You may have to run chmod u+x wall_follower.py (or substitute wall_follower.py for the name of your python script) in order to make your python script executable.

Turtlebot3 Behavior Programming


Driving in a Square

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:

drive square example
drive square example
drive square example

Tips:

Person Follower

Your goal is to write a script that follows a person (or its closets object) while maintaining a safe distance. In your simulators, you can use a basic shape such as a cylinder as the object your robot should follow and simply move it around in the simulator. 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,

drive square example
drive square example
drive square example

Tips:

Wall Follower

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. You'll use the turtlebot3_in_room.launch launch file, where the Turtlebot3 is situated in a square room. When working properly, your robot should run around this square room (either clockwise or counterclockwise) indefinitely. Here are some examples of what your wall follower implementation may look like:

drive square example
drive square example
drive square example

Tips:


Acknowledgments


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 (drive in a square, person follower, and wall follower) are from the members of the Winter 2021 Introduction to Robotics class, used with permission.