Homework4

Michael Edelson

medelson@andrew

This project was a pretty big change to my program. It forced me to re-write how I stored my world. I ended up choosing A* as my algorithm, using cardinal directions as the allowable directions for the robot to face. The robot was only allowed to move forward, or turn in place. The cost of turning (to any other direction) was ½ of moving one pixel. Keeping the robot only facing 4 directions allowed me to keep a pixel-based representation of the robot (so I could draw it in paint). The program outputs a jpeg every few (50) pixels it checks. The coloring of the jpeg is as follows: Blue is buffered wall: The more blue (brighter), the more directions the robot will hit it in (if it is facing that direction, and will hit it, the blue is 25% brighter). Red are nodes on the closed list. Green pixels are nodes on the open list The videos show the propagation of the explored nodes. Since the algorithm is essentially 4-point connectivity with a bonus for going straight, things propagate in a triangular manner.

Picture of approximate world from success video:

And the Robot used in it (it is just a vertical line)



Algorithm:

  1. Create a start node

  2. Put start node on open list

Loop (while the open list isn't empty)

  1. pop head of open list

  2. if the popped node is the goal, finish!

  3. Find all adjacent nodes in the world

      1. One step forward

      2. Turned, but in same position

      3. According to orientation, aren't in a wall

  1. For each adjacent node:

  1. Add parent to closed list

    End loop



I chose 4-point connectivity for a heuristic because those are the paths that my robot could follow. It is forced to be shorter than moving forward and turning in place.

Successful navigation

Failed navigation