Project 3: Adding a robot platform to the maze


To Deliver: release 5.0 in svn repository under tags directory, email with crc card design to your grader: Md Atiqur Rahman <mrahman@email.wm.edu> (Section 1), Jianhua Sun <jsun01@email.wm.edu> (Section 2).

To Download: /home/scratch/kemper/Robot.java and /home/scratch/kemper/RobotDriver.java

Due date for submission:    Oct 18

Drop out date:                     Oct 21, at 5 AM (EARLY MORNING)


Motivation

We want to prepare the maze code base to provide an API for maze exploration algorithms that will guide a "robot" out of the maze. 

The design idea is to have a layered architecture where robot driver algorithms operate on top of an abstract robot layer that operates on the overall maze. 


The robot driver algorithms, for example, a naive random search algorithm, implement a RobotDriver interface (as given in file RobotDriver.java). They depend on a robot (a class that implements the Robot interface as given in file Robot.java) to explore a maze and find the exit. The robot interface follows from what a Lego robot may provide for as sensors to recognize distant objects (here walls) and the ability to move forward, backward and to turn on the spot.


As a first step, we want to establish the Robot platform by providing some implementation of the Robot interface that works on the maze and the maze graphics (first person and map drawer classes). To see if concept works, we want to add a manual maze exploration with a class that operates on the robot implementation (and not directly on the maze object anymore). This will replace the existing manual maze operation. Note: The RobotDriver will drive the graphics (MapDrawer and FirstPersonDrawer) without being aware of this. The robot interface implementation needs to take care of this by operating on top of the Maze class.



We also want to compare algorithms (or performance of a human driver) in terms of energy efficiency to operate the robot. So there is a some energy consumption being involved in any movement and sensor operation and the robot draws energy from its battery on its journey. 

Operating the robot needs care, hitting a wall will damage it and will cause an emergency stop. 

We need to modify the final screen to report on the length of the chosen path and the amount of energy consumed.


The only robot configuration we will consider at this point is the following:


What to learn from this project:

- Experience in test-driven design and limitations of testing when it comes to randomized algorithms and graphics. 

- Experience in establishing a hierarchical, layered design where each layer provides functionality in form of an API (an interface) to the layer above and with the help of own code and the API of the layer below.

- Refactoring existing classes to adjust to a modified class design

- Learn to work with exceptions



Design decision


To retain a reasonably uniform design, I would like to fix the following naming conventions for classes:


The class that implements the Robot interface is named BasicRobot.java. 


The class that implements the key functionality for the manual operation of a robot is called ManualDriver.java. (You can use more classes if you like, but use this name for the one that has the responsibility to drive the robot).


Classes that implement test cases for each class have the class name followed by suffix Test, e.g. BasicRobotTest.java for the BasicRobot.java class.


Note that we will only consider a default robot configuration with 4 distance sensors, one in  each direction. However, it may be straightforward to have a class that is configurable to have more/less/other distance sensors. Provide the class with at least one constructor that has no parameters and creates a robot with the default configuration we consider. For the automated drivers in the next project, we will consider robots with only 2 distance sensors (one forward, one to the left).



To do list: