hmi.elckerlyc.animationengine.gaze
Class GazeMU

java.lang.Object
  extended by hmi.elckerlyc.animationengine.gaze.GazeMU
All Implemented Interfaces:
KeyPositionManager, MotionUnit
Direct Known Subclasses:
DynamicGazeMU, EyeGazeMU

public class GazeMU
extends Object
implements MotionUnit

Timing: ready: gaze target reached relax: start to move back to previous pose (should be rest pose?)

Author:
welberge TODO: spread rotation over multiple joints, a la Boulic? TODO: involve eyes, use Tweed & Vilis model there too Theoretical background End pose of the head: Tweed, D. (1997). Three-dimensional model of the human eye-head saccadic system. The Journal of Neurophysiology, 77 (2), pp. 654-666. Fixed head rotation axis during gaze: Tweed, D., & Vilis, T. (1992). Listing's Law for Gaze-Directing Head Movements. In A. Berthoz, W. Graf, & P. Vidal (Eds.), The Head-Neck Sensory-Motor System (pp. 387-391). New York: Oxford University Press.

Field Summary
private  KeyPositionManager keyPositionManager
           
protected  VJoint lEye
           
private  float[] localGaze
           
protected  VJoint neck
           
protected  double offsetAngle
           
protected  OffsetDirection offsetDirection
           
protected  AnimationPlayer player
           
protected  double preparationDuration
           
protected  float[] qGaze
           
protected  float[] qStart
           
protected  float[] qStartLeftEye
           
protected  float[] qStartRightEye
           
protected  float[] qTemp
           
protected  KeyPosition ready
           
protected  KeyPosition relax
           
protected  double relaxDuration
           
protected  VJoint rEye
           
protected  String target
           
protected  TimeManipulator tmp
           
protected  float[] vecTemp
           
protected  WorldObjectManager woManager
           
protected  WorldObject woTarget
           
 
Constructor Summary
GazeMU()
           
 
Method Summary
 void addKeyPosition(KeyPosition kp)
           
 GazeMU copy(AnimationPlayer p)
          Create a copy of this motion unit and link it to the animationplayer
 TimedMotionUnit createTMU(BMLBlockPeg bmlBlockPeg, String i, String bmlId)
          Creates the TimedMotionUnit corresponding to this motion unit
 KeyPosition getKeyPosition(String name)
           
 List<KeyPosition> getKeyPositions()
          Gets a sorted view of the list of keypositions
protected  float[] getOffsetRotation()
           
 String getParameterValue(String name)
           
 MotionUnit getPredictor(VJoint predict)
          Creates a gaze predictor.
 double getPreferedDuration()
           
 String getReplacementGroup()
          Get the motionunit replacement group (=typically the BML behavior) Used to determine the currently active persistent TMU for this group in the player Only one group is active at a time
 void play(double t)
          Executes the motion unit, typically by rotating some VJoints
private  void playEye(double t, float[] qDesNeck, float[] qStartEye, VJoint eye)
           
 void removeKeyPosition(String id)
           
(package private)  void setEndRotation(float[] gazeDir)
           
(package private)  void setEndRotation(float[] gazeDir, float[] q)
           
 void setKeyPositions(List<KeyPosition> p)
           
 void setParameterValue(String name, float value)
           
 void setParameterValue(String name, String value)
           
 void setStartPose(double prepDur, double relaxDur)
           
 void setTarget(String target)
           
 void setTimeManipulator(TimeManipulator tmp)
          Set the time manimpulator that describes the velocity profile for attack and decay.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

qGaze

protected float[] qGaze

qTemp

protected float[] qTemp

qStart

protected float[] qStart

qStartLeftEye

protected float[] qStartLeftEye

qStartRightEye

protected float[] qStartRightEye

vecTemp

protected float[] vecTemp

ready

protected KeyPosition ready

relax

protected KeyPosition relax

neck

protected VJoint neck

rEye

protected VJoint rEye

lEye

protected VJoint lEye

player

protected AnimationPlayer player

woManager

protected WorldObjectManager woManager

target

protected String target

tmp

protected TimeManipulator tmp

woTarget

protected WorldObject woTarget

preparationDuration

protected double preparationDuration

relaxDuration

protected double relaxDuration

keyPositionManager

private KeyPositionManager keyPositionManager

localGaze

private float[] localGaze

offsetAngle

protected double offsetAngle

offsetDirection

protected OffsetDirection offsetDirection
Constructor Detail

GazeMU

public GazeMU()
Method Detail

getOffsetRotation

protected float[] getOffsetRotation()

copy

public GazeMU copy(AnimationPlayer p)
Description copied from interface: MotionUnit
Create a copy of this motion unit and link it to the animationplayer

Specified by:
copy in interface MotionUnit

setTarget

public void setTarget(String target)
               throws MUPlayException
Throws:
MUPlayException

setStartPose

public void setStartPose(double prepDur,
                         double relaxDur)
                  throws MUPlayException
Throws:
MUPlayException

setEndRotation

void setEndRotation(float[] gazeDir)
              throws MUPlayException
Parameters:
gazeDir - gaze direction
Throws:
MUPlayException

setEndRotation

void setEndRotation(float[] gazeDir,
                    float[] q)
              throws MUPlayException
Parameters:
gazeDir - gaze direction
Throws:
MUPlayException

getPredictor

public MotionUnit getPredictor(VJoint predict)
Creates a gaze predictor. The gaze predictor starts at whatever start pose the first call to play on its TMU will set. This also locks the target pos. Since the GazeMU allows flexible start poses, it's not very handy nor needed to use a prediction on any time before the ready sync.

Specified by:
getPredictor in interface MotionUnit
Parameters:
predict - VJoint to execute the prediction on
Returns:
predictor motion unit

getPreferedDuration

public double getPreferedDuration()
Specified by:
getPreferedDuration in interface MotionUnit
Returns:
Prefered duration (in seconds) of this motion unit, 0 means not determined/infinite

playEye

private void playEye(double t,
                     float[] qDesNeck,
                     float[] qStartEye,
                     VJoint eye)
              throws MUPlayException
Throws:
MUPlayException

play

public void play(double t)
          throws MUPlayException
Description copied from interface: MotionUnit
Executes the motion unit, typically by rotating some VJoints

Specified by:
play in interface MotionUnit
Parameters:
t - execution time, 0 < t < 1
Throws:
MUPlayException - if the play fails for some reason

createTMU

public TimedMotionUnit createTMU(BMLBlockPeg bmlBlockPeg,
                                 String i,
                                 String bmlId)
Description copied from interface: MotionUnit
Creates the TimedMotionUnit corresponding to this motion unit

Specified by:
createTMU in interface MotionUnit
i - behaviour id
bmlId - BML block id
Returns:
the TMU

setParameterValue

public void setParameterValue(String name,
                              String value)
Specified by:
setParameterValue in interface MotionUnit

getParameterValue

public String getParameterValue(String name)
Specified by:
getParameterValue in interface MotionUnit

setParameterValue

public void setParameterValue(String name,
                              float value)
Specified by:
setParameterValue in interface MotionUnit

setTimeManipulator

public void setTimeManipulator(TimeManipulator tmp)
Set the time manimpulator that describes the velocity profile for attack and decay. Default is SigmoidManipulator(3,4)


getReplacementGroup

public String getReplacementGroup()
Description copied from interface: MotionUnit
Get the motionunit replacement group (=typically the BML behavior) Used to determine the currently active persistent TMU for this group in the player Only one group is active at a time

Specified by:
getReplacementGroup in interface MotionUnit

addKeyPosition

public void addKeyPosition(KeyPosition kp)
Specified by:
addKeyPosition in interface KeyPositionManager

getKeyPositions

public List<KeyPosition> getKeyPositions()
Description copied from interface: KeyPositionManager
Gets a sorted view of the list of keypositions

Specified by:
getKeyPositions in interface KeyPositionManager

setKeyPositions

public void setKeyPositions(List<KeyPosition> p)
Specified by:
setKeyPositions in interface KeyPositionManager

getKeyPosition

public KeyPosition getKeyPosition(String name)
Specified by:
getKeyPosition in interface KeyPositionManager

removeKeyPosition

public void removeKeyPosition(String id)
Specified by:
removeKeyPosition in interface KeyPositionManager