public abstract class StateSposhLogicController<BOT extends UT2004Bot,CONTEXT extends IUT2004Context> extends SposhLogicController<BOT,StateWorkExecutor>
PoshEngine, IWorkExecutor and Context during initializeController(cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004Bot).
The IWorkExecutor takes all primitives from the plan and automatically
tries to instantiate them.
The automatic instantiation expects that names of the primitives are fully
qualified names of classes (e.g. cz.cuni.pogamut.senses.Fail) that implement
ISense for senses and IAction for actions. The classes are
expected to have public constructor with one parameter that is of type CONTEXT
(or its parent). It may be convinient to use classes StateAction and
StateSense as basic classes for your own custom primitives.
Custom instantiation can be utilized in method customPrimitiveInstantiation(cz.cuni.amis.pogamut.sposh.executor.StateWorkExecutor, java.util.Set, java.util.Set),
simply insert your own primitives into the StateWorkExecutor. When automatic
instantiation detects, that primitive with some name (probaly name that is not
FQN of class) is already defined in the executor, the name is skipped (IOW: if
you add sense hurt in the custom instantion, it won't cause error later one,
although it is not defined by any class).| Modifier and Type | Field and Description |
|---|---|
protected CONTEXT |
context
Context for states.
|
SPOSH_LOG_CATEGORYlogicModulebot, log, USER_LOG_CATEGORY_ID| Constructor and Description |
|---|
StateSposhLogicController() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract CONTEXT |
createContext()
Create context for this logic controller.
|
protected StateWorkExecutor |
createWorkExecutor()
Create
IWorkExecutor that will execute primitives contained in the plan. |
protected void |
customPrimitiveInstantiation(StateWorkExecutor executor,
Set<String> actions,
Set<String> senses)
To be overriden in children, this method enables user to instantiate
primitives in any way it desires.
|
void |
finishControllerInitialization() |
CONTEXT |
getContext()
Get context.
|
void |
initializeController(BOT bot)
Initialize logic controller=call super initialization and create context
and other stuff that is needed to have.
|
createTimer, getEngine, getPlan, getPlanFromFile, getPlanFromResource, getPlanFromStream, getTimer, getWorkExecutor, logic, logicAfterPlan, logicBeforePlanbeforeFirstLogic, getLogicInitializeTime, getLogicShutdownTime, initializeLogic, logicInitialize, logicShutdownbotFirstSpawn, botInitialized, botKilled, botShutdown, getAct, getBot, getInitializeCommand, getLog, getPassword, getWorldView, prepareBotclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbotFirstSpawn, botInitialized, botKilled, botShutdown, getAct, getBot, getInitializeCommand, getLog, getPassword, getWorldView, prepareBotprotected CONTEXT extends IUT2004Context context
public void initializeController(BOT bot)
initializeController in interface IUT2004BotController<BOT extends UT2004Bot>initializeController in class SposhLogicController<BOT extends UT2004Bot,StateWorkExecutor>bot - public void finishControllerInitialization()
finishControllerInitialization in interface IUT2004BotController<BOT extends UT2004Bot>finishControllerInitialization in class UT2004BotController<BOT extends UT2004Bot>public final CONTEXT getContext()
protected void customPrimitiveInstantiation(StateWorkExecutor executor, Set<String> actions, Set<String> senses)
executor - executor that will be used for primitives (empty, no primitive should be defined yet)actions - set of actions used in the plan (unmodifiable)senses - set of senses used in the plan (unmodifiable)protected StateWorkExecutor createWorkExecutor()
SposhLogicControllerIWorkExecutor that will execute primitives contained in the plan.
This method will be called only once.createWorkExecutor in class SposhLogicController<BOT extends UT2004Bot,StateWorkExecutor>protected abstract CONTEXT createContext()
Copyright © 2012 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.