cz.cuni.amis.pogamut.ut2004.agent.module.sensor.visibility
Class Visibility

Package class diagram package Visibility
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.visibility.Visibility
All Implemented Interfaces:
IComponent

public class Visibility
extends SensorModule<UT2004Bot>

Module that provides visibility information for the map. The visibility is approximated from VisibilityLocations for which we have VisibilityMatrix built. Note that the module expects "VisibilityMatrix-" + mapName + "-All.bin" file present in the current directory of the process "." (preferred) or directory specified in PogamutUT2004.properties under PogamutUT2004Property.POGAMUT_UT2004_VISIBILITY_DIRECTORY. This file can be generated utilizing VisibilityCreator and its VisibilityCreator.main(String[]) method.

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
Visibility(UT2004Bot bot, AgentInfo info)
          Constructor.
Visibility(UT2004Bot bot, AgentInfo info, Logger log)
          Constructor.
 
Method Summary
protected  void cleanUp()
           
 Set<NavPoint> getCoverNavPointsFrom(ILocated loc)
          Returns set of NavPoint that are not visible from "loc".
 Set<NavPoint> getCoverNavPointsFromN(ILocated... enemies)
          Returns set of NavPoint that are not visible from any 'enemies'.
 Set<VisibilityLocation> getCoverPointsFrom(ILocated loc)
          Returns set of VisibilityLocation that are not visible from "loc".
 Set<VisibilityLocation> getCoverPointsFromN(ILocated... enemies)
          Returns set of VisibilityLocation that are not visible from any 'enemies'.
 Set<NavPoint> getHiddenNavPoints()
          Returns set of NavPoint that are not visible FROM CURRENT BOT LOCATION.
 Set<VisibilityLocation> getHiddenPoints()
          Returns set of VisibilityLocation that are not visible FROM BOT CURRENT LOCATION.
 VisibilityMatrix getMatrix()
          Returns underlying VisibilityMatrix that is neede for custom advanced computation.
 NavPoint getNearestCoverNavPointFrom(ILocated enemy)
          Returns nearest cover NavPoint for BOT where to hide from 'enemy'.
 NavPoint getNearestCoverNavPointFromN(ILocated target, ILocated... enemies)
          Returns nearest cover nav point for 'target' that is hidden from all 'enemies'.
 NavPoint getNearestCoverNavPointN(ILocated... enemies)
          Returns nearest cover nav point for BOT that is hidden from all 'enemies'.
 VisibilityLocation getNearestCoverPointFrom(ILocated enemy)
          Returns nearest cover point for BOT where to hide from 'enemy'.
 VisibilityLocation getNearestCoverPointFromN(ILocated target, ILocated... enemies)
          Returns nearest cover point for 'target' that is hidden from all 'enemies'.
 VisibilityLocation getNearestCoverPointN(ILocated... enemies)
          Returns nearest cover point for BOT that is hidden from all 'enemies'.
 NavPoint getNearestNavPointTo(ILocated located)
          Nearest NavPoint to 'located' present in the matrix, this should equal (== 99.99%) to nearest navpoint in the map.
 NavPoint getNearestNavPopint()
          Nearest NavPoint to BOT CURRENT LOCATION present in the matrix, this should equal (== 99.99%) to nearest navpoint (to bot) in the map.
 VisibilityLocation getNearestVisibilityLocation()
          Nearest VisibilityLocation to BOT CURRENT LOCATION.
 VisibilityLocation getNearestVisibilityLocationTo(ILocated located)
          Nearest VisibilityLocation to 'located' present in matrix.
 Set<NavPoint> getVisibleNavPoints()
          Returns set of NavPoint that are visible FROM CURRENT BOT LOCATION.
 Set<NavPoint> getVisibleNavPointsFrom(ILocated loc)
          Returns set of NavPoint that are visible from "loc".
 Set<VisibilityLocation> getVisiblePoints()
          Returns set of VisibilityLocation that are visible FROM CURRENT BOT LOCATION.
 Set<VisibilityLocation> getVisiblePointsFrom(ILocated loc)
          Returns set of VisibilityLocation that are visible from "loc".
 boolean isInitialized()
          Tells you whether the module is initialized, e.g., visibility matrix information is available for the level.
 boolean isVisible(ILocated target)
          Returns whether BOT can see 'target' (and vice versa == symmetric info).
 boolean isVisible(ILocated loc1, ILocated loc2)
          Returns whether 'loc1' is visible from 'loc2' (and vice versa == symmetric info).
 
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

Visibility

public Visibility(UT2004Bot bot,
                  AgentInfo info)
Constructor. Setups the memory module based on bot's world view.

Parameters:
bot - owner of the module that is using it
info - AgentInfo module to be used

Visibility

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

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

isInitialized

public boolean isInitialized()
Tells you whether the module is initialized, e.g., visibility matrix information is available for the level. See VisibilityCreator that contains VisibilityCreator.main(String[]) method implemented for quick generation of VisibilityMatrix that is used for obtaining all visibility information for the level.

Returns:

getMatrix

public VisibilityMatrix getMatrix()
Returns underlying VisibilityMatrix that is neede for custom advanced computation.

Returns:

getNearestVisibilityLocationTo

public VisibilityLocation getNearestVisibilityLocationTo(ILocated located)
Nearest VisibilityLocation to 'located' present in matrix. I.e., nearest VisibilityLocation we're having visibility information for.

Parameters:
located -
Returns:

getNearestVisibilityLocation

public VisibilityLocation getNearestVisibilityLocation()
Nearest VisibilityLocation to BOT CURRENT LOCATION. I.e., nearest VisibilityLocation we're having visibility information for.

Returns:

getNearestNavPointTo

public NavPoint getNearestNavPointTo(ILocated located)
Nearest NavPoint to 'located' present in the matrix, this should equal (== 99.99%) to nearest navpoint in the map.

Parameters:
located -
Returns:

getNearestNavPopint

public NavPoint getNearestNavPopint()
Nearest NavPoint to BOT CURRENT LOCATION present in the matrix, this should equal (== 99.99%) to nearest navpoint (to bot) in the map.

Returns:

isVisible

public boolean isVisible(ILocated loc1,
                         ILocated loc2)
Returns whether 'loc1' is visible from 'loc2' (and vice versa == symmetric info). Note that the information is only approximated from nearest known VisibilityLocation. The information is accurate for navpoints and very accurate for points on links between navpoints. If module is not isInitialized(), returns false.

Parameters:
loc1 -
loc2 -
Returns:

isVisible

public boolean isVisible(ILocated target)
Returns whether BOT can see 'target' (and vice versa == symmetric info). Note that the information is only approximated from nearest known VisibilityLocation. The information is accurate for navpoints and very accurate for points on links between navpoints. If module is not isInitialized(), returns false.

Parameters:
target -
Returns:

getCoverPointsFrom

public Set<VisibilityLocation> getCoverPointsFrom(ILocated loc)
Returns set of VisibilityLocation that are not visible from "loc".

Parameters:
loc -
Returns:

getHiddenPoints

public Set<VisibilityLocation> getHiddenPoints()
Returns set of VisibilityLocation that are not visible FROM BOT CURRENT LOCATION.

Returns:

getNearestCoverPointFrom

public VisibilityLocation getNearestCoverPointFrom(ILocated enemy)
Returns nearest cover point for BOT where to hide from 'enemy'.

Parameters:
enemy -
Returns:

getVisiblePointsFrom

public Set<VisibilityLocation> getVisiblePointsFrom(ILocated loc)
Returns set of VisibilityLocation that are visible from "loc".

Parameters:
loc -
Returns:

getVisiblePoints

public Set<VisibilityLocation> getVisiblePoints()
Returns set of VisibilityLocation that are visible FROM CURRENT BOT LOCATION.

Returns:

getCoverNavPointsFrom

public Set<NavPoint> getCoverNavPointsFrom(ILocated loc)
Returns set of NavPoint that are not visible from "loc".

Parameters:
loc -
Returns:

getHiddenNavPoints

public Set<NavPoint> getHiddenNavPoints()
Returns set of NavPoint that are not visible FROM CURRENT BOT LOCATION.

Returns:

getNearestCoverNavPointFrom

public NavPoint getNearestCoverNavPointFrom(ILocated enemy)
Returns nearest cover NavPoint for BOT where to hide from 'enemy'.

Parameters:
enemy -
Returns:

getVisibleNavPointsFrom

public Set<NavPoint> getVisibleNavPointsFrom(ILocated loc)
Returns set of NavPoint that are visible from "loc".

Parameters:
loc -
Returns:

getVisibleNavPoints

public Set<NavPoint> getVisibleNavPoints()
Returns set of NavPoint that are visible FROM CURRENT BOT LOCATION.

Returns:

getCoverPointsFromN

public Set<VisibilityLocation> getCoverPointsFromN(ILocated... enemies)
Returns set of VisibilityLocation that are not visible from any 'enemies'.

Parameters:
enemies -
Returns:

getNearestCoverPointFromN

public VisibilityLocation getNearestCoverPointFromN(ILocated target,
                                                    ILocated... enemies)
Returns nearest cover point for 'target' that is hidden from all 'enemies'.

Parameters:
target -
enemies -
Returns:

getNearestCoverPointN

public VisibilityLocation getNearestCoverPointN(ILocated... enemies)
Returns nearest cover point for BOT that is hidden from all 'enemies'.

Parameters:
target -
enemies -
Returns:

getCoverNavPointsFromN

public Set<NavPoint> getCoverNavPointsFromN(ILocated... enemies)
Returns set of NavPoint that are not visible from any 'enemies'.

Parameters:
enemies -
Returns:

getNearestCoverNavPointFromN

public NavPoint getNearestCoverNavPointFromN(ILocated target,
                                             ILocated... enemies)
Returns nearest cover nav point for 'target' that is hidden from all 'enemies'.

Parameters:
target -
enemies -
Returns:

getNearestCoverNavPointN

public NavPoint getNearestCoverNavPointN(ILocated... enemies)
Returns nearest cover nav point for BOT that is hidden from all 'enemies'.

Parameters:
enemies -
Returns:

cleanUp

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


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