shady.common.multi.chain
Class Sentinel

java.lang.Object
  extended by shady.common.multi.chain.Block
      extended by shady.common.multi.chain.Sentinel

public class Sentinel
extends Block

Sentinel block in a MultiShady chain.

The Sentinel comes before the actual first block. It's main purpose is to represent the transform from world frame to the "start frame" of the first block (Block.getTransform(vona.math.RigidTransform2D)), which is tracked as a Point.OnSegment with orientation parallel or anti-parallel to the segment's orientation.

Note that the represented transform is only computed from point when update() is called. One place where this is done is at the start of ChainIK.gotoTarget(double, double, double, int, double).

Copyright (C) 2006 Marsette A. Vona, III

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

Author:
Marsette (Marty) A. Vona, III

Field Summary
 boolean aligned
          If true, the x-axis of the start frame points along the start-to-end vector of the segment of point, else the vectors are anti-parallel.
private static java.lang.String cvsid
          CVS id.
 Point.OnSegment point
          The point identifying the origin of the start frame of the first block.
 
Fields inherited from class shady.common.multi.chain.Block
dof, leftBarrel, locked, memberStartIndex, multiEnvironment, multiShady, next, numMembers, numSegments, previous, rightBarrel, segmentStartIndex, sentinel, transform
 
Constructor Summary
Sentinel(MultiShadyCommonAPI multiShady, MultiEnvironment multiEnvironment, Point.OnSegment point, boolean aligned)
          Create a new Sentinel.
 
Method Summary
 double getEEOrientationOffset()
          Return the offset in radians of the EE frame orientation relative to the orientation of the Segment of the end-effector point.
 Point.OnSegment getEEPoint()
          Get the end-effector point.
protected  void initMembersAndSegments()
          Subclasses must implement this to set up the MemberShadys and environment segments.
(package private)  void recompute(vona.math.RigidTransform2D transform, double delta)
          Subclasses must implement this to compute the transform from the Block.previouss end frame to this block's end frame according to Block.dof, and possibly to update Block.leftBarrel and Block.rightBarrel from Block.dof.
protected  boolean recoverDOF()
          Try to figure out the current Block.dof from the state of the barrel angles in Block.multiShady.
 void update()
          Update Block.transform from point and aligned.
 
Methods inherited from class shady.common.multi.chain.Block
getDOF, getNext, getPrevious, getTransform, getTransform, hasNext, hasPrevious, isLocked, isSentinel, lock, lock, recompute, reverseUpdate, reverseUpdateChain, setDOF, setNominal, tweakDOF, unlock, updateChain
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cvsid

private static final java.lang.String cvsid

CVS id.

See Also:
Constant Field Values

point

public final Point.OnSegment point

The point identifying the origin of the start frame of the first block.


aligned

public final boolean aligned

If true, the x-axis of the start frame points along the start-to-end vector of the segment of point, else the vectors are anti-parallel.

Constructor Detail

Sentinel

public Sentinel(MultiShadyCommonAPI multiShady,
                MultiEnvironment multiEnvironment,
                Point.OnSegment point,
                boolean aligned)

Create a new Sentinel.

Parameters:
multiShady - the MultiShady containing the chain
multiEnvironment - the MultiEnvironment containing the chain
point - the point identifying the origin of the start frame of the first block
aligned - if true, the x-axis of the start frame points along the start-to-end vector of the segment of point, else the vectors are anti-parallel
Method Detail

update

public void update()

Update Block.transform from point and aligned.

Overrides:
update in class Block

initMembersAndSegments

protected void initMembersAndSegments()

Subclasses must implement this to set up the MemberShadys and environment segments.

Block.numMembers and Block.numSegments must be set, and the corresponding numbers of members and segments must be initialized (according to Block.dof, Block.leftBarrel, Block.rightBarrel, and Block.transform, which should all be consistent due to a prior call to Block.recompute()) and added to Block.multiShady and Block.multiEnvironment. Internal barrels must be closed to form the block topology, and barrels must be closed to connect to Block.previous iff it's not a Sentinel.

This impl does nothing.

Specified by:
initMembersAndSegments in class Block

recompute

void recompute(vona.math.RigidTransform2D transform,
               double delta)

Subclasses must implement this to compute the transform from the Block.previouss end frame to this block's end frame according to Block.dof, and possibly to update Block.leftBarrel and Block.rightBarrel from Block.dof.

This impl just copies the fixed world-to-start transform.

Specified by:
recompute in class Block
Parameters:
transform - the computed transform is to be written here, not null
delta - if non-zero then the DOF is incremented by this amount before computing the transform (the persistent Block.dof is not affected). This is used by ChainIK to compute columns of the chain Jacobian. The barrel angles are (allocated and) computed iff delta is 0.0. The caller must ensure that the incremented value will be in the range [-1.0,1.0].

recoverDOF

protected boolean recoverDOF()
Description copied from class: Block

Try to figure out the current Block.dof from the state of the barrel angles in Block.multiShady.

It can be assumed that the barrel angles were set as if by a call to Block.recompute(RigidTransform2D, double). If this does not appear to be the case then return false without modifying dof.

Specified by:
recoverDOF in class Block
Returns:
true iff successful

getEEPoint

public Point.OnSegment getEEPoint()

Get the end-effector point.

Note that the point may either reference a standard Segment or the body segment of a member as returned by ShadyPose.getBodySegment(double).

This impl just returns point.

Specified by:
getEEPoint in class Block
Returns:
the end-effector point

getEEOrientationOffset

public double getEEOrientationOffset()

Return the offset in radians of the EE frame orientation relative to the orientation of the Segment of the end-effector point.

TBD fix this?

This impl returns 0.0.

Specified by:
getEEOrientationOffset in class Block
Returns:
the offset in radians of the EE frame orientation relative to the orientation of the Segment of the end-effector point