|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object cz.cuni.amis.pogamut.unreal.bot.impl.NativeUnrealBotAdapter
public abstract class NativeUnrealBotAdapter
IUnrealAgent adapter for native players. Not all operations are supported.
Field Summary | |
---|---|
protected IAct |
act
|
protected IPlayer |
player
|
protected IUnrealServer |
server
|
protected IWorldView |
worldView
|
Constructor Summary | |
---|---|
NativeUnrealBotAdapter(IPlayer player,
IUnrealServer server,
IAct act,
IWorldView worldView)
|
Method Summary | |
---|---|
boolean |
equals(java.lang.Object other)
|
IAct |
getAct()
|
IAgentId |
getComponentId()
Returns agent id - contains also a human-readable name that can be changed |
IComponentBus |
getEventBus()
IComponentBus that the instance is working with. |
Folder |
getIntrospection()
Returns folder with introspection information. |
Location |
getLocation()
Retreives current location of the object. |
IAgentLogger |
getLogger()
Returns AgentLogger for the instance allowing creating new log categories or adding new handlers to them. |
java.lang.String |
getName()
Returns human-readable agent's name. |
Rotation |
getRotation()
Retreives current rotation of the object. |
ImmutableFlag<IAgentState> |
getState()
Returns the state of the agent (whether it's running / dead / etc.). |
Velocity |
getVelocity()
Retreives current direction and velocity of movement of the object. |
IWorldView |
getWorldView()
|
int |
hashCode()
|
void |
kill()
Stops the agent (unconditionally), closing whatever connection it may have, this method must be non-blocking + interrupting all the communication, logic or whatever threads the agent may have. |
void |
pause()
This should pause the the agent. |
void |
resume()
This should resume the logic of the agent. |
void |
start()
Attempt to launch the agent. |
void |
startPaused()
Attempt to launch the agent. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface cz.cuni.amis.pogamut.unreal.bot.IUnrealBot |
---|
respawn |
Methods inherited from interface cz.cuni.amis.pogamut.base.agent.IAgent |
---|
stop |
Field Detail |
---|
protected IPlayer player
protected IUnrealServer server
protected IAct act
protected IWorldView worldView
Constructor Detail |
---|
public NativeUnrealBotAdapter(IPlayer player, IUnrealServer server, IAct act, IWorldView worldView)
Method Detail |
---|
public IAct getAct()
getAct
in interface IEmbodiedAgent
public IWorldView getWorldView()
getWorldView
in interface IObservingAgent
public IAgentId getComponentId()
IAgent
getComponentId
in interface IAgent
getComponentId
in interface IComponent
public java.lang.String getName()
IAgent
Do not use as unique id of the agent:
1) the name might change during the life of agent
2) we do not ensure it's unique
Use getComponentId().getToken() instead!
Use getComponentId().getName().setFlag() to change the name of the agent.
getName
in interface IAgent
public IAgentLogger getLogger()
IAgent
getLogger
in interface IAgent
public IComponentBus getEventBus()
IComponentAware
IComponentBus
that the instance is working with.
Note that by design-choice - the IComponentBus
is a singleton inside AgentScoped
,
therefore you don't have to necessarily obtain the instance through the component, it suffice
to obtain it using injection into your object.
getEventBus
in interface IComponentAware
public ImmutableFlag<IAgentState> getState()
IAgent
Note that the type AgentState wraps two things:
getState
in interface IAgent
public void start() throws AgentException
IAgent
This method is not suitable for simultaneous start of multiple agents that should start working together in the environment.
(I.e., during tournaments of agents when you need to synchronize their start in the environment.) In such cases
use IAgent.startPaused()
and then multiple threads+barrier to execute IAgent.resume()
of all agents at once.
start
in interface IAgent
start
in interface IControllable
AgentException
public void startPaused() throws AgentException
IAgent
In contrast with IAgent.start()
this method will initialize the agent inside the environment but pauses
it after the start (i.e., its reasoning should not run, the action should not do any decisions).
To fully start the agent, you need to IAgent.resume()
it.
It is designed to provide safe synchronization of multiple agent simulations when you need to start the reasoning of agents synchronously.
startPaused
in interface IAgent
AgentException
public void pause() throws AgentException
IAgent
pause
in interface IAgent
AgentException
public void resume() throws AgentException
IAgent
resume
in interface IAgent
AgentException
public void kill()
IAgent
After calling kill() method, the only method that may be called is getState() to examine state of the agent.
This also equals to "exception happened outside the agent" and "IFatalErrorEvent
should be propagated inside
the agent"
kill
in interface IAgent
kill
in interface IControllable
public Folder getIntrospection()
IAgent
getIntrospection
in interface IAgent
public Location getLocation()
ILocated
getLocation
in interface ILocated
public Velocity getVelocity()
ILocomotive
getVelocity
in interface ILocomotive
public Rotation getRotation()
IRotable
getRotation
in interface IRotable
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |