public class GlobalMap extends java.lang.Object implements IGlobalMap, IEnvironmentModel, java.io.Serializable
Constructor and Description |
---|
GlobalMap(IAgentModel agentModel,
ILocalizer localizer,
IRCServerMetaModel metaModel,
java.lang.String teamname,
int playerNumber)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
attach(IObserver<IGlobalMap> newObserver)
Adds an observer to the list of observers if not already in the list
|
float |
centerCircleRadius() |
boolean |
detach(IObserver<IGlobalMap> oldObserver)
Detaches the passed observer to this connection
|
boolean |
equals(java.lang.Object o) |
float |
fieldHalfLength() |
float |
fieldHalfWith() |
Ball |
getBall()
Get a reference to the ball object
|
IFieldLine |
getFieldLine(java.lang.String name) |
java.util.Collection<IFieldLine> |
getFieldLines()
Get a list of all visible field lines
|
GameState |
getGameState()
Get the current play mode
|
float |
getGameTime()
Get the running time of the current game
|
float |
getGlobalTime()
Get the current global time
|
int |
getGoalsTheyScored()
Get the number of goals the opponent team scored
|
int |
getGoalsWeScored()
Get the number of goals our own team scored
|
org.apache.commons.math3.geometry.euclidean.threed.Vector3D |
getHomePosition()
Get home position for this agent in conjunction with the current game
state
|
ILandmark |
getLandmark(java.lang.String name) |
double |
getLandmarkError()
Calculate the average error between known and calculated position
|
java.util.Collection<ILandmark> |
getLandmarks()
Get a list of all visible landmarks
|
org.apache.commons.math3.geometry.euclidean.threed.Vector3D |
getOtherGoalPosition()
Retrieve the position of the other goal (position between the goal posts).
|
org.apache.commons.math3.geometry.euclidean.threed.Vector3D |
getOwnGoalPosition()
Retrieve the position of the own goal (position between the goal posts).
|
PlayMode |
getPlaymode() |
PlaySide |
getPlaySide()
Get play side
|
java.util.List<IReferenceLine> |
getReferenceLines()
Retrieve the list of known reference lines.
|
java.util.List<IReferencePoint> |
getReferencePoints()
Retrieve the list of known reference points.
|
int |
getServerVersion() |
TeamColor |
getTeamColor()
Currently only known for Humanoid League!
|
java.lang.String |
getTeamname(boolean ownTeam)
If ownTeam is true we return the team name of thisPlayer.
|
IThisPlayer |
getThisPlayer()
Get a reference to the player object of this player
|
float |
getTimeOfLastGameStateChange() |
IPlayer |
getVisiblePlayer(int id,
boolean ownTeam) |
java.util.List<IPlayer> |
getVisiblePlayers()
Get a list of all visible players
|
float |
goalHalfWith() |
float |
goalHeight() |
boolean |
isInCenterCircleArea(org.apache.commons.math3.geometry.euclidean.threed.Vector3D position,
float margin)
Checks if the given position is inside the center circle area and the
specified margin.
|
boolean |
isInOtherPenaltyArea(org.apache.commons.math3.geometry.euclidean.threed.Vector3D position,
float margin)
Checks if the given position is inside the other penalty area and the
specified margin.
|
boolean |
isInOwnHalf(org.apache.commons.math3.geometry.euclidean.threed.Vector3D position,
float margin)
Checks if the given position is inside the own half and the specified
margin.
|
boolean |
isInOwnPenaltyArea(org.apache.commons.math3.geometry.euclidean.threed.Vector3D position,
float margin)
Checks if the given position is inside the own penalty area and the
specified margin.
|
boolean |
isInSoccerPitchArea(org.apache.commons.math3.geometry.euclidean.threed.Vector3D position,
float margin)
Checks if the given position is inside the soccer pitch area and the
specified margin.
|
void |
logSituation(int which)
Writes out current situation information.
|
float |
penaltyHalfLength() |
float |
penaltyWith() |
boolean |
update(IPerception perception)
Called once perception is finished parsing a new incoming message
|
void |
updateBallFromHear(org.apache.commons.math3.geometry.euclidean.threed.Vector3D ballPos) |
public GlobalMap(IAgentModel agentModel, ILocalizer localizer, IRCServerMetaModel metaModel, java.lang.String teamname, int playerNumber)
agentModel
- Reference to the agent model objectlocalizer
- the module that calculates the agent's global positionmetaModel
- the meta model of the rc serverteamname
- Team nameplayerNumber
- Player numberpublic boolean update(IPerception perception)
update
in interface IGlobalMap
perception
- the object containing the result from parsingpublic void updateBallFromHear(org.apache.commons.math3.geometry.euclidean.threed.Vector3D ballPos)
ballPos
- public java.lang.String getTeamname(boolean ownTeam)
ownTeam
- true if from own team, false if from other teampublic IPlayer getVisiblePlayer(int id, boolean ownTeam)
getVisiblePlayer
in interface IGlobalMap
id
- the player's number (1-11)ownTeam
- true if we want the player of our own teampublic float getGlobalTime()
IGlobalMap
getGlobalTime
in interface IGlobalMap
public float getGameTime()
IGlobalMap
getGameTime
in interface IGlobalMap
public int getGoalsTheyScored()
IGlobalMap
getGoalsTheyScored
in interface IGlobalMap
public int getGoalsWeScored()
IGlobalMap
getGoalsWeScored
in interface IGlobalMap
public TeamColor getTeamColor()
public PlayMode getPlaymode()
public PlaySide getPlaySide()
public GameState getGameState()
IGlobalMap
getGameState
in interface IGlobalMap
public float getTimeOfLastGameStateChange()
public org.apache.commons.math3.geometry.euclidean.threed.Vector3D getHomePosition()
IGlobalMap
getHomePosition
in interface IGlobalMap
public Ball getBall()
IGlobalMap
getBall
in interface IGlobalMap
public java.util.Collection<ILandmark> getLandmarks()
IGlobalMap
getLandmarks
in interface IGlobalMap
public ILandmark getLandmark(java.lang.String name)
getLandmark
in interface IGlobalMap
name
- the name of the landmarkpublic double getLandmarkError()
IGlobalMap
getLandmarkError
in interface IGlobalMap
public java.util.Collection<IFieldLine> getFieldLines()
IGlobalMap
getFieldLines
in interface IGlobalMap
public IFieldLine getFieldLine(java.lang.String name)
getFieldLine
in interface IGlobalMap
name
- the name of the field linepublic java.util.List<IPlayer> getVisiblePlayers()
IGlobalMap
getVisiblePlayers
in interface IGlobalMap
public IThisPlayer getThisPlayer()
IGlobalMap
getThisPlayer
in interface IGlobalMap
public java.util.List<IReferenceLine> getReferenceLines()
IEnvironmentModel
getReferenceLines
in interface IEnvironmentModel
public java.util.List<IReferencePoint> getReferencePoints()
IEnvironmentModel
getReferencePoints
in interface IEnvironmentModel
public int getServerVersion()
getServerVersion
in interface IGlobalMap
public float fieldHalfLength()
fieldHalfLength
in interface ISoccerPitchDescription
public float fieldHalfWith()
fieldHalfWith
in interface ISoccerPitchDescription
public float penaltyHalfLength()
penaltyHalfLength
in interface ISoccerPitchDescription
public float penaltyWith()
penaltyWith
in interface ISoccerPitchDescription
public float goalHalfWith()
goalHalfWith
in interface ISoccerPitchDescription
public float goalHeight()
goalHeight
in interface ISoccerPitchDescription
public float centerCircleRadius()
centerCircleRadius
in interface ISoccerPitchDescription
public org.apache.commons.math3.geometry.euclidean.threed.Vector3D getOwnGoalPosition()
ISoccerPitchDescription
getOwnGoalPosition
in interface ISoccerPitchDescription
public org.apache.commons.math3.geometry.euclidean.threed.Vector3D getOtherGoalPosition()
ISoccerPitchDescription
getOtherGoalPosition
in interface ISoccerPitchDescription
public boolean isInOwnPenaltyArea(org.apache.commons.math3.geometry.euclidean.threed.Vector3D position, float margin)
ISoccerPitchDescription
isInOwnPenaltyArea
in interface ISoccerPitchDescription
position
- the position to testmargin
- the margin about which the own penalty area is enlarged
(positive values) or narrowed (negative values)public boolean isInOtherPenaltyArea(org.apache.commons.math3.geometry.euclidean.threed.Vector3D position, float margin)
ISoccerPitchDescription
isInOtherPenaltyArea
in interface ISoccerPitchDescription
position
- the position to testmargin
- the margin about which the own penalty area is enlarged
(positive values) or narrowed (negative values)public boolean isInOwnHalf(org.apache.commons.math3.geometry.euclidean.threed.Vector3D position, float margin)
ISoccerPitchDescription
isInOwnHalf
in interface ISoccerPitchDescription
position
- the position to testmargin
- the margin about which the area is enlarged (positive
values) or narrowed (negative values)public boolean isInCenterCircleArea(org.apache.commons.math3.geometry.euclidean.threed.Vector3D position, float margin)
ISoccerPitchDescription
isInCenterCircleArea
in interface ISoccerPitchDescription
position
- the position to testmargin
- the margin about which the own penalty area is enlarged
(positive values) or narrowed (negative values)public boolean isInSoccerPitchArea(org.apache.commons.math3.geometry.euclidean.threed.Vector3D position, float margin)
ISoccerPitchDescription
isInSoccerPitchArea
in interface ISoccerPitchDescription
position
- the position to testmargin
- the margin about which the own penalty area is enlarged
(positive values) or narrowed (negative values)public void attach(IObserver<IGlobalMap> newObserver)
ISubscribe
attach
in interface ISubscribe<IGlobalMap>
newObserver
- the observer that wants to be informedpublic boolean detach(IObserver<IGlobalMap> oldObserver)
IGlobalMap
detach
in interface IGlobalMap
oldObserver
- the observer that is no longer interested in new messagespublic boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public void logSituation(int which)
logSituation
in interface IGlobalMap
which
- allows to indicate different situations