Package edu.tufts.hrilab.action.goal
Class Goal
java.lang.Object
edu.tufts.hrilab.action.goal.Goal
- All Implemented Interfaces:
Serializable
Goal
encapsulates a goal Predicate, the ActionInterpreter in charge of
executing it and some additional information.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct goal that defines the actor to achieve the goal, and the desired goal/action.Construct goal with explicit actor.Goal
(Symbol actor, Symbol goalState, Observable observable) Goal constructor used to explicitly mark goal as an observation. -
Method Summary
Modifier and TypeMethodDescriptionboolean
bindPredicate
(Context context) Binds goal predicate to values in context.void
cancel()
Set the goal status to CANCEL and also attempt to cancel the goal execution.getActor()
getContextDescription
(Predicate location) Get the current context being executed by an ActionInterpreter.long
long
getId()
Get the goal predicate.long
Get the root context of this goal (not the root of the entire tree).long
boolean
isAction()
boolean
boolean
void
resume()
boolean
setActionInterpreter
(ActionInterpreter interpreter) boolean
Set goal status to ACTIVE and set start time.void
setAsTerminated
(GoalStatus status) Set goal status to passed in status, set the end time, and set the internal terminated flag.void
setCurrentContext
(Context context) Set the current context being executed by an ActionInterpreter.void
void
setIsAction
(boolean value) void
void
setPriority
(long priority) void
setPriorityTier
(PriorityTier priorityTier) void
setRootContext
(Context context) Set the root context of this goal (not the root of the entire tree).void
setStatus
(GoalStatus status) Set the status of this goal.void
suspend()
TODO: this is a half-baked attempt at pausing a goal, but only pauses the current AI, and not any child AIs.toString()
-
Constructor Details
-
Goal
Construct goal that defines the actor to achieve the goal, and the desired goal/action. This is the main method used when using the GoalManager submitGoal method.- Parameters:
goalState
-
-
Goal
Construct goal with explicit actor. This is primarily used for creating goal instance from ASL- Parameters:
actor
-goalState
-
-
Goal
Goal constructor used to explicitly mark goal as an observation. It's possible to have an observation goal without the OBS(actor, state) predicate form. This is almost always the case for observations from conditions and effects checks.- Parameters:
actor
- the actor doing the observing (can be null, if it can be inferred from predicate)goalState
- the goal predicateobservable
- enum specifying if goal is observable, and if so what type (true/false/default)
-
-
Method Details
-
getPredicate
Get the goal predicate. This can contain free variables, and it can also become bound depending on where in the goal execution process this method is called.- Returns:
-
bindPredicate
Binds goal predicate to values in context.- Parameters:
context
- context providing bindings- Returns:
- true if predicate was bound using variables in context
-
getId
public long getId() -
isAction
public boolean isAction() -
setIsAction
public void setIsAction(boolean value) -
isObservation
public boolean isObservation() -
getObservableEnum
-
isPersistent
public boolean isPersistent() -
getActor
-
getFailConditions
-
getStatus
-
getStartTime
public long getStartTime() -
getEndTime
public long getEndTime() -
setRootContext
Set the root context of this goal (not the root of the entire tree).- Parameters:
context
-
-
setCurrentContext
Set the current context being executed by an ActionInterpreter.- Parameters:
context
-
-
getRootContext
Get the root context of this goal (not the root of the entire tree).- Returns:
-
getCurrentContext
Get the current context being executed by an ActionInterpreter.- Returns:
-
getContextDescription
-
setAsStarted
public boolean setAsStarted()Set goal status to ACTIVE and set start time. This method does not actually start goal execution.- Returns:
-
setStatus
Set the status of this goal. Does not directly change the actual execution of this goal.- Parameters:
status
-
-
setAsTerminated
Set goal status to passed in status, set the end time, and set the internal terminated flag. This method does not actually terminate the goal execution.- Parameters:
status
-
-
setPriority
public void setPriority(long priority) -
getPriority
public long getPriority() -
setPriorityTier
-
getPriorityTier
-
cancel
public void cancel()Set the goal status to CANCEL and also attempt to cancel the goal execution. -
suspend
public void suspend()TODO: this is a half-baked attempt at pausing a goal, but only pauses the current AI, and not any child AIs. Something closer to how cancel works will need to be implemented. For instance, suspend could cancel the goal execution but keep the goal as a current goal in the BGM. -
resume
public void resume() -
setFailConditions
-
getActionInterpreter
-
setActionInterpreter
-
toString
-
setMetric
-
getMetric
-