lejos.robotics.pathfinding
Class RandomPathFinder

java.lang.Object
  extended by 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
RandomPathFinder(RangeMap map, RangeReadings readings)
           
 
Method Summary
 void addListener(WaypointListener wpl)
           
 Path findRoute(Pose start, Waypoint destination)
           
 void setClearance(float clearance)
          Set the clearance around the edge of the map.
 void setMaxDistance(float distance)
          Set the maximum distance between waypoints
 void setMaxIterations(int iterations)
          Set the maximum number of iterations before giving up when searching for a path
 void setMaxRange(float range)
          Set the maximum valid range readings
 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

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:
findRoute in interface PathFinder
Throws:
DestinationUnreachableException

addListener

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

startPathFinding

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