Package lejos.robotics.pathfinding
Class RandomPathFinder
- java.lang.Object
-
- lejos.robotics.pathfinding.RandomPathFinder
-
- All Implemented Interfaces:
PathFinder
public class RandomPathFinder extends java.lang.Object implements PathFinder
PathFinder that takes a map and a dummy set of range readings. It finds a path that is in short moves, has no obstacles in the way and where valid range readings can be taken from each waypoint. The algorithm is not deterministic so each time it is called a new route will be found.- Author:
- Lawrie Griffiths
-
-
Constructor Summary
Constructors Constructor Description RandomPathFinder(RangeMap map, RangeReadings readings)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddListener(WaypointListener wpl)PathfindRoute(Pose start, Waypoint destination)voidsetClearance(float clearance)Set the clearance around the edge of the map.voidsetMaxDistance(float distance)Set the maximum distance between waypointsvoidsetMaxIterations(int iterations)Set the maximum number of iterations before giving up when searching for a pathvoidsetMaxRange(float range)Set the maximum valid range readingsvoidstartPathFinding(Pose start, Waypoint end)
-
-
-
Constructor Detail
-
RandomPathFinder
public RandomPathFinder(RangeMap map, RangeReadings readings)
-
-
Method Detail
-
setMaxRange
public void setMaxRange(float range)
Set the maximum valid range readings- Parameters:
range- the maximum range
-
setMaxDistance
public void setMaxDistance(float distance)
Set the maximum distance between waypoints- Parameters:
distance- the maximum distance
-
setMaxIterations
public void setMaxIterations(int iterations)
Set the maximum number of iterations before giving up when searching for a path- Parameters:
iterations- the maximum number of iterations
-
setClearance
public void setClearance(float clearance)
Set the clearance around the edge of the map. This does not really work as clearance shiould be around all walls and obstacles.- Parameters:
clearance- the clearance
-
findRoute
public Path findRoute(Pose start, Waypoint destination) throws DestinationUnreachableException
- Specified by:
findRoutein interfacePathFinder- Throws:
DestinationUnreachableException
-
addListener
public void addListener(WaypointListener wpl)
- Specified by:
addListenerin interfacePathFinder
-
startPathFinding
public void startPathFinding(Pose start, Waypoint end)
- Specified by:
startPathFindingin interfacePathFinder
-
-