hmi.elckerlyc.animationengine.mixed
Class MixedSystem

java.lang.Object
  extended by hmi.elckerlyc.animationengine.mixed.MixedSystem
Direct Known Subclasses:
OdeMixedSystem

public class MixedSystem
extends Object

A system that contains a group of physically steered joints and 0 or more groups of kinematically steered groups, connected to the physical group with a @see{Connector}. Each frame, the torques and forces calculated from the movement of the kinematically steered part are applied to the physically steered group of joints

Author:
welberge

Field Summary
private  float[] aVel
           
private  float[] aVelPrev
           
private  ArrayList<Branch> branches
           
private  float[] com
           
private  float[] connectorTransform
           
private  float[] f
           
private  float[] gravity
           
private static org.slf4j.Logger logger
           
private  float mass
           
private  PhysicalHumanoid pHuman
           
private  float[] qTemp
           
private  float[] spatialA0
           
private  float[] spatialV0
           
private  SkeletonPose startPose
           
private  float[] tempM1
           
private  float[] tempM2
           
private  float[] velPrev
           
private  float[] vTemp
           
private  float[] vTemp2
           
 
Constructor Summary
MixedSystem(float[] g, PhysicalHumanoid p)
          Constructor
 
Method Summary
 void addBranch(IDBranch idb, Connector con)
          Adds a kinematic branch
 IDSegment createIDSegment()
          Creates a IDSegment, overwrite in subclasses to create a specific subclass of IDSegment
 ArrayList<Branch> getBranches()
           
 PhysicalHumanoid getPHuman()
           
 int getRots(VJoint vj, IDSegment seg, int i, float[] q)
           
 void reset(VJoint vj)
          Resets the velocity and acceleration of the connectors
 void set(MixedSystem s, float[] q, float[] w)
          Sets the system to s.
 void setFeedbackRatio(float k)
          Set the feedback ratio for all connectors
private  void setIDFromID(ArrayList<Branch> srcBranches)
           
private  void setIDFromPHuman(PhysicalHumanoid p)
          Set the state of the idbranches to match the state of a PhysicalHumanoid
 void setMassOffset(float[] q)
          set mass offset to the physical humanoid based on joint rotations of kinematicly controlled joints
 void setMassOffset(VJoint vj)
           
private  void setPHumanFromID(ArrayList<Branch> bs, float[] q, float[] w)
           
 void setResetPose(VJoint v)
          Sets the startup pose of the physical human, that is the pose to return to on reset
 void setup()
          Should be called once the Physical human is fully created, automatically called in MixedSystemAssembler
 void time(float timeDiff, float[] q, float[] w, float[] wDiff)
          Solves ID for kinematically steered objects Applies reactive torques to the physical part and sets the CoM on the physical part.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static final org.slf4j.Logger logger

branches

private ArrayList<Branch> branches

spatialV0

private float[] spatialV0

spatialA0

private float[] spatialA0

f

private float[] f

gravity

private float[] gravity

mass

private float mass

com

private float[] com

tempM1

private float[] tempM1

tempM2

private float[] tempM2

qTemp

private float[] qTemp

vTemp

private float[] vTemp

vTemp2

private float[] vTemp2

connectorTransform

private float[] connectorTransform

pHuman

private PhysicalHumanoid pHuman

startPose

private SkeletonPose startPose

aVel

private float[] aVel

aVelPrev

private float[] aVelPrev

velPrev

private float[] velPrev
Constructor Detail

MixedSystem

public MixedSystem(float[] g,
                   PhysicalHumanoid p)
Constructor

Parameters:
g - Vec3f of gravity acceleration
p - physical humanoid used for this system
Method Detail

setup

public void setup()
Should be called once the Physical human is fully created, automatically called in MixedSystemAssembler


setResetPose

public void setResetPose(VJoint v)
Sets the startup pose of the physical human, that is the pose to return to on reset


setIDFromPHuman

private void setIDFromPHuman(PhysicalHumanoid p)
Set the state of the idbranches to match the state of a PhysicalHumanoid

Parameters:
p -

setPHumanFromID

private void setPHumanFromID(ArrayList<Branch> bs,
                             float[] q,
                             float[] w)

setIDFromID

private void setIDFromID(ArrayList<Branch> srcBranches)

set

public void set(MixedSystem s,
                float[] q,
                float[] w)
Sets the system to s. That is: - Set the state of the pHuman to match that of s.pHuman - Set the state of the ID branches, to match that of s.branches - Set the velocity and position of segments in the pHuman to match that of the velocity in s.branches in matching segments - Set the connector velocity to match the velocity in s.pHuman (currently just set to 0)


reset

public void reset(VJoint vj)
Resets the velocity and acceleration of the connectors

Parameters:
vj - next joint, will contain start pose

addBranch

public void addBranch(IDBranch idb,
                      Connector con)
Adds a kinematic branch

Parameters:
ch - the chain to add
con - the connector

setFeedbackRatio

public void setFeedbackRatio(float k)
Set the feedback ratio for all connectors

Parameters:
k - the new feedback ratio

getRots

public int getRots(VJoint vj,
                   IDSegment seg,
                   int i,
                   float[] q)

setMassOffset

public void setMassOffset(VJoint vj)

setMassOffset

public void setMassOffset(float[] q)
set mass offset to the physical humanoid based on joint rotations of kinematicly controlled joints


time

public void time(float timeDiff,
                 float[] q,
                 float[] w,
                 float[] wDiff)
Solves ID for kinematically steered objects Applies reactive torques to the physical part and sets the CoM on the physical part. Rotations, velocities and angular accelerations are to be provided in one array for all chains ordered as: chain1:joint1, chain1:joint2, .., chain1:jointN,chain2:joint1, ... joint 1 is the joint that is the closest to the connector. Connector velocities and accelerations are calculated based on connector positions from the previous frame.

Parameters:
timeDiff - time since last update
q - rotations of the joints in the branches
w - angular velocity of the joints in the branches
wDiff - angular acceleration of the joints in the branches

getBranches

public ArrayList<Branch> getBranches()
Returns:
the branches

createIDSegment

public IDSegment createIDSegment()
Creates a IDSegment, overwrite in subclasses to create a specific subclass of IDSegment

Returns:
a new IDSegment

getPHuman

public PhysicalHumanoid getPHuman()
Returns:
the pHuman