Package lejos.robotics.pathfinding
Class AstarSearchAlgorithm
- java.lang.Object
-
- lejos.robotics.pathfinding.AstarSearchAlgorithm
-
- All Implemented Interfaces:
SearchAlgorithm
public class AstarSearchAlgorithm extends java.lang.Object implements SearchAlgorithm
This is an implementation of the A* search algorithm. Typically this object would be instantiated and then used in a NodePathFinder constructor, along with a set of connected nodes.- Author:
- BB
- See Also:
NodePathFinder
-
-
Constructor Summary
Constructors Constructor Description AstarSearchAlgorithm()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PathfindPath(Node start, Node goal)Method accepts a start node and a goal node, and returns a path consisting of a collection of waypoints which includes the startNode coordinates as the first waypoint, and the goal node coordinates as the final waypoint.java.lang.StringtoString()
-
-
-
Method Detail
-
findPath
public Path findPath(Node start, Node goal)
Description copied from interface:SearchAlgorithmMethod accepts a start node and a goal node, and returns a path consisting of a collection of waypoints which includes the startNode coordinates as the first waypoint, and the goal node coordinates as the final waypoint. Note: The startNode must be connected with other nodes (neighbors) that eventually connect to the goalNode.- Specified by:
findPathin interfaceSearchAlgorithm- Returns:
- A collection of waypoints. Returns null if it fails to find a path.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-