atomicActions
Class AtomicAction

Package class diagram package AtomicAction
java.lang.Object
  extended by atomicActions.AtomicAction
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
Bake, Borrow, BrushTeeth, BuyGroceries, Clean, CleanFloor, ConfirmTraining, Cook, Crochet, Cycle, Dance, Dig, DressUp, Drink, Eat, Eat, Embroider, Excercise, ExplainRules, Fix, Follow, GoToPub, JoinSomeoneDrinking, Jump, Knit, Listen, Paint, Pay, Plant, PlayBoardGames, PlayComputerGames, PlayUltimate, Prepare, PrepareAGame, Program, Read, Run, SayGoodBye, SayHello, SeeAMovie, SeeAPlay, SeeExhibition, SellGroceries, Shop, Shower, ShutDown, Sing, SitAtTheLecture, Sleep, StareAtTV, Start, Swim, Take, TakeOutGarbage, Think, Toilet, Use, UseWikipedia, Wait, Walk, WanderAround, WashFace, WashFloor, WashFood, Work

public class AtomicAction
extends Object
implements Serializable

atomic action is an element which links (roots) trees of plans with (to) the environment. They contain links to all important parts of architecture - decision module, agent itself and parental action thus it can perform any action with agent, demand sensoric information, navigate through environment and work with parts of logic like perceived items etc.

Atomic actions can be found typically in leaves of tree plans, but even internal nodes can have atomic actions, which are executed after satisfaction of the node by its intentions. Important is, that only Actions can contain AtomicActions.

How is an atomic action performed? When it (decision making system) comes to the leaf and an atomic action is to be executed, it calls execute(), then it checks if atomic action failed() or succeeded() and if neither of those, it calls execute() again in the next logic iteration. So it is crucial to implement those three functions when creating new atomic action. Don't forget to raise counter in execute(), you can use its zero value to identify time for initialization, which can be necessary in some cases. Counter serves as well as a timeout so it should be compared to the value of timeOut of parental action during failed(). This class should be abstract, but is not, as I haven't found a way how to bypass the XML loader so it will load directly the type of the atomic action

Author:
Ondrej
See Also:
Serialized Form

Field Summary
 int actionStart
          time of when the action has been started
 Bot agent
          link to the agent
 int attractivity
          specified in XML file - used to determine when to delete node from episodic memory
 int counter
          counter - 0 at the beginning, otherwise contains currentTime in the environment
 DecisionModuleImpl dModule
          link to the decision making module
 cz.cuni.amis.pogamut.base3d.worldview.object.Location location
          location agent should be at before the action execution
 Action parent
          link to parental Action
 AtomicActions type
          type of atomic action
 
Constructor Summary
AtomicAction()
           
AtomicAction(Action parent, Bot agent)
          copy constructor
 
Method Summary
 boolean checkIfOnThePlace()
          this method ensures, that bot is on the place he should be at means it can have one affordance, which demands a location - like swimming needs a pool and so it just ensures agent is on that location:)
protected  void echoAction(String action)
          Display the action identification in simulation environment.
 boolean equals(Object obj)
           
 void execute()
          executes the atomic action, typicaly writes something to log, change agent name, so we can see in the environment what is he doing, raise counter
 boolean failed()
          Note that if it returns false, it doesn't mean that it succeeded, it means that it just hasn't finished yet.
protected  String getEnvironmentAction()
           
 int hashCode()
           
protected  void initialisation()
          initialization which has to be done prior first execution of atomic action
 void logFinished(String text)
           
 boolean succeeded()
          Note that if it returns false, it doesn't mean that it failed, it means that it just hasn't finished yet.
 void terminalisation()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

type

public AtomicActions type
type of atomic action


counter

public int counter
counter - 0 at the beginning, otherwise contains currentTime in the environment


actionStart

public int actionStart
time of when the action has been started


agent

public transient Bot agent
link to the agent


parent

public Action parent
link to parental Action


dModule

public transient DecisionModuleImpl dModule
link to the decision making module


location

public cz.cuni.amis.pogamut.base3d.worldview.object.Location location
location agent should be at before the action execution


attractivity

public int attractivity
specified in XML file - used to determine when to delete node from episodic memory

Constructor Detail

AtomicAction

public AtomicAction()

AtomicAction

public AtomicAction(Action parent,
                    Bot agent)
copy constructor

Method Detail

checkIfOnThePlace

public boolean checkIfOnThePlace()
this method ensures, that bot is on the place he should be at means it can have one affordance, which demands a location - like swimming needs a pool and so it just ensures agent is on that location:)

Returns:

execute

public void execute()
executes the atomic action, typicaly writes something to log, change agent name, so we can see in the environment what is he doing, raise counter


succeeded

public boolean succeeded()
Note that if it returns false, it doesn't mean that it failed, it means that it just hasn't finished yet.

Returns:
true if the atomic action was successfully performed, false if not

failed

public boolean failed()
Note that if it returns false, it doesn't mean that it succeeded, it means that it just hasn't finished yet.

Returns:
true if the atomic action failed - usualy timeouted, false if not

getEnvironmentAction

protected String getEnvironmentAction()

initialisation

protected void initialisation()
initialization which has to be done prior first execution of atomic action


echoAction

protected void echoAction(String action)
Display the action identification in simulation environment.

Parameters:
action -

terminalisation

public void terminalisation()

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

logFinished

public void logFinished(String text)


Copyright © 2013 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.