cz.cuni.amis.pogamut.sposh.usar2004
Class StateSposhLogicController<BOT extends cz.cuni.amis.pogamut.usar2004.agent.USAR2004Bot,CONTEXT extends IUSAR2004Context>
java.lang.Object
cz.cuni.amis.pogamut.usar2004.agent.USAR2004BotController<BOT>
cz.cuni.amis.pogamut.usar2004.agent.module.logic.USAR2004BotLogicController<BOT>
cz.cuni.amis.pogamut.sposh.usar2004.SposhLogicController<BOT,cz.cuni.amis.pogamut.sposh.executor.StateWorkExecutor>
cz.cuni.amis.pogamut.sposh.usar2004.StateSposhLogicController<BOT,CONTEXT>
- All Implemented Interfaces:
- cz.cuni.amis.pogamut.base.agent.module.IAgentLogic<cz.cuni.amis.pogamut.base.agent.module.LogicModule>, cz.cuni.amis.pogamut.usar2004.agent.IUSAR2004BotController<BOT>, cz.cuni.amis.pogamut.usar2004.agent.module.logic.IUSAR2004BotLogicController<BOT,cz.cuni.amis.pogamut.base.agent.module.LogicModule>
public abstract class StateSposhLogicController<BOT extends cz.cuni.amis.pogamut.usar2004.agent.USAR2004Bot,CONTEXT extends IUSAR2004Context>
- extends SposhLogicController<BOT,cz.cuni.amis.pogamut.sposh.executor.StateWorkExecutor>
This class should be used as base for bot that utilizes sposh and state primitives.
It is failry simple, it creates PoshEngine, IWorkExecutor and Context during StateSposhLogicController#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).
- Author:
- Honza
| Fields inherited from class cz.cuni.amis.pogamut.usar2004.agent.module.logic.USAR2004BotLogicController |
logicModule |
| Fields inherited from class cz.cuni.amis.pogamut.usar2004.agent.USAR2004BotController |
bot, log, user, USER_LOG_CATEGORY_ID |
|
Method Summary |
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. |
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. |
| Methods inherited from class cz.cuni.amis.pogamut.sposh.usar2004.SposhLogicController |
createTimer, getEngine, getPlan, getPlanFromFile, getPlanFromResource, getPlanFromStream, getTimer, getWorkExecutor, logic, logicAfterPlan, logicBeforePlan |
| Methods inherited from class cz.cuni.amis.pogamut.usar2004.agent.module.logic.USAR2004BotLogicController |
beforeFirstLogic, getLogicInitializeTime, getLogicShutdownTime, logicInitialize, logicShutdown |
| Methods inherited from class cz.cuni.amis.pogamut.usar2004.agent.USAR2004BotController |
getAct, getLog, getWorldView, prepareBot, robotInitialized |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface cz.cuni.amis.pogamut.usar2004.agent.IUSAR2004BotController |
prepareBot, robotInitialized |
context
protected CONTEXT extends IUSAR2004Context context
- Context for states.
StateSposhLogicController
public StateSposhLogicController()
initializeController
public void initializeController(BOT bot)
- Initialize logic controller=call super initialization and create context
and other stuff that is needed to have.
- Specified by:
initializeController in interface cz.cuni.amis.pogamut.usar2004.agent.IUSAR2004BotController<BOT extends cz.cuni.amis.pogamut.usar2004.agent.USAR2004Bot>- Overrides:
initializeController in class SposhLogicController<BOT extends cz.cuni.amis.pogamut.usar2004.agent.USAR2004Bot,cz.cuni.amis.pogamut.sposh.executor.StateWorkExecutor>
- Parameters:
bot -
getContext
public final CONTEXT getContext()
- Get context.
- Returns:
- get context, possibly create one
customPrimitiveInstantiation
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. If you keep it empty, logic will try
to instantiate primitivies by their names and annotations.
- Parameters:
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)
createWorkExecutor
protected cz.cuni.amis.pogamut.sposh.executor.StateWorkExecutor createWorkExecutor()
- Description copied from class:
SposhLogicController
- Create
IWorkExecutor that will execute primitives contained in the plan.
This method will be called only once.
- Specified by:
createWorkExecutor in class SposhLogicController<BOT extends cz.cuni.amis.pogamut.usar2004.agent.USAR2004Bot,cz.cuni.amis.pogamut.sposh.executor.StateWorkExecutor>
- Returns:
- executor to execute primitives.
createContext
protected abstract CONTEXT createContext()
- Create context for this logic controller.
- Returns:
- new logic controller.
Copyright © 2015 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.