lejos.robotics.pathfinding
Class NodePathFinder

java.lang.Object
  extended by lejos.robotics.pathfinding.NodePathFinder
All Implemented Interfaces:
PathFinder

public class NodePathFinder
extends java.lang.Object
implements PathFinder

This path finder class uses one of the common search algorithms (e.g. A*) and a navigation mesh (e.g. grid) and uses them to find a path around map geometry.

Author:
BB

Constructor Summary
NodePathFinder(SearchAlgorithm alg, NavigationMesh mesh)
          Instantiates a NodePathFinder object using a specified algorithm.
 
Method Summary
 void addListener(WaypointListener wpl)
           
 Path findRoute(Pose start, Waypoint goal)
           
 void setNavMesh(NavigationMesh mesh)
          Method for changing the navigation mesh after this has been instantiated.
 void setSearchAlgorithm(SearchAlgorithm alg)
          Method for changing the search algorithm after this has been instantiated.
 void startPathFinding(Pose start, Waypoint end)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodePathFinder

public NodePathFinder(SearchAlgorithm alg,
                      NavigationMesh mesh)
Instantiates a NodePathFinder object using a specified algorithm. The supplied mesh is used to add and remove nodes (start and goal) when requesting a path.

Parameters:
alg - The search algorithm.
mesh - The navigation mesh is a set of nodes in various configurations (e.g. grid).
Method Detail

setNavMesh

public void setNavMesh(NavigationMesh mesh)
Method for changing the navigation mesh after this has been instantiated.

Parameters:
mesh -

setSearchAlgorithm

public void setSearchAlgorithm(SearchAlgorithm alg)
Method for changing the search algorithm after this has been instantiated.

Parameters:
alg -

addListener

public void addListener(WaypointListener wpl)
Specified by:
addListener in interface PathFinder

findRoute

public Path findRoute(Pose start,
                      Waypoint goal)
               throws DestinationUnreachableException
Specified by:
findRoute in interface PathFinder
Throws:
DestinationUnreachableException

startPathFinding

public void startPathFinding(Pose start,
                             Waypoint end)
Specified by:
startPathFinding in interface PathFinder