cz.cuni.amis.pogamut.ut2004.agent.navigation.loquenavigator
Class LoqueNavigator<PATH_ELEMENT extends ILocated>

java.lang.Object
  extended by cz.cuni.amis.pogamut.ut2004.agent.navigation.AbstractUT2004PathNavigator<PATH_ELEMENT>
      extended by cz.cuni.amis.pogamut.ut2004.agent.navigation.loquenavigator.LoqueNavigator<PATH_ELEMENT>
All Implemented Interfaces:
IUT2004PathNavigator<PATH_ELEMENT>

public class LoqueNavigator<PATH_ELEMENT extends ILocated>
extends AbstractUT2004PathNavigator<PATH_ELEMENT>

Responsible for navigation to location.

This class navigates the agent along path. Silently handles all casual trouble with preparing next nodes, running along current nodes, switching between nodes at appropriate distances, etc. In other words, give me a destination and a path and you'll be there in no time.

Preparing ahead

Nodes in the path are being prepared ahead, even before they are actually needed. The agent decides ahead, looks at the next nodes while still running to current ones, etc.

Reachability checks

Whenever the agent switches to the next node, reachcheck request is made to the engine. The navigation routine then informs the LoqueRunner beneath about possible troubles along the way.

Movers

This class was originally supposed to contain handy (and fully working) navigation routines, including safe navigation along movers. However, the pogamut platform is not quite ready for movers yet. Especial when it comes to mover frames and correct mover links.

Thus, we rely completely on navigation points. Since the mover navigation points (LiftCenter ones) always travel with the associated mover, we do not try to look for movers at all. We simply compare navigation point location to agent's location and wait or move accordingly.

Future

The bot could check from time to time, whether the target destination he is traveling to is not an empty pickup spot, since the memory is now capable of reporting empty pickups, when they are visible. The only pitfall to this is the way the agent might get trapped between two not-so-far-away items, each of them empty. The more players playe the same map, the bigger is the chance of pickup emptyness. The agent should implement a fadeing memory of which items are empty before this can be put safely into logic.


Nested Class Summary
static class LoqueNavigator.Stage
          All stages the navigation can come to.
 
Field Summary
protected  AdvancedLocomotion body
          Agent's body.
static int CLOSE_ENOUGH
          Distance, which is considered as close enough..
protected  java.util.logging.Logger log
          Agent's log.
protected  UT2004Bot main
          Agent's main.
protected  AgentInfo memory
          Loque memory.
 
Fields inherited from class cz.cuni.amis.pogamut.ut2004.agent.navigation.AbstractUT2004PathNavigator
bot, botWaiting, executor, self
 
Constructor Summary
LoqueNavigator(UT2004Bot bot, IUT2004PathRunner runner, java.util.logging.Logger log)
          Constructor.
LoqueNavigator(UT2004Bot bot, java.util.logging.Logger log)
          Constructor.
 
Method Summary
protected  NavPoint getNavPoint(ILocated location)
          Returns NavPoint instance for a given location.
protected  void initDirectNavigation(Location dest)
          Initializes direct navigation to the specified destination.
protected  void initPathNavigation(Location dest, java.util.List<PATH_ELEMENT> path)
          Initializes navigation to the specified destination along specified path.
protected  LoqueNavigator.Stage keepNavigating()
          Navigates with the current navigation request.
protected  void navigate(ILocated focus, int pathElementIndex)
          Does the actual navigation of the bot, it should steer it towards path element of the index 'pathElementIndex'.
 void newPath(java.util.List<PATH_ELEMENT> path)
          UT2004PathExecutor reports that new path has been received and the IUT2004PathNavigator#navigate() is about to be called in near future.
 void reset()
          UT2004PathExecutor reports that execution of current path has been terminated - clean up your internal data structure and prepare to navigate the bot along the new path in the future.
 
Methods inherited from class cz.cuni.amis.pogamut.ut2004.agent.navigation.AbstractUT2004PathNavigator
navigate, setBot, setBotWaiting, setExecutor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLOSE_ENOUGH

public static final int CLOSE_ENOUGH
Distance, which is considered as close enough..

See Also:
Constant Field Values

main

protected UT2004Bot main
Agent's main.


memory

protected AgentInfo memory
Loque memory.


body

protected AdvancedLocomotion body
Agent's body.


log

protected java.util.logging.Logger log
Agent's log.

Constructor Detail

LoqueNavigator

public LoqueNavigator(UT2004Bot bot,
                      java.util.logging.Logger log)
Constructor.

Parameters:
main - Agent's main.
memory - Loque memory.

LoqueNavigator

public LoqueNavigator(UT2004Bot bot,
                      IUT2004PathRunner runner,
                      java.util.logging.Logger log)
Constructor.

Parameters:
main - Agent's main.
memory - Loque memory.
Method Detail

navigate

protected void navigate(ILocated focus,
                        int pathElementIndex)
Description copied from class: AbstractUT2004PathNavigator
Does the actual navigation of the bot, it should steer it towards path element of the index 'pathElementIndex'. Called (after several checks) from AbstractUT2004PathNavigator#navigate().

Specified by:
navigate in class AbstractUT2004PathNavigator<PATH_ELEMENT extends ILocated>

reset

public void reset()
Description copied from interface: IUT2004PathNavigator
UT2004PathExecutor reports that execution of current path has been terminated - clean up your internal data structure and prepare to navigate the bot along the new path in the future.


newPath

public void newPath(java.util.List<PATH_ELEMENT> path)
Description copied from interface: IUT2004PathNavigator
UT2004PathExecutor reports that new path has been received and the IUT2004PathNavigator#navigate() is about to be called in near future. The new path is passed as a parameter.


initDirectNavigation

protected void initDirectNavigation(Location dest)
Initializes direct navigation to the specified destination.

Parameters:
dest - Destination of the navigation.
timeout - Maximum timeout of the navigation. Use 0 to auto-timeout.

initPathNavigation

protected void initPathNavigation(Location dest,
                                  java.util.List<PATH_ELEMENT> path)
Initializes navigation to the specified destination along specified path.

Parameters:
dest - Destination of the navigation.
path - Navigation path to the destination.

keepNavigating

protected LoqueNavigator.Stage keepNavigating()
Navigates with the current navigation request.

Returns:
Stage of the navigation progress.

getNavPoint

protected NavPoint getNavPoint(ILocated location)
Returns NavPoint instance for a given location. If there is no navpoint in the vicinity of CLOSE_ENOUGH null is returned.

Parameters:
location -
Returns: