|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||

java.lang.ObjectatomicActions.AtomicAction
public class AtomicAction
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
| 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 |
|---|
public AtomicActions type
public int counter
public int actionStart
public transient Bot agent
public Action parent
public transient DecisionModuleImpl dModule
public cz.cuni.amis.pogamut.base3d.worldview.object.Location location
public int attractivity
| Constructor Detail |
|---|
public AtomicAction()
public AtomicAction(Action parent,
Bot agent)
| Method Detail |
|---|
public boolean checkIfOnThePlace()
public void execute()
public boolean succeeded()
public boolean failed()
protected String getEnvironmentAction()
protected void initialisation()
protected void echoAction(String action)
action - public void terminalisation()
public boolean equals(Object obj)
equals in class Objectpublic int hashCode()
hashCode in class Objectpublic String toString()
toString in class Objectpublic void logFinished(String text)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||