Warmup Project

Objectives


Your goal in this project is to get comfortable programming the Turtlebot4 robot by programming it to perform several behaviors: driving in a square, following a person, and following a wall. 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 ROS2 introduction. For the meat of this problem set (programming Turtlebot4 behaviors), you can ask your fellow classmates for general advice or tips on ROS2/robot programming, however, the work of programming the robot's behavior must be done by you (no use of genAI to generate code, no sharing code, no copying code, no looking at other people's code).


Deliverables


You'll set up your code repository using Github Classroom and submit your work on Gradescope (accessible via Canvas). You'll want to put the warmup_project git repo within your ~/intro_robo_ws/src/ directory (where ROS2 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 use the following names for your python scripts, so we can easily identify them:

warmup_project/warmup_project/drive_square.py
warmup_project/warmup_project/person_follower.py
warmup_project/warmup_project/wall_follower.py

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 (1) record ONLY the /scan and /cmd_vel ROS2 topics and (2) MINIMIZE the time between when you run ros2 bag record and when you run your code so that your bagfiles aren't enormous and so the TAs don't have to wait 1-2 minutes for your bag file to play. Please put all of your rosbags in a bags directory within warmup_project with the following names:

warmup_project/bags/drive_square.bag
warmup_project/bags/wall_follower.bag
warmup_project/bags/person_follower.bag
You can record a rosbag using the following command:
$ ros2 bag record -o [rosbag-name] [topic-names]
To play back the rosbag (to check that it recorded properly), you can use the following command:
$ ros2 bag play [rosbag-name]
For more information on rosbags, please refer to the Recording and playing back data ROS2 resource page.

Writeup

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.

Grading

The warmup project will be graded as follows:


Deadlines & Submission


Deadlines

Submission

You will use Gradescope to submit your warmup project deliverables:


Getting Started


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


Running Your Code


Follow the steps on the Physical Turtlebot4 page to establish a connection to the robot. Once the robot is on and connected, you can run your code:

$ ros2 run [package-name] [name-of-your-script]
Where [package-name] is the name of your ROS2 package (e.g., warmup_project) and [name-of-your-script] is the name of the entry point for your Python script (e.g., drive-square).

To make it easier to grade everyone's code, please use the file names and entry point names as specified below. Your setup.py file should contain the following in the entry_points section:

entry_points={
    'console_scripts': [
        'drive-square = warmup_project_solutions.drive_square:main',
        'person-follower = warmup_project_solutions.person_follower:main',
        'wall-follower = warmup_project_solutions.wall_follower:main',
    ],
}

Turtlebot4 Behavior Programming


Driving in a Square

Your goal is to write a ROS2 node that commands the Turtlebot4 robot to drive a square path. The best way to do this is using a timing approach (e.g., move forward for a fixed amount of time then make a 90 degree turn four times). The following is an example of what you can expect your drive in a square behavior to look like:

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

person follower 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. 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:

wall follower example
wall follower 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 are used with permission from former students Ting-Han Lin, Samir Rajani, Emilia Lim, Josephine Passananti, and Elizabeth Singer.