public class NavigationModule extends java.lang.Object implements Updatable
Modifier and Type | Field and Description |
---|---|
protected ActivityModule |
activityModule
The activity module.
|
protected java.util.List<Position> |
goalPositions
The goal
Position s. |
private double |
goalRefreshTime
Goal refresh counter.
|
private Map |
map
The map.
|
protected MovementModule |
movementModel
The movement model.
|
protected ObservationModule |
observationModule
The observation module.
|
protected PathFinder |
pathFinder
The method to determine our path.
|
protected StuckDetector |
stuckDetector
The stuck detector.
|
Constructor and Description |
---|
NavigationModule()
Create a goal activity.
|
NavigationModule(java.util.List<Position> goalPositions)
Creates a goal activity.
|
Modifier and Type | Method and Description |
---|---|
Position |
getGoalPosition()
Gets the closest goal position.
|
java.util.List<Position> |
getGoalPositions()
Gets the goal positions.
|
private Position |
getQueueGoal()
Gets the queue goal.
|
boolean |
getReachedGoal()
Determines if the goal is reached.
|
protected void |
handleStuckBehavior(int timeStep)
Handles the behavior if the agent gets stuck.
|
void |
init(Map map,
MovementModule movementModel,
ActivityModule activityModule,
ObservationModule observationModule)
Sets the agent.
|
private boolean |
inQueuingArea()
Determines if the agent is in a queuing area.
|
private boolean |
isCollision(int goalIndex)
Check if there is a collision with
PhysicalObject s or
WalkThroughMetalDetector s. |
private boolean |
isQueuing()
Determines if the agent is queuing.
|
boolean |
isStuck(double secondsStuck)
Determines if the agent is stuck for a given number of seconds.
|
private boolean |
reachedGoal(int goalIndex)
Checks if the goal at a specified index is reached.
|
protected void |
removeGoals(int numberOfGoals)
Remove a number of goals from the list.
|
void |
setGoal(Position position)
Sets the goal position.
|
void |
setShortTermGoal(Position position)
Set a short term goal position.
|
void |
setShortTermGoals(java.util.List<Position> positions)
Sets a set of short term positions.
|
void |
update(int timeStep)
Updates the updatable element.
|
protected void |
updateReachedGoals(int timeStep)
Update the goals based on the place that the agent is currently located.
|
private double goalRefreshTime
protected PathFinder pathFinder
protected StuckDetector stuckDetector
protected MovementModule movementModel
protected ObservationModule observationModule
protected ActivityModule activityModule
private Map map
public NavigationModule()
public NavigationModule(java.util.List<Position> goalPositions)
goalPositions
- The goal positions.public Position getGoalPosition()
public java.util.List<Position> getGoalPositions()
private Position getQueueGoal()
public boolean getReachedGoal()
protected void handleStuckBehavior(int timeStep)
timeStep
- The time step.public void init(Map map, MovementModule movementModel, ActivityModule activityModule, ObservationModule observationModule)
map
- The map.movementModel
- The movement model.activityModule
- The activity module.observationModule
- The observation module.private boolean inQueuingArea()
private boolean isCollision(int goalIndex)
PhysicalObject
s or
WalkThroughMetalDetector
s.goalIndex
- The index of the goal position.private boolean isQueuing()
public boolean isStuck(double secondsStuck)
secondsStuck
- The number of seconds it takes before an agent is considered
stuck.private boolean reachedGoal(int goalIndex)
goalIndex
- The index.protected void removeGoals(int numberOfGoals)
numberOfGoals
- The number of goals.public void setGoal(Position position)
position
- The position.public void setShortTermGoal(Position position)
position
- The position.public void setShortTermGoals(java.util.List<Position> positions)
positions
- The positions.public void update(int timeStep)
Updatable
protected void updateReachedGoals(int timeStep)
timeStep
- The time step.