Package lejos.robotics.pathfinding
Class NodePathFinder
- java.lang.Object
-
- 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
Constructors Constructor Description NodePathFinder(SearchAlgorithm alg, NavigationMesh mesh)Instantiates a NodePathFinder object using a specified algorithm.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddListener(WaypointListener wpl)PathfindRoute(Pose start, Waypoint goal)voidsetNavMesh(NavigationMesh mesh)Method for changing the navigation mesh after this has been instantiated.voidsetSearchAlgorithm(SearchAlgorithm alg)Method for changing the search algorithm after this has been instantiated.voidstartPathFinding(Pose start, Waypoint end)
-
-
-
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:
addListenerin interfacePathFinder
-
findRoute
public Path findRoute(Pose start, Waypoint goal) throws DestinationUnreachableException
- Specified by:
findRoutein interfacePathFinder- Throws:
DestinationUnreachableException
-
startPathFinding
public void startPathFinding(Pose start, Waypoint end)
- Specified by:
startPathFindingin interfacePathFinder
-
-