hmi.environment
Class ElckerlycDemoEnvironment

java.lang.Object
  extended by hmi.environment.GraphicsDemoEnvironment
      extended by hmi.environment.PhysicalDemoEnvironment
          extended by hmi.environment.ElckerlycDemoEnvironment
All Implemented Interfaces:
GLRenderObject, KeyListener, EventListener
Direct Known Subclasses:
ElckerlycDemo, EnterfaceDemo

public class ElckerlycDemoEnvironment
extends PhysicalDemoEnvironment

Adds mixed dynamics animatino to PhysicalDemoEnvironment, plus a lot of other functionlaity for creating, managing and controlling virtual humans with body, voices, bmlrealizer, etc. Major change wrt superclass is the physicscallback. physicsTime will no longer call physicsTick, but rather call the AnimationPlayerManager to do its thing (which includes making the physicssteps through a PhysCallback) Also, voices will be played on the physicsTime, to make sure that voices have the same time line as the animation

Author:
Dennis Reidsma, Herwin van Welbergen

Nested Class Summary
(package private)  class ElckerlycDemoEnvironment.LoadVHListener
          Toggle visibility of given VHUI...
(package private)  class ElckerlycDemoEnvironment.PhysCallback
          Called by the anmiationplayermanager to make one simulation step in the physical world
(package private) static class ElckerlycDemoEnvironment.ToggleVHUIListener
          Toggle visibility of given VHUI...
 
Nested classes/interfaces inherited from class hmi.environment.PhysicalDemoEnvironment
PhysicalDemoEnvironment.CollisionCheckListener, PhysicalDemoEnvironment.PhysicsCheckListener, PhysicalDemoEnvironment.PhysicsClockListener, PhysicalDemoEnvironment.Sleeper, PhysicalDemoEnvironment.ThrowBallListener
 
Nested classes/interfaces inherited from class hmi.environment.GraphicsDemoEnvironment
GraphicsDemoEnvironment.DebugCheckListener, GraphicsDemoEnvironment.MyRenderclockCallback, GraphicsDemoEnvironment.PlayListener, GraphicsDemoEnvironment.ResetListener
 
Field Summary
 boolean animateavatars
          If set to false, the avatars do not move at all
private  org.slf4j.Logger logger
           
 boolean playvoices
          If set to false, no voices are played (even when scheduled)
protected  AnimationPlayerManager theAnimationPlayerManager
           
(package private)  GenericVirtualWorld theVirtualWorld
           
protected  HashMap<HmiVirtualHuman,VirtualHumanUI> vhUIs
          The UIs for all loaded virtualHumans
protected  HashMap<HmiVirtualHuman,JButton> vhUIToggleButtons
          The ToggleUI buttons for all loaded virtualHumans
protected  ArrayList<HmiVirtualHuman> virtualHumanList
          All loaded virtualHumans
protected  VJoint vjCameraTarget
           
protected  VJoint vjCurrentMixedDynamicsRoot
           
protected  VJoint vjMixedDynamicsAnimationRoot
          The mixed dynamics animation root is added as a child to hmi.environment.PhysicalDemoEnvironment#vjMixedDynamicsAnimationRoot vjMixedDynamicsAnimationRoot.
protected  VJoint vjNextMixedDynamicsRoot
           
protected  VJoint vjPredictorMixedDynamicsRoot
           
protected  VJoint vjPreviousMixedDynamicsRoot
           
protected  VJoint vjXuukTarget
          used to attach a xuk sensor to...
protected  XuukReader xuukReader
           
protected  XuukTargetMover xuukTargetMover
           
 
Fields inherited from class hmi.environment.PhysicalDemoEnvironment
collision, collisionEnabled, g, glueJointGroup, groundGeom, phsphere, phworld, physicsClock, physicsLoopFrequency, physicsRunners, prevTime, runphysics, space, sphereAnimationJoint, sphereRenderJoint, timeStep
 
Fields inherited from class hmi.environment.GraphicsDemoEnvironment
background, color_buf_tex, debugJOGL, depth_buf_tex, dx, dy, dz, enableFSAA, fovyFar, fovyNear, frameTitle, FSAA_samples, fullscreen, glCanvas, glNavControl, glObjectControl, hiddenVisualisations, jframe, laptop, light0, light1, light2, light3, light4, lightPos0, lightPos1, lightPos2, lightPos3, lightPos4, numStencilBits, render, renderClock, renderDebugVisualisations, renderer, renderRunners, shutdownSync, toolBar, useVsync, vglSceneRenderRoot, visualisations, visualisationsUninitialized, vjNavigationNode, vjSceneRenderRoot, vjWorldAnimationRoot, vjWorldRenderRoot, wowTransformMatrix, wowvx, wowvx_header_data, wowvx_header_tex
 
Constructor Summary
ElckerlycDemoEnvironment()
          Default constructor does not do anything.
ElckerlycDemoEnvironment(WorldObjectManager wom)
          Default constructor does not do anything.
 
Method Summary
 void addPhysicalHumanDebugVisualisations(HmiVirtualHuman vh)
           
 void addVJointDebugVisualisations(HmiVirtualHuman vh)
           
 void close()
          Clean up physicalhumanoids and the verbalplayers and stops the application
 void createVirtualHumanUI(HmiVirtualHuman vh)
           
protected  void disposeFrame()
          Clean up physicalhumanoids and the verbalplayers and disposes the jframe
 GenericVirtualWorld getVirtualWorld()
           
 void init()
          In addition to super.init(), initialize the clones of the aniomationroot (for the mixed dynamics animation), and the animationPlayerManager
protected  void initGraphicScene()
          Add the graphical representation for the phsphere to the graphical scene
protected  void initMixedAnimation()
          Initialize the mixed dynamics: make vjMixedDynamicsAnimationRoot, clone the animationroot, create the animationplayermanager
protected  void initQuickSettings()
          Overide this method to change the quicksettings
protected  void initUI()
          Add a 'load virtual human' button to the default UI
protected  void initVoiceSystem()
          There is not actually much initialisation required for the general voice system
protected  void initWorldPhysics()
          add space, collision, etc, to the VIrtualWorld
 HmiVirtualHuman loadVirtualHuman(Resources res, String specFileName, String name)
          Load a virtual human according to the specifications; store the resulting VirtualHuman object in the virtualHumanList array; add vhuman to scene and playermanager etc
 HmiVirtualHuman loadVirtualHuman(VirtualHumanSpecHmi spec, String name)
          Load a virtual human according to the specifications; store the resulting VirtualHuman object in the virtualHumanList array; add vhuman to scene and playermanager etc
protected  void physicsTime(double currentTime)
          Override: physicsTime stepping is now left to AnimationPlayerManager.
protected  void playAudio(double currentTime)
          Make sure that all audio is played for currentTime.
protected  void playVoices(double currentTime)
          Make sure that all voices are played for currentTime.
 void processAnimationResultForRender(GLRenderContext glc)
          override, because now we also need to do the deform() & morph()!!
protected  void reset()
          Reset: set clocks to 0 (also physics, because physicsclock also drives the animation!).
 void setXuukReader(XuukReader xr)
           
private  void unloadAllVirtualHumans()
           
 void unloadVirtualHuman(HmiVirtualHuman vh)
          Completely removes a virtual human from the environment; stops all of its players, etc.
 
Methods inherited from class hmi.environment.PhysicalDemoEnvironment
addPhysicsRunner, glueFeetToFloor, initGraphicSphere, initGroundPhysics, initSpherePhysics, initThrowBallButton, initUI, physicsCopy, physicsRun, physicsTick, prepareClose, prepareDispose, prepareReset, setCollisionEnabled, setPhysicsEnabled, startClocks, toggleCollision, togglePhysics
 
Methods inherited from class hmi.environment.GraphicsDemoEnvironment
addDebugVisualisation, addRenderRunner, addVisualisation, convertBufferToWowVX, exit, getFrame, getGeneralImageIcon, getImageIcon, getWorldAnimationRoot, getWorldRenderRoot, glInit, glPreInit, glPreRender, glRender, hasVisualisation, initGraphics, initRender, initToolbar, initVisualGround, initVJointStructure, isVisualisationVisible, keyPressed, keyReleased, keyTyped, navigate, play, removeDebugVisualisation, removeVisualisation, renderTime, setFullScreen, setupMediaButton, setupMediaButton, setupUI, setupVJointStructure, setVisualisationVisible, startAll, toggleDebugViz
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private org.slf4j.Logger logger

animateavatars

public boolean animateavatars
If set to false, the avatars do not move at all


playvoices

public boolean playvoices
If set to false, no voices are played (even when scheduled)


theVirtualWorld

GenericVirtualWorld theVirtualWorld

vjXuukTarget

protected VJoint vjXuukTarget
used to attach a xuk sensor to...


vjCameraTarget

protected VJoint vjCameraTarget

xuukTargetMover

protected XuukTargetMover xuukTargetMover

vjMixedDynamicsAnimationRoot

protected VJoint vjMixedDynamicsAnimationRoot
The mixed dynamics animation root is added as a child to hmi.environment.PhysicalDemoEnvironment#vjMixedDynamicsAnimationRoot vjMixedDynamicsAnimationRoot. The animationrootjoint of all objects and humanoids for which mixed dynamics animation has to be performed are to be added to this root; mixed dynamics animation will be performed on this root. If you have objects and/or humanoids that are not animated using mixed dynamics, you can still add their animatino root to vjMixedDynamicsAnimationRoot.

As for vjMixedDynamicsAnimationRoot, three copies are made of this node: vjNextMixedDynamicsRoot, vjCurrentMixedDynamicsRoot and vjPreviousMixedDynamicsRoot. These are used to calculate the inverse dynamics of certain animations, in the Mixed AnimationPlayers. Note that all actual animations must be performed on vjNextMixedDynamicsRoot -- the results of that animation will in the end be copied to vjMixedDynamicsAnimationRoot, which in turn is connected to the vjWorldRenderNode through various GLScene.deform calls for rendering. Finally, a predictorWorldRoot is used to run animatino pose predictions on in order to calculate the end pose of transitionmotinounits.


vjNextMixedDynamicsRoot

protected VJoint vjNextMixedDynamicsRoot
See Also:
vjMixedDynamicsAnimationRoot

vjCurrentMixedDynamicsRoot

protected VJoint vjCurrentMixedDynamicsRoot
See Also:
vjMixedDynamicsAnimationRoot

vjPreviousMixedDynamicsRoot

protected VJoint vjPreviousMixedDynamicsRoot
See Also:
vjMixedDynamicsAnimationRoot

vjPredictorMixedDynamicsRoot

protected VJoint vjPredictorMixedDynamicsRoot
See Also:
vjMixedDynamicsAnimationRoot

theAnimationPlayerManager

protected AnimationPlayerManager theAnimationPlayerManager

virtualHumanList

protected ArrayList<HmiVirtualHuman> virtualHumanList
All loaded virtualHumans


vhUIToggleButtons

protected HashMap<HmiVirtualHuman,JButton> vhUIToggleButtons
The ToggleUI buttons for all loaded virtualHumans


vhUIs

protected HashMap<HmiVirtualHuman,VirtualHumanUI> vhUIs
The UIs for all loaded virtualHumans


xuukReader

protected XuukReader xuukReader
Constructor Detail

ElckerlycDemoEnvironment

public ElckerlycDemoEnvironment(WorldObjectManager wom)
Default constructor does not do anything.


ElckerlycDemoEnvironment

public ElckerlycDemoEnvironment()
Default constructor does not do anything.

Method Detail

getVirtualWorld

public GenericVirtualWorld getVirtualWorld()

init

public void init()
In addition to super.init(), initialize the clones of the aniomationroot (for the mixed dynamics animation), and the animationPlayerManager

Overrides:
init in class PhysicalDemoEnvironment

initUI

protected void initUI()
Add a 'load virtual human' button to the default UI

Overrides:
initUI in class PhysicalDemoEnvironment

initGraphicScene

protected void initGraphicScene()
Description copied from class: PhysicalDemoEnvironment
Add the graphical representation for the phsphere to the graphical scene

Overrides:
initGraphicScene in class PhysicalDemoEnvironment

setXuukReader

public void setXuukReader(XuukReader xr)

initMixedAnimation

protected void initMixedAnimation()
Initialize the mixed dynamics: make vjMixedDynamicsAnimationRoot, clone the animationroot, create the animationplayermanager


initQuickSettings

protected void initQuickSettings()
Overide this method to change the quicksettings

Overrides:
initQuickSettings in class PhysicalDemoEnvironment

initVoiceSystem

protected void initVoiceSystem()
There is not actually much initialisation required for the general voice system


initWorldPhysics

protected void initWorldPhysics()
add space, collision, etc, to the VIrtualWorld

Overrides:
initWorldPhysics in class PhysicalDemoEnvironment

physicsTime

protected void physicsTime(double currentTime)
Override: physicsTime stepping is now left to AnimationPlayerManager.

Overrides:
physicsTime in class PhysicalDemoEnvironment

playAudio

protected void playAudio(double currentTime)
Make sure that all audio is played for currentTime.


playVoices

protected void playVoices(double currentTime)
Make sure that all voices are played for currentTime. For now, the TTS generators cannot handle two voices speaking simultaneously, by the way.


processAnimationResultForRender

public void processAnimationResultForRender(GLRenderContext glc)
override, because now we also need to do the deform() & morph()!! Note: called in GraphicsDemoEnv, synchronised on the animationSync...

Overrides:
processAnimationResultForRender in class GraphicsDemoEnvironment

close

public void close()
Clean up physicalhumanoids and the verbalplayers and stops the application

Overrides:
close in class PhysicalDemoEnvironment

unloadAllVirtualHumans

private void unloadAllVirtualHumans()

disposeFrame

protected void disposeFrame()
                     throws InterruptedException,
                            InvocationTargetException
Clean up physicalhumanoids and the verbalplayers and disposes the jframe

Overrides:
disposeFrame in class PhysicalDemoEnvironment
Throws:
InvocationTargetException
InterruptedException

reset

protected void reset()
Reset: set clocks to 0 (also physics, because physicsclock also drives the animation!). Also, call super.reset, and reset animationplayermanager Should not be called directly, use prepareReset to set up a physicsRunner for that.

Overrides:
reset in class PhysicalDemoEnvironment

loadVirtualHuman

public HmiVirtualHuman loadVirtualHuman(Resources res,
                                        String specFileName,
                                        String name)
                                 throws Exception
Load a virtual human according to the specifications; store the resulting VirtualHuman object in the virtualHumanList array; add vhuman to scene and playermanager etc

Throws:
Exception

loadVirtualHuman

public HmiVirtualHuman loadVirtualHuman(VirtualHumanSpecHmi spec,
                                        String name)
                                 throws Exception
Load a virtual human according to the specifications; store the resulting VirtualHuman object in the virtualHumanList array; add vhuman to scene and playermanager etc

Throws:
Exception

addVJointDebugVisualisations

public void addVJointDebugVisualisations(HmiVirtualHuman vh)

addPhysicalHumanDebugVisualisations

public void addPhysicalHumanDebugVisualisations(HmiVirtualHuman vh)

unloadVirtualHuman

public void unloadVirtualHuman(HmiVirtualHuman vh)
Completely removes a virtual human from the environment; stops all of its players, etc.


createVirtualHumanUI

public void createVirtualHumanUI(HmiVirtualHuman vh)