Module navigationTactics :: Class AgentRRTTacticImpl
[hide private]
[frames] | no frames]

Class AgentRRTTacticImpl

source code

This class implements an RRT based partolling agent tactic. Given a start position and a goal position, it runs a simplistic RRT algorithm, and extracts the resulting path.

Instance Methods [hide private]
 
__init__(self, agentIndex, startPos, goalPos, obstacleList, rulesOfTheSea) source code
list of 2-tuples
getPath(self)
Returns the path of points along which the agent patrols.
source code
list of 2-tuples
rrtPath(self, startPos, goalPos)
Computes an RRT path from startPos to goalPos.
source code
ShipExternalState
extend(self, tree, randomState)
The EXTEND function from the paper.
source code
 
isGoalState(self, shipState)
Is the ship within some threshold from the goal.
source code
 
chooseRandomState(self)
Samples a random state with a bias towards the goal.
source code
Method Details [hide private]

__init__(self, agentIndex, startPos, goalPos, obstacleList, rulesOfTheSea)
(Constructor)

source code 
Parameters:
  • agentIndex (int) - the index of the patroling agent (like an agent-id)
  • startPos (2-tuple) - start position for the RRT computation
  • goalPos (2-tuple) - goal position for the RRT computation
  • rulesOfTheSea (boolean) - Tells whether to respect the rules of the sea

getPath(self)

source code 

Returns the path of points along which the agent patrols.

Returns: list of 2-tuples
a list of (x, y) points representing the patrol path

rrtPath(self, startPos, goalPos)

source code 

Computes an RRT path from startPos to goalPos.

Parameters:
  • startPos (2-tuple) - start position for the RRT computation
  • goalPos (2-tuple) - goal position for the RRT computation
Returns: list of 2-tuples
a list of (x, y) points representing the patrol path

extend(self, tree, randomState)

source code 

The EXTEND function from the paper. Here, in this simple version of the algorithms, we just take an epsilon step towards the randomState, without checking the all intermediate states are collision-free. We also assume holonomic problem in which the computation of the edge (the action that takes us to the new state) is just a simple vector calculation.

Parameters:
  • randomState (ShipExternalState) - A state that was randomly sampled in space, towards which we take an epsilon step.
Returns: ShipExternalState
The new state that was added to the tree.