Package edu.tufts.hrilab.pathfinding
Class PathPlannerComponent
java.lang.Object
edu.tufts.hrilab.diarc.DiarcComponent
edu.tufts.hrilab.pathfinding.PathPlannerComponent
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
protected boolean
Fields inherited from class edu.tufts.hrilab.diarc.DiarcComponent
executionLoopCycleTime, log, shouldRunExecutionLoop
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
This is where any code that needs to be called repeatedly in a dedicated thread should live.findDirectPath
(int startX, int startY, int goalX, int goalY) Euclidean path from [startX,startY] to [goalX,goalY].Wrapper around findDirectPath that makes usage from an action script easier.findPath
(int startX, int startY, int goalX, int goalY, List<org.apache.commons.lang3.tuple.Pair<Integer, Integer>> path) Find path from [startX,startY] to [goalX,goalY] using A*.Wrapper around findPath that makes usage from an action script easier.protected void
init()
Perform any component initialization.boolean
isBreakable
(Symbol locx, Symbol locy) boolean
isEmpty
(int x, int y) boolean
isPassable
(int x, int y) void
resetMap()
void
Methods inherited from class edu.tufts.hrilab.diarc.DiarcComponent
additionalUsageInfo, createInstance, createInstance, createInstance, createInstance, getMyGroupConstraints, getMyGroups, getMyService, getMyServices, main, parseArgs, shutdown, shutdownComponent
-
Field Details
-
grid
-
registerForBeliefNotifications
protected boolean registerForBeliefNotifications -
shouldLogBeliefMsg
protected boolean shouldLogBeliefMsg
-
-
Constructor Details
-
PathPlannerComponent
public PathPlannerComponent()
-
-
Method Details
-
init
protected void init()Description copied from class:DiarcComponent
Perform any component initialization. This should not be used for setting local fields to default values as was the case in DIARC. This method is called after the constructor, and after parseArgs. Setting default values should be done in field declaration or in the constructor.- Overrides:
init
in classDiarcComponent
-
executionLoop
protected void executionLoop()Description copied from class:DiarcComponent
This is where any code that needs to be called repeatedly in a dedicated thread should live. It is not called by default and you must set shouldRunExecutionLoop to true in your constructor.- Overrides:
executionLoop
in classDiarcComponent
-
resetMap
public void resetMap() -
updateMap
-
isPassable
public boolean isPassable(int x, int y) -
isEmpty
public boolean isEmpty(int x, int y) -
isBreakable
-
findPath
public Justification findPath(Symbol startX, Symbol startY, Symbol goalX, Symbol goalY, List<Predicate> path) Wrapper around findPath that makes usage from an action script easier. The returned path is a list of at(ACTOR,x,y) predicates defining each step of the path.- Parameters:
startX
-startY
-goalX
-goalY
-path
-- Returns:
-
findPath
public Integer findPath(int startX, int startY, int goalX, int goalY, List<org.apache.commons.lang3.tuple.Pair<Integer, Integer>> path) Find path from [startX,startY] to [goalX,goalY] using A*. This finds the path with min weight, which can be a path containing objects in the way.- Parameters:
startX
-startY
-goalX
-goalY
-path
-- Returns:
-
findDirectPath
public Justification findDirectPath(Symbol startX, Symbol startY, Symbol goalX, Symbol goalY, List<Symbol> path) Wrapper around findDirectPath that makes usage from an action script easier. The returned path is a list of at(agent,x,y) predicates defining each step of the path.- Parameters:
startX
-startY
-goalX
-goalY
-path
-- Returns:
-
findDirectPath
public List<org.apache.commons.lang3.tuple.Pair<Integer,Integer>> findDirectPath(int startX, int startY, int goalX, int goalY) Euclidean path from [startX,startY] to [goalX,goalY]. TODO: replace this with a findMostClearPath implementation that tries to avoid as many obstacles as possible- Parameters:
startX
-startY
-goalX
-goalY
-- Returns:
-