public abstract class StateSposhLogicController<BOT extends cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004Bot,CONTEXT extends IUT2004Context> extends SposhLogicController<BOT,cz.cuni.amis.pogamut.sposh.executor.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_CATEGORY| Constructor and Description |
|---|
StateSposhLogicController() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract CONTEXT |
createContext()
Create context for this logic controller.
|
protected cz.cuni.amis.pogamut.sposh.executor.StateWorkExecutor |
createWorkExecutor()
Create
IWorkExecutor that will execute primitives contained in the plan. |
protected void |
customPrimitiveInstantiation(cz.cuni.amis.pogamut.sposh.executor.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.
|
protected abstract String |
getPlan()
Get Yaposh plan this bot is supposed to execute.
|
protected List<String> |
getPlans()
Take the plan from
getPlan() and return it as the single plan
of the bot. |
void |
initializeController(BOT bot)
Initialize logic controller=call super initialization and create context
and other stuff that is needed to have.
|
createTimer, getEngines, getPlanFromFile, getPlanFromResource, getPlanFromStream, getPlansFromDirectory, getTimer, getWorkExecutor, logic, logicAfterPlan, logicBeforePlanbeforeFirstLogic, getLogicInitializeTime, getLogicShutdownTime, initializeLogic, logicInitialize, logicShutdownbotFirstSpawn, botInitialized, botKilled, botShutdown, getAct, getBot, getInitializeCommand, getLog, getName, getPassword, getWorldView, mapInfoObtained, prepareBotprotected CONTEXT extends IUT2004Context context
public void initializeController(BOT bot)
initializeController in interface cz.cuni.amis.pogamut.ut2004.bot.IUT2004BotController<BOT extends cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004Bot>initializeController in class SposhLogicController<BOT extends cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004Bot,cz.cuni.amis.pogamut.sposh.executor.StateWorkExecutor>bot - public void finishControllerInitialization()
finishControllerInitialization in interface cz.cuni.amis.pogamut.ut2004.bot.IUT2004BotController<BOT extends cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004Bot>finishControllerInitialization in class cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004BotController<BOT extends cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004Bot>public final CONTEXT getContext()
protected void customPrimitiveInstantiation(cz.cuni.amis.pogamut.sposh.executor.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 cz.cuni.amis.pogamut.sposh.executor.StateWorkExecutor createWorkExecutor()
SposhLogicControllerIWorkExecutor that will execute primitives contained in the plan.
This method will be called only once.createWorkExecutor in class SposhLogicController<BOT extends cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004Bot,cz.cuni.amis.pogamut.sposh.executor.StateWorkExecutor>protected List<String> getPlans() throws IOException
getPlan() and return it as the single plan
of the bot.getPlans in class SposhLogicController<BOT extends cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004Bot,cz.cuni.amis.pogamut.sposh.executor.StateWorkExecutor>getPlan().IOExceptionSposhLogicController.getPlans()protected abstract String getPlan() throws IOException
SposhLogicController.getPlanFromResource(java.lang.String), SposhLogicController.getPlanFromFile(java.lang.String) or SposhLogicController.getPlanFromStream(java.io.InputStream).IOExceptionprotected abstract CONTEXT createContext()
Copyright © 2018 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All rights reserved.