hmi.elckerlyc.animationengine.procanimation
Class IKBody

java.lang.Object
  extended by hmi.elckerlyc.animationengine.procanimation.IKBody

public class IKBody
extends Object

IK manipulator for a Humanoid body Uses analytical IK to position the feet and hands.

Author:
welberge

Field Summary
private  VJoint human
           
private  VJoint lankle
           
private  float[] leftFoot
           
private  VJoint lelbow
           
private  VJoint lhip
           
private  VJoint lknee
           
private  VJoint lshoulder
           
private  VJoint lwrist
           
private  float[] mW
           
private  float[] mWDes
           
private  float[] q
           
private  float[] qElb
           
private  float[] qSho
           
private  float[] qW
           
private  float[] qWDes
           
private  VJoint rankle
           
private  VJoint relbow
           
private  VJoint rhip
           
private  float[] rightFoot
           
private  VJoint rknee
           
private  VJoint root
           
private  VJoint rshoulder
           
private  VJoint rwrist
           
private  AnalyticalIKSolver solverLFeet
           
private  AnalyticalIKSolver solverLHand
           
private  AnalyticalIKSolver solverRFeet
           
private  AnalyticalIKSolver solverRHand
           
private  float[] temp
           
private  float[] xAxis
           
private  float[] yAxis
           
private  float[] zAxis
           
 
Constructor Summary
IKBody(VJoint h)
          Constructor
 
Method Summary
 VJoint getHuman()
           
 void getLeftFootRotation(double swivel, float[] lf, float[] qh, float[] qk)
          Calculates the rotations of hip and knee for given swivel and left foot position
 void getRightFootRotation(double swivel, float[] rf, float[] qh, float[] qk)
          Calculates the rotations of hip and knee for given swivel and right foot position
 void getRootPosition(float[] root)
          Get the translation of the root
 double getSwivelLeftArm()
          Get the swivel of the left foot, given the current humanoid setup
 double getSwivelLeftFoot()
          Get the swivel of the left foot, given the current humanoid setup
 double getSwivelRightArm()
          Get the swivel of the right arm, given the current humanoid setup
 double getSwivelRightFoot()
          Get the swivel of the right foot, given the current humanoid setup
 void placeFeet()
          Places the feet onto their previous position
 void setFeet(float[] l, float[] r, boolean keepFlat)
          Sets the hip, knee and ankle rotations that satisfy a foot position
 void setLeftFoot(float[] l, boolean keepFlat)
          Set the hip and knee rotation so that a certain left foot position is satisfied.
 void setLeftHand(float[] l)
          Sets the shoulder and elbow rotations that satisfy the left hand position in world coordinates
 void setLocalLeftHand(float[] l)
          Sets the shoulder and elbow rotations that satisfy the left hand position in shoulder coordinates
 void setLocalRightHand(float[] r)
          Sets the shoulder and elbow rotations that satisfy the right hand position in shoulder coordinates
 void setRightFoot(float[] r, boolean keepFlat)
          Set the hip and knee rotation so that a certain right foot position is satisfied.
 void setRightHand(float[] r)
          Sets the shoulder and elbow rotations that satisfy the right hand position in world coordinates
 void setRoot(float[] rootPos)
          Set the translation of the HumanoidRoot
 void setSwivelLeftFoot(double sw)
          Set the swivel rotation of the left foot (see Tolani)
 void setSwivelLeftHand(double sw)
          Set the swivel rotation of the left hand (see Tolani)
 void setSwivelRightFoot(double sw)
          Set the swivel rotation of the right foot (see Tolani)
 void setSwivelRightHand(double sw)
          Sets the right hand swivel angle (see Tolani)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

human

private VJoint human

root

private VJoint root

lhip

private VJoint lhip

lknee

private VJoint lknee

lankle

private VJoint lankle

rhip

private VJoint rhip

rknee

private VJoint rknee

rankle

private VJoint rankle

lshoulder

private VJoint lshoulder

lelbow

private VJoint lelbow

lwrist

private VJoint lwrist

rshoulder

private VJoint rshoulder

relbow

private VJoint relbow

rwrist

private VJoint rwrist

solverRFeet

private AnalyticalIKSolver solverRFeet

solverLFeet

private AnalyticalIKSolver solverLFeet

solverLHand

private AnalyticalIKSolver solverLHand

solverRHand

private AnalyticalIKSolver solverRHand

leftFoot

private float[] leftFoot

rightFoot

private float[] rightFoot

temp

private float[] temp

q

private float[] q

qW

private float[] qW

qWDes

private float[] qWDes

mW

private float[] mW

mWDes

private float[] mWDes

zAxis

private float[] zAxis

yAxis

private float[] yAxis

xAxis

private float[] xAxis

qSho

private float[] qSho

qElb

private float[] qElb
Constructor Detail

IKBody

public IKBody(VJoint h)
Constructor

Parameters:
h - humanoid
Method Detail

setRoot

public void setRoot(float[] rootPos)
Set the translation of the HumanoidRoot

Parameters:
rootPos - the translation of the HumanoidRoot

placeFeet

public void placeFeet()
Places the feet onto their previous position


setLeftFoot

public void setLeftFoot(float[] l,
                        boolean keepFlat)
Set the hip and knee rotation so that a certain left foot position is satisfied.

Parameters:
l - the left foot position, in world coordinates
keepFlat - set if the foot should be kept flat on a horizontal floor (on the global X-Z plane). Modifies ankle rotation.

setRightFoot

public void setRightFoot(float[] r,
                         boolean keepFlat)
Set the hip and knee rotation so that a certain right foot position is satisfied.

Parameters:
r - the right foot position, in world coordinates
keepFlat - set if the foot should be kept flat on the floor. Modifies ankle rotation.

setFeet

public void setFeet(float[] l,
                    float[] r,
                    boolean keepFlat)
Sets the hip, knee and ankle rotations that satisfy a foot position

Parameters:
l - left foot position, null for current pos
r - right foot position, null for current pos
keepFlat - , set to keep heels flat

setLeftHand

public void setLeftHand(float[] l)
Sets the shoulder and elbow rotations that satisfy the left hand position in world coordinates

Parameters:
l - left hand position

setRightHand

public void setRightHand(float[] r)
Sets the shoulder and elbow rotations that satisfy the right hand position in world coordinates

Parameters:
l - right hand position

setLocalRightHand

public void setLocalRightHand(float[] r)
Sets the shoulder and elbow rotations that satisfy the right hand position in shoulder coordinates

Parameters:
r - right hand position

setSwivelRightHand

public void setSwivelRightHand(double sw)
Sets the right hand swivel angle (see Tolani)

Parameters:
sw - the swivel rotation

setSwivelLeftHand

public void setSwivelLeftHand(double sw)
Set the swivel rotation of the left hand (see Tolani)

Parameters:
sw - the swivel rotation of the left hand

setSwivelRightFoot

public void setSwivelRightFoot(double sw)
Set the swivel rotation of the right foot (see Tolani)

Parameters:
sw - the swivel rotation of th right foot

setSwivelLeftFoot

public void setSwivelLeftFoot(double sw)
Set the swivel rotation of the left foot (see Tolani)

Parameters:
sw - the swivel rotation of the left foot

getSwivelRightFoot

public double getSwivelRightFoot()
Get the swivel of the right foot, given the current humanoid setup

Returns:
the swivel of the right foot

getSwivelLeftFoot

public double getSwivelLeftFoot()
Get the swivel of the left foot, given the current humanoid setup

Returns:
the swivel of the left foot

getSwivelLeftArm

public double getSwivelLeftArm()
Get the swivel of the left foot, given the current humanoid setup

Returns:
the swivel of the left foot

getSwivelRightArm

public double getSwivelRightArm()
Get the swivel of the right arm, given the current humanoid setup

Returns:
the swivel of the right arm

getLeftFootRotation

public void getLeftFootRotation(double swivel,
                                float[] lf,
                                float[] qh,
                                float[] qk)
Calculates the rotations of hip and knee for given swivel and left foot position

Parameters:
swivel - swivel angle
lf - left foot position in world coordinates
qh - output: left hip rotation
qk - output: left knee rotation

getRootPosition

public void getRootPosition(float[] root)
Get the translation of the root

Parameters:
root - vector to store the translation in, null to create it

getRightFootRotation

public void getRightFootRotation(double swivel,
                                 float[] rf,
                                 float[] qh,
                                 float[] qk)
Calculates the rotations of hip and knee for given swivel and right foot position

Parameters:
swivel - swivel angle
lf - right foot position in world coordinates
qh - output: right hip rotation
qk - output: right knee rotation

setLocalLeftHand

public void setLocalLeftHand(float[] l)
Sets the shoulder and elbow rotations that satisfy the left hand position in shoulder coordinates

Parameters:
r - right hand position

getHuman

public VJoint getHuman()
Returns:
Returns the human.