cz.cuni.sposhBot.python
Class SPoshBot

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

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  java.lang.String pathToJythonJar
          Path to jython jar which is needed for importing of the modules.
protected  java.lang.String pathToPogamutCore
          Path to Pogamut Core jar file.
protected  java.lang.String pathToSPOSH
          Path to directory where SPOSH engine module can be found.
protected  java.lang.String pyFileName
          Here will be stored the path to '.py' file with the sensors and effectors.
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(java.lang.String pyFileName, java.lang.String sposhPlanFileName)
           
SPoshBot(java.lang.String pyFileName, java.lang.String sposhPlanFileName, java.lang.String pathToPogamutCore)
           
SPoshBot(java.lang.String pyFileName, java.lang.String sposhPlanFileName, java.lang.String pathToSPOSH, java.lang.String pathToJythonJar, java.lang.String pathToPogamutCore)
           
 
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  void init()
          Called only from constructors!
static void main(java.lang.String[] Args)
           
protected  void postPrepareAgent()
          This will call function postPrepareAgent() from specified logicFileName.
 
Methods inherited from class cz.cuni.pogamut.Client.ScriptedAgent
bindEngineByExtension, bindEngineByFileName, bindEngineByMimeType, bindEngineByName, bindScriptFile, bindScriptFile, createScriptEngineManager, engineBinded, evalFile, evalStream, getIntrospectableProxy, checkPreconditions, prePrepareAgent, scriptFileBinded, setAgentAttributes, setAttribute, shutdownAgent, 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


pyFileName

protected java.lang.String pyFileName
Here will be stored the path to '.py' file with the sensors and effectors.


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.


pathToPogamutCore

protected java.lang.String pathToPogamutCore
Path to Pogamut Core jar file.

Constructor Detail

SPoshBot

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

SPoshBot

public SPoshBot(java.lang.String pyFileName,
                java.lang.String sposhPlanFileName)
         throws ScriptedAgentException
Throws:
ScriptedAgentException

SPoshBot

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

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

main

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