public abstract class HighSkill extends Object implements IHighSkill
HighSkill represents an action - such as walking to a point, turning or standing up. This is achieved by selecting the appropriate low skills to perform smaller parts of the action.
High skills are implemented by subclassing this class. Most of them are currently written in Ruby and placed in the scripts/high_skills directory. When subclassing a high skill, the following methods need to be implemented:
See their respective descriptions for details.For details on how to implement a new high skill, see (TODO: wiki page)
Modifier and Type | Class and Description |
---|---|
static class |
HighSkill.HighSkillState
Contains the possible states that a high skill can be in.
|
Modifier and Type | Field and Description |
---|---|
protected LowSkill |
currentSkill
The low skill that's currently being performed
|
String |
name
Name of the HighSkill
|
protected LowSkill |
nextSkill
Low skill that was returned by
pickLowSkill() , but is not yet active,
because the current skill needs to be finalized first. |
HighSkill.HighSkillState |
state
The state that the high skill is currently in.
|
Constructor and Description |
---|
HighSkill() |
Modifier and Type | Method and Description |
---|---|
abstract void |
checkProgress()
Called on every single step of the high skill.
|
void |
execute()
Performs a single step of the high skill.
|
LowSkill |
getCurrentSkill()
Returns the currently executed low skill.
|
boolean |
isEnded()
Returns true if the HighSkill has ended (it's in END_STATE).
|
abstract LowSkill |
pickLowSkill()
Called everytime the current low skill enters a phase that be can be finalized
(so that it's possible to safely switch to a new low skill, see TODO: wiki link)
|
private static void |
sayMoveStartedToFramwork(LowSkill lowSkill) |
private static void |
sayMoveStoppedToFramwork(LowSkill lowSkill)
addeded by Bimbo (High5), communication with test framework
Blank try-catch because of ruby
BUG - have to be in Lowskill
|
void |
setCurrentSkill(LowSkill skill) |
String |
toString() |
protected LowSkill currentSkill
protected LowSkill nextSkill
pickLowSkill()
, but is not yet active,
because the current skill needs to be finalized first. Once that happens,
this skill will become the current low skill (or the high skill will end if nextSkill is null).public String name
public HighSkill.HighSkillState state
HighSkill.HighSkillState
for details.public final void execute() throws Exception
Performs a single step of the high skill. This means handling the selection of low skills, their execution and finalization. For details, see TODO: wiki link
This method can also be subclassed to implement a more complex control structure (high skills that execute other high skills, etc.)
Exception
private static void sayMoveStoppedToFramwork(LowSkill lowSkill)
private static void sayMoveStartedToFramwork(LowSkill lowSkill)
public abstract LowSkill pickLowSkill()
Called everytime the current low skill enters a phase that be can be finalized (so that it's possible to safely switch to a new low skill, see TODO: wiki link)
Returns the next skill that needs to be executed in order to fulfill goals of this HighSkill.
If the returned skill is the same as the current skill, it will continue normally.
If a different low skill or null is returned, the current low skill will be finalized. Once that finalization has been succesfully completed, the returned low skill will be set as the new executed low skill, or, if null was returned, the high skill will end.
pickLowSkill
in interface IHighSkill
public abstract void checkProgress() throws Exception
Called on every single step of the high skill. That means every tick.
Should throw an exception if the agent is found to be in an unexpected state, e.g. fallen on ground during walking.
Causes this skill's execution to be immediately terminated.
TODO: does it work? should it work this way? currently, falling is handled by the pickLowSkill methods in our high skillscheckProgress
in interface IHighSkill
Exception
- means that the high skill needs to be interrupted without regard
to safe finalization of the current low skillpublic boolean isEnded()
public LowSkill getCurrentSkill()
public void setCurrentSkill(LowSkill skill)