hmi.elckerlyc.speechengine
Class TextPlanner

java.lang.Object
  extended by hmi.elckerlyc.AbstractPlanner
      extended by hmi.elckerlyc.speechengine.TextPlanner
All Implemented Interfaces:
Planner, SpeechPlanner

public class TextPlanner
extends AbstractPlanner
implements SpeechPlanner


Field Summary
private static org.slf4j.Logger logger
           
private  VerbalPlayer player
           
private  TextOutput textOutput
           
 
Constructor Summary
TextPlanner(VerbalPlayer p, TextOutput output)
           
 
Method Summary
 List<SyncAndTimePeg> addBehaviour(BMLBlockPeg bbPeg, Behaviour b, List<TimePegAndConstraint> sacs, PlanUnit planElement)
          Creates a SpeechUnit that satisfies sacs and adds it to the motion plan.
 void addExceptionListener(BMLExceptionListener war)
           
 void clearAll(double time)
          Removes all behaviors from the plan
private  TextSpeechUnit createSpeechUnit(BMLBlockPeg bbPeg, Behaviour b)
           
 Set<String> getInvalidBehaviours()
          Checks if the behavior plan is still consistent (e.g. after modifying the timing of some TimePegs).
 Player getPlayer()
          Returns the Player for this planner. useful for, e.g., resetting the player of any planner (see BMLRealizer.reset).
 List<Class<? extends Behaviour>> getSupportedBehaviours()
           
 List<Class<? extends Behaviour>> getSupportedDescriptionExtensions()
           
 String getType()
           
 VerbalPlayer getVerbalPlayer()
          Addition to getPlayer to save on class casting
 void interruptBehaviour(String behaviourId, String BMLId, double globalTime)
          Interrupts the behavior, sending the appropiate feedback callbacks if the behavior was running, just removes it otherwise.
private  void linkSyncs(TextSpeechUnit su, List<TimePegAndConstraint> sacs)
           
 void removeAllExceptionListeners()
           
 void removeBehaviour(String behaviourId, String BMLId)
          Removes behavior with behaviourId and bmlId from the plan Callback behavior is unspecified
 void reset()
          Resets the player, that is: stops running behavior and returns the player to its startup state (default pose etc) This does not clear any behaviours from the plans.
 TextSpeechUnit resolveSynchs(BMLBlockPeg bbPeg, Behaviour b, List<TimePegAndConstraint> sacs)
          Resolves TimePegs for behavior b, given some known time pegs and constraints
 void setParameterValue(String behId, String bmlId, String paramId, float value)
           
 void setParameterValue(String behId, String bmlId, String paramId, String value)
           
 void setTextOutput(TextOutput to)
           
 
Methods inherited from class hmi.elckerlyc.AbstractPlanner
addFeedbackListener, getBehaviours, getEndTime, getFeedbackListeners, interruptBehaviourBlock, removeAllFeedbackListeners, removeFeedbackListener, setBMLBlockState, shutdown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface hmi.elckerlyc.Planner
addFeedbackListener, getBehaviours, getEndTime, getFeedbackListeners, interruptBehaviourBlock, removeAllFeedbackListeners, removeFeedbackListener, setBMLBlockState, shutdown
 

Field Detail

logger

private static org.slf4j.Logger logger

player

private VerbalPlayer player

textOutput

private TextOutput textOutput
Constructor Detail

TextPlanner

public TextPlanner(VerbalPlayer p,
                   TextOutput output)
Method Detail

getType

public String getType()
Specified by:
getType in interface SpeechPlanner

setTextOutput

public void setTextOutput(TextOutput to)

createSpeechUnit

private TextSpeechUnit createSpeechUnit(BMLBlockPeg bbPeg,
                                        Behaviour b)

addBehaviour

public List<SyncAndTimePeg> addBehaviour(BMLBlockPeg bbPeg,
                                         Behaviour b,
                                         List<TimePegAndConstraint> sacs,
                                         PlanUnit planElement)
                                  throws BehaviourPlanningException
Creates a SpeechUnit that satisfies sacs and adds it to the motion plan. All registered BMLFeedbackListeners are linked to this SpeechUnit.

Specified by:
addBehaviour in interface Planner
planElement - planElement obtained from resolveSynchs, null to create a new planElement
Returns:
a list of all syncs of the behavior and their linked TimePegs
Throws:
BehaviourPlanningException - if no behavior satisfying sac can be constructed

resolveSynchs

public TextSpeechUnit resolveSynchs(BMLBlockPeg bbPeg,
                                    Behaviour b,
                                    List<TimePegAndConstraint> sacs)
                             throws BehaviourPlanningException
Description copied from interface: Planner
Resolves TimePegs for behavior b, given some known time pegs and constraints

Specified by:
resolveSynchs in interface Planner
b - the behavior
sacs - the provided time pegs and constraints, missing constraints are filled out by this method
Returns:
the object to be placed in the plan (a TimedMotionUnit, SpeechUnit, ...)
Throws:
BehaviourPlanningException - if no behavior satisfying sac can be constructed

getInvalidBehaviours

public Set<String> getInvalidBehaviours()
Description copied from interface: Planner
Checks if the behavior plan is still consistent (e.g. after modifying the timing of some TimePegs). Returns id's of behaviors with invalid timing

Specified by:
getInvalidBehaviours in interface Planner

clearAll

public void clearAll(double time)
Description copied from interface: Planner
Removes all behaviors from the plan

Specified by:
clearAll in interface Planner

linkSyncs

private void linkSyncs(TextSpeechUnit su,
                       List<TimePegAndConstraint> sacs)

removeBehaviour

public void removeBehaviour(String behaviourId,
                            String BMLId)
Description copied from interface: Planner
Removes behavior with behaviourId and bmlId from the plan Callback behavior is unspecified

Specified by:
removeBehaviour in interface Planner

interruptBehaviour

public void interruptBehaviour(String behaviourId,
                               String BMLId,
                               double globalTime)
Description copied from interface: Planner
Interrupts the behavior, sending the appropiate feedback callbacks if the behavior was running, just removes it otherwise.

Specified by:
interruptBehaviour in interface Planner

getVerbalPlayer

public VerbalPlayer getVerbalPlayer()
Addition to getPlayer to save on class casting

Specified by:
getVerbalPlayer in interface SpeechPlanner
Returns:
the player

getPlayer

public Player getPlayer()
Description copied from interface: Planner
Returns the Player for this planner. useful for, e.g., resetting the player of any planner (see BMLRealizer.reset).

Specified by:
getPlayer in interface Planner

addExceptionListener

public void addExceptionListener(BMLExceptionListener war)
Specified by:
addExceptionListener in interface Planner

removeAllExceptionListeners

public void removeAllExceptionListeners()
Specified by:
removeAllExceptionListeners in interface Planner

getSupportedBehaviours

public List<Class<? extends Behaviour>> getSupportedBehaviours()
Specified by:
getSupportedBehaviours in interface Planner

getSupportedDescriptionExtensions

public List<Class<? extends Behaviour>> getSupportedDescriptionExtensions()
Specified by:
getSupportedDescriptionExtensions in interface Planner

reset

public void reset()
Description copied from interface: Planner
Resets the player, that is: stops running behavior and returns the player to its startup state (default pose etc) This does not clear any behaviours from the plans.

Specified by:
reset in interface Planner

setParameterValue

public void setParameterValue(String behId,
                              String bmlId,
                              String paramId,
                              float value)
Specified by:
setParameterValue in interface Planner

setParameterValue

public void setParameterValue(String behId,
                              String bmlId,
                              String paramId,
                              String value)
Specified by:
setParameterValue in interface Planner