cz.cuni.amis.pogamut.ut2004.agent.module.sensor
Class NavPoints

Package class diagram package NavPoints
java.lang.Object
  extended by cz.cuni.amis.pogamut.base.agent.module.AgentModule<AGENT>
      extended by cz.cuni.amis.pogamut.base.agent.module.SensorModule<UT2004Bot>
          extended by cz.cuni.amis.pogamut.ut2004.agent.module.sensor.NavPoints
All Implemented Interfaces:
IComponent

public class NavPoints
extends SensorModule<UT2004Bot>

Memory module specialized on getting NavPoints from the IWorldView.

Auto updating

All NavPoint objects returned by this memory module are always self-updating throughout the time, until the associated navPoint leaves the game. This means that once a valid NavPoint object is obtained, it is not necessary to call any methods of this memory module to get the object's info updated (e.g. navpoint's location, visibility, reachability, etc.). The object will autoupdate itself.

The same principle is applied to all Maps returned by this memory module. Each returned Map is self-updating throughout the time. Once a specific Map is obtained (e.g. a map of visible enemies) from this memory module, the Map will get updated based on actions of the navPoints (e.g. joining or leaving the game, changing their team, moving around the map, etc.) automatically.

Note: All Maps returned by this memory module are locked and can not be modified outside this memory module. If you need to modify a Map returned by this module (for your own specific purpose), create a duplicate first. Such duplicates, however and of course, will not get updated.

WARNING:It is totally unclear what UT2004 means by reachable!!!

It is designed to be initialized inside IUT2004BotController.prepareBot(UT2004Bot) method call and may be used since IUT2004BotController.botInitialized(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo, cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.ConfigChange, cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.InitedMessage) is called.

Author:
Jimmy

Field Summary
 
Fields inherited from class cz.cuni.amis.pogamut.base.agent.module.SensorModule
worldView
 
Fields inherited from class cz.cuni.amis.pogamut.base.agent.module.AgentModule
agent, controller, eventBus, log
 
Constructor Summary
NavPoints(UT2004Bot bot)
          Constructor.
NavPoints(UT2004Bot bot, Logger log)
          Constructor.
 
Method Summary
 boolean canSeeNavPoints()
          Tells, whether the agent sees any other navPoints.
protected  void cleanUp()
           
 NavPoint getNavPoint(UnrealId UnrealId)
          Retreives last known info about given navPoint.
 Map<UnrealId,NavPoint> getNavPoints()
          Retreives a Map of all navPoints.
 NavPoint getNearestNavPoint(ILocated location)
          Returns nearest NavPoint to the 'location'.
 NavPoint getNearestVisibleNavPoint()
          Returns nearest-visible navPoint - if no if no navPoint is visible returns null.
 NavPoint getNearestVisibleNavPoint(Collection<NavPoint> navPoints)
          Returns nearest-visible navPoint to the bot from the collection of 'navPoints' - if no navPoint is visible returns null.
 NavPoint getRandomNavPoint()
          Returns random navigation point.
 NavPoint getRandomVisibleNavPoint()
          Returns random visible navPoint - if no if no navPoint is visible returns null.
 NavPoint getRecentlyVisibleNavPoint(double recently)
          Returns nearest navPoint that is visible or that was 'recently' visible.
 NavPoint getVisibleNavPoint(UnrealId UnrealId)
          Retrieves info about given navPoint, but only it the navPoint is visible.
 Map<UnrealId,NavPoint> getVisibleNavPoints()
          Retrieves a Map of all visible navPoints.
 
Methods inherited from class cz.cuni.amis.pogamut.base.agent.module.AgentModule
getComponentId, getLog, getState, initComponentId, isRunning, kill, pause, reset, resume, start, stop, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NavPoints

public NavPoints(UT2004Bot bot)
Constructor. Setups the memory module based on bot's world view.

Parameters:
bot - owner of the module that is using it

NavPoints

public NavPoints(UT2004Bot bot,
                 Logger log)
Constructor. Setups the memory module based on bot's world view.

Parameters:
bot - owner of the module that is using it
log - Logger to be used for logging runtime/debug info. If null, module creates its own logger.
Method Detail

getNavPoint

public NavPoint getNavPoint(UnrealId UnrealId)
Retreives last known info about given navPoint.

Note: The returned NavPoint object is self updating throughout time. Once you have a valid NavPoint object, you do not have to call this method to get updated info about that navPoint.

Parameters:
UnrealId - NavPoint UnrealId to be retreived.
Returns:
Last known navPoint info; or null upon none.
See Also:
getVisibleNavPoint(UnrealId), getReachableNavPoint(UnrealId)

getRandomNavPoint

public NavPoint getRandomNavPoint()
Returns random navigation point.

Returns:

getNearestNavPoint

public NavPoint getNearestNavPoint(ILocated location)
Returns nearest NavPoint to the 'location'.

Parameters:
location -
Returns:

getVisibleNavPoint

public NavPoint getVisibleNavPoint(UnrealId UnrealId)
Retrieves info about given navPoint, but only it the navPoint is visible.

Note: The returned NavPoint object is self updating throughout time. Once you have a valid NavPoint object, you do not have to call this method to get updated info about visibility of that navPoint.

Parameters:
UnrealId - NavPoint UnrealId to be retrieved.
Returns:
NavPoint info; or null upon none or not visible.
See Also:
getNavPoint(UnrealId), getReachableNavPoint(UnrealId)

getNavPoints

public Map<UnrealId,NavPoint> getNavPoints()
Retreives a Map of all navPoints.

Note: The returned Map is unmodifiable and self updating throughout time. Once you obtain a specific Map of navPoints from this memory module, the Map will get updated based on actions of the navPoints (e.g. joining or leaving the game, changing their status, etc.).

Returns:
Map of all navPoints, using their UnrealIds as keys.
See Also:
getEnemies(), getFriends(), getVisibleNavPoints(), getReachableNavPoints()

getVisibleNavPoints

public Map<UnrealId,NavPoint> getVisibleNavPoints()
Retrieves a Map of all visible navPoints.

Note: The returned Map is unmodifiable and self updating throughout time. Once you obtain a specific Map of navPoints from this memory module, the Map will get updated based on actions of the navPoints (e.g. joining or leaving the game, or changing their visibility, etc.).

Returns:
Map of all visible navPoints, using their UnrealIds as keys.
See Also:
getNavPoints(), getVisibleEnemies(), getVisibleFriends(), canSeeNavPoints()

getRecentlyVisibleNavPoint

public NavPoint getRecentlyVisibleNavPoint(double recently)
Returns nearest navPoint that is visible or that was 'recently' visible. If no such navPoint exists, returns null.

Parameters:
recently - how long the navPoint may be non-visible. IN MILISECONDS!
Returns:
nearest visible or 'recentlyVisibleTime' visible navPoint

getNearestVisibleNavPoint

public NavPoint getNearestVisibleNavPoint()
Returns nearest-visible navPoint - if no if no navPoint is visible returns null.

Returns:
nearest visible navPoint

getNearestVisibleNavPoint

public NavPoint getNearestVisibleNavPoint(Collection<NavPoint> navPoints)
Returns nearest-visible navPoint to the bot from the collection of 'navPoints' - if no navPoint is visible returns null.

Parameters:
navPoints - collection to go through
Returns:
nearest visible navPoint from the collection

getRandomVisibleNavPoint

public NavPoint getRandomVisibleNavPoint()
Returns random visible navPoint - if no if no navPoint is visible returns null.

Returns:
random visible navPoint

canSeeNavPoints

public boolean canSeeNavPoints()
Tells, whether the agent sees any other navPoints.

Returns:
True, if at least one other navPoint is visible; false otherwise.
See Also:
getVisibleNavPoints()

cleanUp

protected void cleanUp()
Overrides:
cleanUp in class AgentModule<UT2004Bot>


Copyright © 2014 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.