18-642 Project 5

Last updated 9/8/2018 (changelog)

NOTE: Students in previous semesters have said that this project is more technically challenging, and wish they'd started sooner. We recommend an early start!

This project has you split the turtle maze solver into two separate files. One file keeps track of the turtle as it sees the world, and the other translates the turtle coordinates to a turtle position. This project also has the turtle keep track of its knowledge of the world in its own local array. (Technically: a file static array.)

In the real world, a robot does not know in advance what the map looks like. Splitting apart the map and the robot allows you to work with the notion of the robot having to figure out its surroundings without being able to "cheat" by asking the map where it is and what's around the corner. Think of this as a really gentle, simple introduction. For serious robots, you use SLAM.


Lab Files:


Hints/Helpful Links:


Procedure:

Note: In this and following projects, $ECE642RTLE_DIR will be used to refer to ~/catkin_ws/src/ece642rtle

  1. You are asked to make use of a new function, displayVisits(int visits) . This function changes the color of the cell the turtle is in when it returns from the studentMoveTurtle (or moveTurtle, below) function, based on the visits argument. It is meant to be used to indicate how many times a cell has been visited. Note that this a write-only function: it is meant for debugging and display purposes. You can't read values from this function. (You'll set up a separate array to keep track of the count internally; but it is NOT done by this function.) This function should be used to plot how many times you've visited a particular cell during the maze search. It is up to you to keep track of the number of visits.
    The intended use is for your code to keep a local map inside of an array, where the corresponding item in the array is incremented when the turtle visits a cell. The contents of this array can be displayed using the new helper function.
    As an example, when we ran the turtle maze solver using the left-hand and right-hand rules and kept track of how many times each cell was visited, we got the following maps:

    Note: we tried our best to make this color palette colorblind-friendly. If you are having trouble distinguishing the colors, please e-mail the course staff for guidance on how to change them.
  2. Change your code so that it creates and updates a local map and records how many times the turtle has visited each square. (Before making this change, read the next step about splitting the code so you don't waste effort. Whether you implement the map array before or after splitting the code is up to you.)
    1. Your code shall use a file static array to keep track of how many times each square of the maze has been visited.
      Remember that the turtle does not know its absolute coordinates, but any map you will be given will be 12 cells by 12 cells in size, so it is sufficient to use a 23x23 array and place the turtle in the center of this local map at startup. The turtle can travel at most 11 cells in any given direction from its starting point, so if the turtle's initial position is represented in position {11,11} of the array, no matter how the turtle travels, it can keep track of its path in the array. This is analogous to a human bringing a piece of graph paper with them into a maze.
      Rather than dynamically resizing the array, we suggest statically allocating an array that is about twice as big in both X and Y dimensions, and starting in the center, but you can use any method you like.
  3. We highly recommend you use getter and setter methods on this array, rather than directly accessing the elements, in order to better instrument unit testing in future projects.
  4. Each time the turtle visits a square it shall update the map display to indicate how many times that square has been visited.

Other directions:


Handin checklist:

  1. Your final code. (This code must build and successfully solve m1.maze). This should be the project directory ( ~/catkin_ws/src/ece642rtle/), compressed and named p05_ece642rtle_[AndrewID]_[FamilyName]_[GivenName].zip (.tar.gz is also accepted). Remember, any files that you modified in this directory (except CMakeLists.txt) must start with your Andrew ID!
  2. Your writeup, named p05_writeup_[AndrewID]_[FamilyName]_[GivenName].pdf.

Zip the two files and submit them as Project5_[Andrew ID]_[Family name]_[First name].zip.

Please do NOT put these files inside a subdirectory. When the hand-in is 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.) It is OK to put the code inside the code zip file inside a code a directory (i.e., the code, when unzipped, can be in a directory, but the .pdf and .zip file from the checklist must unzip without directory info.

The rubric for the project is found here.


Changelog: