org.micropsi.comp.agent.turtle
Class BraitenbergWorldAdapter

java.lang.Object
  extended byorg.micropsi.comp.agent.turtle.BraitenbergWorldAdapter
All Implemented Interfaces:
AgentControllerIF, AgentWorldAdapterIF

public class BraitenbergWorldAdapter
extends java.lang.Object
implements AgentWorldAdapterIF, AgentControllerIF


Constructor Summary
BraitenbergWorldAdapter()
           
 
Method Summary
 ActionTranslatorIF[] createActionTranslators()
          Creates (or returns) the action translator objects of this adapter.
 AgentControllerIF createController()
          Creates (or simply returns) the agent controller object.
 PerceptTranslatorIF[] createPerceptTranslators()
          Creates (or returns) the percept translator objects of this adapter.
 UrgeCreatorIF[] createUrgeCreators()
          Creates (or returns) the urge creators of this adapter.
 void initialize(AgentIF agent, Logger logger)
          Initializes the adapter and provides some basic things the other methods will probably need.
 void notifyOfAction()
          This method is called directly after an action translator constructed an action and before it is sent to the world.
 void notifyOfActionResult(java.lang.String actionName, double result)
          This method is called when action result data is received from the world.
 void notifyOfPerception()
          This method is called directly after the framework received a new perception packet.
 void receiveBodyPropertyChanges(java.util.ArrayList propertyChanges)
          Body property changes are not ordinary perceptions, but immediate results of some action.
 void shutdown()
          This is called directly before destruction and should be used to unregister listeners etc.
 boolean wantsPerception()
          Checks if the agent is ready to receive perception data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BraitenbergWorldAdapter

public BraitenbergWorldAdapter()
Method Detail

initialize

public void initialize(AgentIF agent,
                       Logger logger)
                throws MicropsiException
Description copied from interface: AgentWorldAdapterIF
Initializes the adapter and provides some basic things the other methods will probably need. The agent object itself - cast it to your agent's implementation of the interface and the agent's logger.

This method is called once, directly after instantiating the WorldAdapter and before the create-methods are called.

Specified by:
initialize in interface AgentWorldAdapterIF
Parameters:
agent - the agent
logger - the agent's logger
Throws:
MicropsiException - if the world adapter can't be initialized for some reason

createController

public AgentControllerIF createController()
Description copied from interface: AgentWorldAdapterIF
Creates (or simply returns) the agent controller object.

This method is called once, directly after the initialize method was called.

Specified by:
createController in interface AgentWorldAdapterIF
Returns:
the AgentController object of the adapter

createActionTranslators

public ActionTranslatorIF[] createActionTranslators()
Description copied from interface: AgentWorldAdapterIF
Creates (or returns) the action translator objects of this adapter.

This method is called once, directly after the createController method.

Specified by:
createActionTranslators in interface AgentWorldAdapterIF
Returns:
the action translators of the world adapter.

createPerceptTranslators

public PerceptTranslatorIF[] createPerceptTranslators()
Description copied from interface: AgentWorldAdapterIF
Creates (or returns) the percept translator objects of this adapter.

This method is called once, directly after the createTranslators method.

Specified by:
createPerceptTranslators in interface AgentWorldAdapterIF
Returns:
the percept translators of the world adapter.

createUrgeCreators

public UrgeCreatorIF[] createUrgeCreators()
Description copied from interface: AgentWorldAdapterIF
Creates (or returns) the urge creators of this adapter.

Specified by:
createUrgeCreators in interface AgentWorldAdapterIF
Returns:
the urge creator

wantsPerception

public boolean wantsPerception()
Description copied from interface: AgentControllerIF
Checks if the agent is ready to receive perception data. If this method returns false, no perception data will be requested in a cycle, keeping the load on transportation and/or perception infrastructure low. You can of course always return true, but typically agents are not able to handle perception each step or even make good guesses on when it will make sense to have a look at the world again.

This method is called periodically every step.

Specified by:
wantsPerception in interface AgentControllerIF
Returns:
true if the agent does want to request perception data this step.

receiveBodyPropertyChanges

public void receiveBodyPropertyChanges(java.util.ArrayList propertyChanges)
Description copied from interface: AgentControllerIF
Body property changes are not ordinary perceptions, but immediate results of some action. The ArrayList passed to this method contains object of type MPerceptionValue. What exactly the world returns depends on the world implementation.

This method is called whenever an action response was received from the world, typically some steps after an action was sent to the world.

Specified by:
receiveBodyPropertyChanges in interface AgentControllerIF
Parameters:
propertyChanges - a List of MPerceptionValue with body parameter changes.

notifyOfPerception

public void notifyOfPerception()
Description copied from interface: AgentControllerIF
This method is called directly after the framework received a new perception packet. The packet contents are the (after this method returned) dispatched to the perception translators.

Specified by:
notifyOfPerception in interface AgentControllerIF

notifyOfAction

public void notifyOfAction()
Description copied from interface: AgentControllerIF
This method is called directly after an action translator constructed an action and before it is sent to the world. (Typically implementations of this method will do some cleanup)

Specified by:
notifyOfAction in interface AgentControllerIF

notifyOfActionResult

public void notifyOfActionResult(java.lang.String actionName,
                                 double result)
Description copied from interface: AgentControllerIF
This method is called when action result data is received from the world.

Specified by:
notifyOfActionResult in interface AgentControllerIF
Parameters:
actionName - the name of the action
result - the success code or value

shutdown

public void shutdown()
Description copied from interface: AgentControllerIF
This is called directly before destruction and should be used to unregister listeners etc.

Specified by:
shutdown in interface AgentControllerIF

(c) by Micropsi Project: http://www.cognitive-agents.org

.