18-642 Project 2
Page last updated 8/31/2019 (changelog)
This project introduces you to cleaning up messy code that you didn't
write. It requires you to examine an existing project, figure out what the code
is doing, and modify it. The focus of this project is on process, so you can
receive full points even if you did not successfully complete the
implementation. The turtlesim from Project 1 has been modified to move
stepwise, and has been renamed ece642rtle.
- Virtualbox image (changelog/hints). Be sure to
check Canvas announcements and use the latest image in case changes have been
- ece642rtle.tar.gz: standalone
files for Project 2. (These are already on the VM, so you do not have to
download them unless you are running natively)
- Please follow the handin naming convention: every filename (before the
file extension) must end in [AndrewID]_[Family Name]_[Given Name].
- Access the ROS tutorials here: ROS Tutorials.
- Be sure to start the roscore command before using rosrun.
- Be sure to run catkin_make in the /home/student/catkin_ws
- If ROS isn't finding some packages, type source
- Tutorial on git
(optional). There are many tutorials, guides, etc. on the Web, so we suggest
you look for the newest/best version of these materials if you haven't used
tools like this before.
This procedure requires you to limit the time spent on
certain steps. Read through the entire procedure before starting the
- Choose a version control system (git, svn...) and set up version control
in the ~/catkin_ws/src/ece642rtle directory. Note that this cannot be
a public repository (i.e. nobody should be able to find it on github). You can
always host a repository in your AFS space. Take a screenshot of the checkout
- Ensure that you can build run the code as it stands:
- Rename the files ~/catkin_ws/src/ece642rlte/student/student_turtle.cpp
ANDREWID_student_turtle.cpp and ANDREWID_student_maze.cpp,
respectively, where ANDREWID is your student ID.
- In ~/catkin_ws/src/ece642rtle/CMakeLists.txt, change lines 44 and
45 by replacing "ANDREWID" with your Andrew ID.
- Run the following:
Note: to build the project following the first time, you only need to type
catkin_make, without the flag after it.
- In one terminal, roscore
- In a second terminal, cd ~/catkin_ws/ && source
devel/setup.bash && rosrun ece642rtle ece642rtle_node . This
command should launch a window with the turtle inside a maze.
- In a third terminal, cd ~/catkin_ws/ && source
devel/setup.bash && rosrun ece642rtle ece642rtle_student . This
command should cause the turtle to start solving the maze.
- Confirm that the turtle is solving the maze, using the
Follower algorithm, obeying the left-hand rule. This algorithm solves the
maze by following the wall with the left hand.
- Spend one hour trying to change the turtle from the left-hand rule
(left hand following the wall) to the right-hand rule (right hand following the
- You may only edit the
- STOP after one hour.
- To make and run the code, you can either follow the procedure in step 2
above, or use the build_run_turtle.sh script (type
./build_run_turtle.sh to run it) in ~/catkin_ws/src/ece642rtle
. This script should work if you run it from anywhere.
- If you succeeded, great!
- If you've "almost" succeeded, cut off your efforts after 75
minutes total (strict deadline). You'll get to come back to this later.
- If you did not succeed, use your version control to revert
to a state such that the turtle solves the maze successfully. Usually your best
bet is to revert all the way back to the initial code.
- Spend additional time cleaning up the code so that you think it is
- Keep a log tracking your time to the nearest tenth of an hour (6 minute
increments) with no log entry longer than 30 minutes. Example:
0.3 hours: Found and used a tool ([tool name]) that automatically applies a
0.2 hours: converted turtle direction to enum.
- Spend at least two hours improving code quality without trying to
complete the changes, even if you got the change working in part 5, above.
- You can spend up to six hours if you want to, but no more than six.
- Make sure that the code still successfully solves the maze.
- Important note: do not consult with other
students as to what might or might not be "good" style. There is
no expectation as to what "good" coding style is for
this project other than what you personally think is "good." We want
to see where you are coming from as you start the course so we can assess what
content to include/not include this semester. (That having been said, if you
can't find 2 hours of work to improve style and are leaving things mostly as
they are, perhaps think of things you might do that make the code easier to
understand even if you normally would not do them.)
- Also, do NOT consult with other students for hints on
turtle directions and so on. Also, do NOT throw the code away and start from
scratch with your own design. The point of this project is NOT actually to
change the turtle behavior. The point is to give you a microcosm experience of
inheriting "clever" legacy code and having to make a change. In the
real world you'd probably be getting 100,000 lines of code that mostly looks
like this, and there would be nobody else to help you. Also, that code will be
too huge to throw it away and start over.
- After you have improved the code, spend up to one additional hour trying
to convert to right-hand rule.
- Answer the following questions in a writeup:
- Your name. (If they are printed out, the file name info is lost.)
- Q1: State what version control system you used in Step 1, and include your
- Q2: Did you successfully modify the turtle algorithm after the first
attempt (Step 4)? Why or why not?
- Q3: Include your log from Step 6.
- Q4: Did you successfully modify the turtle algorithm after the second
attempt (Step 6)? Why or why not? How long did you spend on step 6 (0.0 to 1.0
hours?) If you succeeded after Step 4, you do not have to answer this question
beyond "I spent 0 hours."
- Q5: Did you encounter any problems with the project? What general feedback
do you have? Did you find it too difficult or too easy?
- Your writeup. Call this file p02_writeup_[AndrewID]_[Family
- Your modified student_turtle.cpp file. Call this file
Zip these two files and turn them in on Canvas as
Project02_[Andrew ID]_[Family name]_[Given name].zip
Please do NOT put these files inside a subdirectory. When
unzipped they should not have any directory associated with the file name, and
should just unzip into the current directory. (The file name convention will
retain whose work it is.)
The rubric for the project is found here.
- 8/23/2019 5:30PM: page published
- 8/31/2019 11:50AM: changed "source/devel/setup.bash" to
- 9/6/2019 6:50PM: fixed on instance of incorrect path to