hmi.elckerlyc.animationengine.procanimation
Class EndEffector

java.lang.Object
  extended by hmi.xml.XMLStructureAdapter
      extended by hmi.elckerlyc.animationengine.procanimation.EndEffector
All Implemented Interfaces:
XMLStructure

public class EndEffector
extends XMLStructureAdapter

Contains the end effector and end effector path (rotation and/or translation) of an IK motion The path can be a function of time t (0 < t < 1) and several other variables.

Author:
welberge Updated, June 22, 2007 Support for multiple parameters added., Mark ter Maat /

Field Summary
private  boolean local
           
private  org.nfunk.jep.Node nodeSwivel
           
private  org.nfunk.jep.Node[] nodeTrans
           
private  org.lsmp.djep.xjep.XJep parser
           
private  String swivelFormula
           
private  String target
           
private  String[] transFormula
           
 
Fields inherited from class hmi.xml.XMLStructureAdapter
ATTRIBUTE_TOKEN_DELIMITERS, COMMA_SEPARATOR, DECODEDARRAYSIZE, DEFAULT_RECOVER_MODE, NEWLINE, SYSTEMNEWLINE, TAB, TAB_STRING
 
Constructor Summary
EndEffector(org.lsmp.djep.xjep.XJep p)
          Constructor, no target set
EndEffector(org.lsmp.djep.xjep.XJep parser, String target)
          Constructor
 
Method Summary
 StringBuilder appendAttributeString(StringBuilder buf)
          Appends a String to buf that encodes the attributes for the XML encoding.
 StringBuilder appendContent(StringBuilder buf, XMLFormatting fmt)
          Appends a String to buf that encodes the contents for the XML encoding.
 boolean decodeAttribute(String attrName, String attrValue)
          decodes the value from an attribute value String returns true if succesful, returns false for attribute names that are not recognized.
 boolean decodeAttribute(String attrName, String attrValue, XMLTokenizer tokenizer)
          decodes the value from an attribute value String returns true if succesful, returns false for attribute names that are not recognized.
 void decodeContent(XMLTokenizer tokenizer)
          decodes the XML contents, i.e. the XML between the STag and ETag of the encoding.
 EndEffector deepCopy()
           
 double evaluateSingleIndex(int target)
          Evaluates for a single index
 double evaluateSwivel()
          Evaluates the swivel angle for time 0
 void evaluateTrans(float[] dst)
          Evaluates the translation position for the current parameter settings and time
 void evaluateTrans(float[] dst, double t)
          Evaluates the translation position for the current parameter settings at time t, 0<=t<=1
 Vector findParameters(Vector v)
          returns list with all parameters used in all formulas
 String getSwivel()
          Get the swivel formula
 String getTarget()
          Get the target
 String getTranslationFormula(int i)
          Get the translation formula
 String getXMLTag()
          returns the XML tag that is used to encode this type of XMLStructure.
 boolean isLocal()
          Checks if local coordinates are used for this endeffector
 void mirror()
          Mirrors the movement trajectory on the XY plane, switches left/right targets
 void set(EndEffector eff)
          Copy the values of eff into this endeffector, links the target joint.
 void setLocal(boolean local)
          Set if local coordinates should be used
 void setSwivel(String s)
          Set the swivel formula
 void setTranslation(int i, String translation)
          Set the translation path
 
Methods inherited from class hmi.xml.XMLStructureAdapter
appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttributes, appendAttributes, appendAttributeString, appendBooleans, appendCloseEmptyTag, appendCloseSTag, appendComment, appendContent, appendDoubleElement, appendEmptyTag, appendEmptyTag, appendEmptyTag, appendEmptyTag, appendEmptyTag, appendEmptyTag, appendETag, appendETag, appendFloatArrayElement, appendFloatElement, appendFloats, appendIntArrayElement, appendIntElement, appendInts, appendLongElement, appendNewLine, appendNewLine, appendNewLine, appendOpenSTag, appendOptionalDoubleElement, appendOptionalFloatElement, appendOptionalIntElement, appendOptionalLongElement, appendSpaces, appendSpaces, appendSTag, appendSTag, appendSTag, appendStringArrayElement, appendStrings, appendSystemNewLine, appendTab, appendTextElement, appendXML, appendXML, appendXML, appendXML, appendXML, appendXMLStructure, appendXMLStructureList, appendXMLTextElementList, countTokens, countTokens, decodeAttributes, decodeBoolean, decodeBooleanArray, decodeBooleanArray, decodeBooleanArray, decodeBooleanArray, decodeDouble, decodeDoubleArray, decodeDoubleArray, decodeDoubleArray, decodeDoubleArray, decodeFloat, decodeFloatArray, decodeFloatArray, decodeFloatArray, decodeFloatArray, decodeInt, decodeIntArray, decodeIntArray, decodeIntArray, decodeIntArray, decodeLong, decodeStringArray, decodeStringArray, decodeStringArray, decodeStringArray, decodeXMLStructureList, decodeXMLValueElement, getNamespace, getOptionalAttribute, getOptionalAttribute, getOptionalBooleanAttribute, getOptionalDoubleAttribute, getOptionalFloatAttribute, getOptionalIntAttribute, getOptionalLongAttribute, getRequiredAttribute, getRequiredBooleanAttribute, getRequiredDoubleAttribute, getRequiredFloatAttribute, getRequiredIntAttribute, getRequiredLongAttribute, getTagLine, hasContent, parseXMLElement, postProcess, preProcess, readXML, readXML, readXML, setConsoleAttributeEnabled, setDefaultRecoverMode, setRecoverMode, spaces, toString, toXMLString, toXMLString, toXMLString, toXMLString, toXMLString, toXMLString, writeXML, writeXML, writeXML, writeXML, xmlTag
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

nodeTrans

private org.nfunk.jep.Node[] nodeTrans

nodeSwivel

private org.nfunk.jep.Node nodeSwivel

transFormula

private String[] transFormula

swivelFormula

private String swivelFormula

target

private String target

local

private boolean local

parser

private org.lsmp.djep.xjep.XJep parser
Constructor Detail

EndEffector

public EndEffector(org.lsmp.djep.xjep.XJep p)
Constructor, no target set

Parameters:
p - parsers

EndEffector

public EndEffector(org.lsmp.djep.xjep.XJep parser,
                   String target)
Constructor

Parameters:
parser - parser
target - endeffector target name
Method Detail

mirror

public void mirror()
Mirrors the movement trajectory on the XY plane, switches left/right targets


set

public void set(EndEffector eff)
Copy the values of eff into this endeffector, links the target joint.

Parameters:
eff - endeffector to copy

getTarget

public String getTarget()
Get the target

Returns:
the target

getTranslationFormula

public String getTranslationFormula(int i)
Get the translation formula

Parameters:
i - index (0=x, 1=y, 2=z)
Returns:
the translation formula

setTranslation

public void setTranslation(int i,
                           String translation)
Set the translation path

Parameters:
i - the translation axis (0=x,1=y,2=z)
translation - the translation path a formula of 0

getSwivel

public String getSwivel()
Get the swivel formula

Returns:
the swivel formula

setSwivel

public void setSwivel(String s)
Set the swivel formula

Parameters:
s - the swivel formula
Throws:
org.nfunk.jep.ParseException

evaluateSwivel

public double evaluateSwivel()
Evaluates the swivel angle for time 0
Returns:
the swivel angle, 0 if invalid formula

evaluateTrans

public void evaluateTrans(float[] dst,
                          double t)
Evaluates the translation position for the current parameter settings at time t, 0<=t<=1


evaluateTrans

public void evaluateTrans(float[] dst)
Evaluates the translation position for the current parameter settings and time


evaluateSingleIndex

public double evaluateSingleIndex(int target)
Evaluates for a single index

Parameters:
target - x=0,y=1,z=2

isLocal

public boolean isLocal()
Checks if local coordinates are used for this endeffector

Returns:
true if local coordinates are used

setLocal

public void setLocal(boolean local)
Set if local coordinates should be used

Parameters:
local - new local value

deepCopy

public EndEffector deepCopy()

findParameters

public Vector findParameters(Vector v)
returns list with all parameters used in all formulas


decodeAttribute

public boolean decodeAttribute(String attrName,
                               String attrValue)
decodes the value from an attribute value String returns true if succesful, returns false for attribute names that are not recognized. Might throw a RuntimeException when an attribute has been recognized, but is ill formatted.

Overrides:
decodeAttribute in class XMLStructureAdapter

decodeAttribute

public boolean decodeAttribute(String attrName,
                               String attrValue,
                               XMLTokenizer tokenizer)
decodes the value from an attribute value String returns true if succesful, returns false for attribute names that are not recognized. Might throw a RuntimeException when an attribute has been recognized, but is ill formatted. Moreover, an XMLTokenizer reference is available which can be queried for attributes, like getTokenLine() or getTokenCharPos(), which might be helpful to produce error messages referring to lines/positions within the XML document

Overrides:
decodeAttribute in class XMLStructureAdapter

decodeContent

public void decodeContent(XMLTokenizer tokenizer)
                   throws IOException
decodes the XML contents, i.e. the XML between the STag and ETag of the encoding.

Overrides:
decodeContent in class XMLStructureAdapter
Throws:
IOException

appendContent

public StringBuilder appendContent(StringBuilder buf,
                                   XMLFormatting fmt)
Appends a String to buf that encodes the contents for the XML encoding. The encoding should start on a new line, using indentation equal to tab. There should be no newline after the encoding.

Overrides:
appendContent in class XMLStructureAdapter

appendAttributeString

public StringBuilder appendAttributeString(StringBuilder buf)
Appends a String to buf that encodes the attributes for the XML encoding. When non empty, the attribute string should start with a space character. Hint: call the appendAttribute(StringBuffer buf, String attrName, String attrValue) for every relevant attribute; this takes care of the leading space as well as spaces in between the attributes) The encoding should preferably not add newline characters.

Overrides:
appendAttributeString in class XMLStructureAdapter

getXMLTag

public String getXMLTag()
Description copied from class: XMLStructureAdapter
returns the XML tag that is used to encode this type of XMLStructure. The default returns null.

Specified by:
getXMLTag in interface XMLStructure
Overrides:
getXMLTag in class XMLStructureAdapter