cz.cuni.sposhBot.java
Class SPoshBot

java.lang.Object
  extended by cz.cuni.pogamut.Client.Agent
      extended by cz.cuni.pogamut.Client.ScriptedAgent
          extended by cz.cuni.sposhBot.java.SPoshBot
All Implemented Interfaces:
RcvMsgListener, Introspectable, java.lang.Runnable, java.util.EventListener
Direct Known Subclasses:
Main

public class SPoshBot
extends ScriptedAgent

This is class introduce a POSH as a reactive planner for the agent. Before starting the agent, you have to: 1) specify the plan file -> bindPlanFile() 2) specify the file with senses and actions -> bindScriptFile() For more info see examplePoshBot.py


Field Summary
protected  JavaBehaviour behaviour
           
protected  java.lang.String pathToJythonJar
          Path to jython jar which is needed for importing of the modules.
protected  java.lang.String pathToPogamutCore
          Path to directory where SPOSH engine module can be found.
protected  java.lang.String pathToSPOSH
          Path to directory where SPOSH engine module can be found.
protected  java.lang.String sposhPlanFile
          Here the path to '.lap' file will be stored (POSH plan).
 
Fields inherited from class cz.cuni.pogamut.Client.ScriptedAgent
engine, invocableEngine, scriptFileName
 
Fields inherited from class cz.cuni.pogamut.Client.Agent
bindedParserType, body, flagLogicTemporalyStopped, gameBotConnection, gameMap, GARBAGE_COLLECTOR_FREQUENCY, instancesAlive, iterationEndListeners, log, logicFrequency, logicFrequencyChanged, memory, oldLogicFrequency, parserLogger, pauseHolders, platformLog, random, rawGBLog
 
Constructor Summary
SPoshBot()
           
SPoshBot(JavaBehaviour behaviour, java.lang.String sposhPlanFileName)
           
SPoshBot(JavaBehaviour behaviour, java.lang.String sposhPlanFileName, java.lang.String pathToSPOSH, java.lang.String pathToJythonJar)
           
 
Method Summary
protected  void doLogic()
          This will call function doLogic() from specified scriptFileName.
protected  void engineIsGoingToBeBinded()
          Adding path to sposh module to system property Config.PYHTON_PATH
protected  JavaBehaviour getBehaviour()
           
protected  java.lang.String getPlanFile()
           
protected  boolean checkPreconditions()
           
protected  void init()
          Called only from constructors!
static void main(java.lang.String[] Args)
           
protected  void postPrepareAgent()
          This will call function postPrepareAgent() from specified logicFileName.
protected  void prePrepareAgent()
          This will call function prePrepareAgent() from specified logicFileName.
protected  void shutdownAgent()
          This will call function shutdownAgent() from specified logicFileName.
 
Methods inherited from class cz.cuni.pogamut.Client.ScriptedAgent
bindEngineByExtension, bindEngineByFileName, bindEngineByMimeType, bindEngineByName, bindScriptFile, bindScriptFile, createScriptEngineManager, engineBinded, evalFile, evalStream, getIntrospectableProxy, scriptFileBinded, setAgentAttributes, setAttribute, startAgent
 
Methods inherited from class cz.cuni.pogamut.Client.Agent
addIterationEndListener, bindLocalParser, bindRemoteParser, clearListeners, disconnect, finalize, getBindedParserType, getBody, getCommunicationState, getFlagLogicTemporalyStopped, getLogger, getLogicThread, getMap, getMediator, getMemory, getMilisecToSleep, getName, getPlatformLog, getRawDataLog, initBody, initGameMap, initLogging, initMemory, isRunning, logicReady, pauseLogic, receiveMessage, removeIterationEndListener, resumeLogic, run, sendMessageToGB, setFlagLogicTemporalyStopped, setLogicStartLatch, startAgent, stopAgentSoft
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pathToJythonJar

protected java.lang.String pathToJythonJar
Path to jython jar which is needed for importing of the modules.


pathToSPOSH

protected java.lang.String pathToSPOSH
Path to directory where SPOSH engine module can be found. May be setted from the outside, in fact the NB plugin is using this, to set path to pogamut platform diretory


pathToPogamutCore

protected java.lang.String pathToPogamutCore
Path to directory where SPOSH engine module can be found. May be setted from the outside, in fact the NB plugin is using this, to set path to pogamut platform diretory


sposhPlanFile

protected java.lang.String sposhPlanFile
Here the path to '.lap' file will be stored (POSH plan). Location of the sposhPlan which is needed for the SPOSH engine.


behaviour

protected JavaBehaviour behaviour
Constructor Detail

SPoshBot

public SPoshBot()
         throws ScriptedAgentException
Throws:
ScriptedAgentException

SPoshBot

public SPoshBot(JavaBehaviour behaviour,
                java.lang.String sposhPlanFileName,
                java.lang.String pathToSPOSH,
                java.lang.String pathToJythonJar)
         throws ScriptedAgentException
Throws:
ScriptedAgentException

SPoshBot

public SPoshBot(JavaBehaviour behaviour,
                java.lang.String sposhPlanFileName)
         throws ScriptedAgentException
Throws:
ScriptedAgentException
Method Detail

checkPreconditions

protected boolean checkPreconditions()
Overrides:
checkPreconditions in class ScriptedAgent

getBehaviour

protected JavaBehaviour getBehaviour()

getPlanFile

protected java.lang.String getPlanFile()

engineIsGoingToBeBinded

protected void engineIsGoingToBeBinded()
Adding path to sposh module to system property Config.PYHTON_PATH

Overrides:
engineIsGoingToBeBinded in class ScriptedAgent

init

protected void init()
             throws ScriptedAgentException
Called only from constructors! This will initialize the class according to the information in String properties of the object.

Throws:
ScriptedAgentException - is thrown when evaluation of the logic file fails
javax.script.ScriptException - is thrown when evaluation of misc. commands (setting python path) fails

doLogic

protected void doLogic()
Description copied from class: ScriptedAgent
This will call function doLogic() from specified scriptFileName.

It should do the logic iteration (assuming you're already connected and prePreparaAgent and postPrepareAgent were already called).

Overrides:
doLogic in class ScriptedAgent

postPrepareAgent

protected void postPrepareAgent()
                         throws PogamutException
Description copied from class: ScriptedAgent
This will call function postPrepareAgent() from specified logicFileName.

prepare logic according to information gathered from startCommunication like choosing plan/parameters according to game type.

Overrides:
postPrepareAgent in class ScriptedAgent
Throws:
PogamutException

prePrepareAgent

protected void prePrepareAgent()
                        throws PogamutException
This will call function prePrepareAgent() from specified logicFileName.

prepares agent logic to run - like initializing neural networks etc. not for establishing communication!

Overrides:
prePrepareAgent in class ScriptedAgent
Throws:
PogamutException

shutdownAgent

protected void shutdownAgent()
                      throws PogamutException
This will call function shutdownAgent() from specified logicFileName.

Clean - up after the end of simulation of agent

Overrides:
shutdownAgent in class ScriptedAgent
Throws:
PogamutException

main

public static void main(java.lang.String[] Args)