Class Map

java.lang.Object
  extended by JavaRCX
      extended by Map

public class Map
extends JavaRCX

Map.java -- This program is for challenge #5 of the Robotics project. Given a start and goal location, as well as how the points of a map are connected, the robot will calculate the shortest path and then traverse it. Created: Mon Nov 29 21:59:12 2004


Field Summary
 
Fields inherited from class JavaRCX
ALL, CENTER_ONLY, CENTER_RIGHT, DARK, L_ROTATION, LEFT_CENTER, LEFT_ONLY, LEFT_RIGHT, NONE, POWER, R_ROTATION, RIGHT_ONLY, state, watcher
 
Constructor Summary
Map()
          Map - The constructor initializes roadPts (a vector of all the points on the map) as well as ptsExplored (a vector that holds all the points that have been explored - this is used by the BreadthFirstSearcher).
 
Method Summary
static void main(java.lang.String[] args)
           
 boolean search()
          search - method searches from the start node using a Breadth First Searcher and returns whether or not a path was found to the goal node
 void setGoal(int index)
          setGoal - method sets a RoadPoint to start
 void setStart(int index)
          setStart - this method sets the start of the path for the robot
 void traverse()
          traverse - method that actually creates the path the robot will take on the map.
 
Methods inherited from class JavaRCX
initialize, lost, powerOff
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Map

public Map()
Map - The constructor initializes roadPts (a vector of all the points on the map) as well as ptsExplored (a vector that holds all the points that have been explored - this is used by the BreadthFirstSearcher). The method mapPoints() actually places the points in the roadPts vector.

Method Detail

setStart

public void setStart(int index)
setStart - this method sets the start of the path for the robot

Parameters:
index - an int value - sends a RoadPoint index to the function, the start is then set to that index

setGoal

public void setGoal(int index)
setGoal - method sets a RoadPoint to start

Parameters:
index - an int value - the goal node index

search

public boolean search()
search - method searches from the start node using a Breadth First Searcher and returns whether or not a path was found to the goal node

Returns:
a boolean value - if true, a path was found, if false, a path was not found

traverse

public void traverse()
traverse - method that actually creates the path the robot will take on the map. Using the nodes in the path array, this method creates a list of spokes the robot will take at each intersection in order to successfully reach the goal node.


main

public static void main(java.lang.String[] args)