hmi.elckerlyc.animationengine.mixed
Class Connector

java.lang.Object
  extended by hmi.elckerlyc.animationengine.mixed.Connector

public class Connector
extends Object

Connection point for a @see{KinematicChain} to a @see{PhysicalSegment}

Author:
welberge

Field Summary
private  float[] aAcc
           
private  float[] acc
           
private  float[] aVel
           
private  float[] bodyRotation
           
private  float[] connectionPoint
           
private  boolean isFirst
           
private  float k
           
private  org.slf4j.Logger logger
           
private static float MAX_REACTIVE_TORQUE
           
private  float[] mTemp
           
private  float[] prevAVel
           
private  float[] prevVel
           
private  float[] rTorque
           
private  PhysicalSegment segment
           
private  float[] tempPos
           
private  float[] tempRot
           
private  float[] tempS
           
private  float[] vel
           
 
Constructor Summary
Connector(PhysicalSegment seg, float[] p, float kmul)
          Sets up the connector, assumes the segment is initialized and has a valid world position
 
Method Summary
 void applyReactiveTorque(float[] q, float[] f)
          Applies a reactive torque of -k*f to the connectors body
 void getAvelocity(float[] aVelocity)
           
 void getRelVelocity(float[] velocity)
           
 void getSpatialVelocityAndAcceleration(float timeDiff, float[] spatialV, float[] spatialA)
          Calculates the spatial velocity and acceleration of the connector from the velocity of the physical segment and the velocity at the previous call to this function Not thread safe, the caller of this function needs to guard for thread safety for the physical segment
 void getSpatialVelocityAndAcceleration(float timeDiff, float[] spatialV, float[] spatialA, float[] spatialG)
          Calculates the spatial velocity and acceleration of the connector from the velocity of the physical segment and the velocity at the previous call to this function Not thread safe, the caller of this function needs to guard for thread safety for the physical segment Depends on previous velocity values, call reset before using this function if drastic changes happened
 PhysicalSegment getStartSegment()
           
 void getVelocity(float[] velocity)
           
 void getWorldPosition(float[] dst)
          Get the world position of the connection point Not thread safe, the caller of this function needs to guard for thread safety for the physical segment
 void getWorldTransform(float[] m)
          Get the 4x4 world transform of the connection point Not thread safe, the caller of this function needs to guard for thread safety for the physical segment
 void reset()
          Resets the state of the connector, newly calculated acceleration values will assume 0 velocity at the previous frame.
 void setFeedbackRatio(float kmul)
          Sets the ratio of torques that is applied to the physical body
 void setVel(Connector c)
          Sets the prevVel and prevAvel from connector c
 
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

segment

private PhysicalSegment segment

connectionPoint

private float[] connectionPoint

vel

private float[] vel

aVel

private float[] aVel

aAcc

private float[] aAcc

acc

private float[] acc

prevVel

private float[] prevVel

prevAVel

private float[] prevAVel

rTorque

private float[] rTorque

bodyRotation

private float[] bodyRotation

tempS

private float[] tempS

tempRot

private float[] tempRot

tempPos

private float[] tempPos

mTemp

private float[] mTemp

isFirst

private boolean isFirst

k

private float k

MAX_REACTIVE_TORQUE

private static final float MAX_REACTIVE_TORQUE
See Also:
Constant Field Values
Constructor Detail

Connector

public Connector(PhysicalSegment seg,
                 float[] p,
                 float kmul)
Sets up the connector, assumes the segment is initialized and has a valid world position

Parameters:
seg - physical segment
p - the connection point, in world coordinates
kmul - the reactive torque multiplier (typically 0 < kmul < 1), 0.6 works well
Method Detail

setFeedbackRatio

public void setFeedbackRatio(float kmul)
Sets the ratio of torques that is applied to the physical body

Parameters:
kmul - the new feedback ratio

reset

public void reset()
Resets the state of the connector, newly calculated acceleration values will assume 0 velocity at the previous frame.


setVel

public void setVel(Connector c)
Sets the prevVel and prevAvel from connector c

Parameters:
c -

getWorldTransform

public void getWorldTransform(float[] m)
Get the 4x4 world transform of the connection point Not thread safe, the caller of this function needs to guard for thread safety for the physical segment

Parameters:
m - output: the world position of the connection point

getWorldPosition

public void getWorldPosition(float[] dst)
Get the world position of the connection point Not thread safe, the caller of this function needs to guard for thread safety for the physical segment

Parameters:
dst - output: the world position of the connection point

getRelVelocity

public void getRelVelocity(float[] velocity)

getVelocity

public void getVelocity(float[] velocity)

getAvelocity

public void getAvelocity(float[] aVelocity)

getSpatialVelocityAndAcceleration

public void getSpatialVelocityAndAcceleration(float timeDiff,
                                              float[] spatialV,
                                              float[] spatialA,
                                              float[] spatialG)
Calculates the spatial velocity and acceleration of the connector from the velocity of the physical segment and the velocity at the previous call to this function Not thread safe, the caller of this function needs to guard for thread safety for the physical segment Depends on previous velocity values, call reset before using this function if drastic changes happened

Parameters:
timeDiff - time since previous call
spatialV - output: the current spatial velocity
spatialA - output: the current spatial acceleration
spatialG - spatial acceleration gravity in world coordinates

getSpatialVelocityAndAcceleration

public void getSpatialVelocityAndAcceleration(float timeDiff,
                                              float[] spatialV,
                                              float[] spatialA)
Calculates the spatial velocity and acceleration of the connector from the velocity of the physical segment and the velocity at the previous call to this function Not thread safe, the caller of this function needs to guard for thread safety for the physical segment

Parameters:
timeDiff - time since previous call
spatialV - output: the current spatial velocity
spatialA - output: the current spatial acceleration

applyReactiveTorque

public void applyReactiveTorque(float[] q,
                                float[] f)
Applies a reactive torque of -k*f to the connectors body

Parameters:
f - the reactive torque

getStartSegment

public PhysicalSegment getStartSegment()