com.yobotics.simulationconstructionset
Class Joint

java.lang.Object
  extended by com.yobotics.simulationconstructionset.Joint
All Implemented Interfaces:
java.io.Serializable, CommonJoint
Direct Known Subclasses:
FloatingJoint, FloatingPlanarJoint, FreeJoint, NullJoint, OneDegreeOfFreedomJoint

public abstract class Joint
extends java.lang.Object
implements CommonJoint, java.io.Serializable

Title: Yobotics! Simulation Construction Set

Description: Package for Simulating Dynamic Robots and Mechanisms

Copyright: Copyright (c) Jerry Pratt

Company: Yobotics, Inc.

Version:
Beta 1.0
Author:
Jerry Pratt
See Also:
Serialized Form

Field Summary
static double MAX_ROT_ACCEL
          The maximum rotational acceleration this joint may undergo before throwing an UnreasonableAccelerationException.
static double MAX_TRANS_ACCEL
          The maximum translational acceleration this joint may undergo before throwing an UnreasonableAccelerationException.
 
Method Summary
 void addCameraMount(CameraMount mount)
          Adds the specified camera mount to this joint.
 void addExternalForcePoint(ExternalForcePoint point)
          Adds the specified ExternalForcePoint.
 void addGroundContactPoint(GroundContactPoint point)
          Adds the specified GroundContactPoint to this joint.
 void addGroundContactPoint(int groupIdentifier, GroundContactPoint point)
           
 void addIMUMount(IMUMount mount)
          Adds the specified imu mount to this joint.
 void addJoint(Joint nextJoint)
          Adds the specified joint as a child of this joint.
 void addKinematicPoint(KinematicPoint point)
          Adds the specified KinematicPoint to this joint.
 void addSensor(SimulatedSensor simulatedSensor)
           
 void changeOffsetVector(double x, double y, double z)
          Changes the offset between the current joint and its parent joint based on the provided x, y, and z components.
 void changeOffsetVector(javax.vecmath.Vector3d newOffsetVector)
          Changes the offset between the current joint and its parent joint.
 void freezeFrame()
           
 boolean freezeNextFrame()
           
 double[] get3DRotation()
           
 void getAngularAccelerationsInBodyFrame(javax.vecmath.Vector3d angularAccelerationToPack)
           
 void getAngularAccelerationsInWorld(javax.vecmath.Vector3d angularAccelerationInWorldToPack)
           
 void getAngularVelocityInBody(javax.vecmath.Vector3d angularVelocityInBodyToPack)
           
 void getAngularVelocityInWorld(javax.vecmath.Vector3d angularVelocityInWorldToPack)
           
 java.util.ArrayList<Joint> getChildrenJoints()
           
 java.util.ArrayList<ExternalForcePoint> getExternalForcePoints()
           
 GroundContactPointGroup getGroundContactPointGroup()
           
 GroundContactPointGroup getGroundContactPointGroup(int identifier)
           
 void getJointAxis(javax.vecmath.Vector3d axisToPack)
           
 javax.media.j3d.Transform3D getJointTransform3D()
          Retrieves the Transform3D for this joint.
 void getKinematicPoints(java.util.ArrayList<KinematicPoint> list)
          Returns a list of the kinematic points associated with this joint.
 void getLinearAccelerationInBody(javax.vecmath.Vector3d linearAccelerationInBodyToPack, javax.vecmath.Vector3d pointInBody)
           
 void getLinearAccelerationInWorld(javax.vecmath.Vector3d linearAccelerationInWorldToPack, javax.vecmath.Vector3d pointInBody)
           
 void getLinearVelocityInBody(javax.vecmath.Vector3d linearVelocityInBodyToPack, javax.vecmath.Vector3d pointInBody)
           
 void getLinearVelocityInWorld(javax.vecmath.Vector3d linearVelocityInWorldToPack, javax.vecmath.Vector3d pointInBody)
           
 Link getLink()
          Retrieves the link associated with this joint.
 java.lang.String getName()
          Retrieves the joint name.
 void getOffset(javax.vecmath.Vector3d offsetToPack)
           
 javax.media.j3d.Transform3D getOffsetTransform3D()
          Retrieves the transform describing the translation between the current joint and the previous joint.
 Joint getParentJoint()
           
 void getRotationToWorld(javax.vecmath.Matrix3d rotation)
          Retrieves the rotational component of the transform between world space and this joint space.
 void getRotationToWorld(javax.vecmath.Quat4d rotation)
          Retrieves the quaternion representation of the rotational component of the transform between world space and this joint space.
 void getTransformToWorld(javax.vecmath.Quat4d rotation, javax.vecmath.Vector3d translation)
          Sets rotation and translation to the rotational and translational components of the the transform between world space and this joint space.
 void getTransformToWorld(javax.media.j3d.Transform3D ret)
          Sets ret to the transform between world space and this joint space.
 void getTranslationToWorld(javax.vecmath.Vector3d translation)
          Retrieves the translational component of the transform between world space and this joint space in vector form.
 javax.vecmath.Vector3d getUnitVector()
           
 void getXYZToWorld(DoubleYoVariable x, DoubleYoVariable y, DoubleYoVariable z)
          Stores the x, y, and z components of the translation between world space and joint space in the provided YoVariables.
 void getYawPitchRollToWorld(DoubleYoVariable yaw, DoubleYoVariable pitch, DoubleYoVariable roll)
          Retrieves the rotation between world space and joint space in terms of yaw, pitch and roll.
 boolean isDynamic()
          Indiciates whether or not this joint is dynamic.
 void recursiveDecideGroundContactPointsInContact()
          Recurse through the tree deciding if any ground contact points are in contact.
 void recursiveGetAllGroundContactPoints(java.util.ArrayList<GroundContactPoint> list)
           
 void recursiveGetChildrenJoints(java.util.ArrayList<Joint> arrayListToPack)
           
 void recursiveGetOneDegreeOfFreedomJoints(java.util.ArrayList<OneDegreeOfFreedomJoint> oneDegreeOfFreedomJointsToPack)
           
 void recursiveUpdateAllGroundContactPointVelocities()
          This function is called once per simulation tick to update the velocities of all ground contact points.
 void resetFreezeFrame()
           
 void setDynamic(boolean isDynamic)
          Specify whether or not this particular joint is dynamic.
 void setLink(Link newLink)
          Sets the link for this joint.
 java.lang.String toString()
          Returns a string representation of this joint.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_TRANS_ACCEL

public static final double MAX_TRANS_ACCEL
The maximum translational acceleration this joint may undergo before throwing an UnreasonableAccelerationException.

See Also:
Constant Field Values

MAX_ROT_ACCEL

public static final double MAX_ROT_ACCEL
The maximum rotational acceleration this joint may undergo before throwing an UnreasonableAccelerationException.

See Also:
Constant Field Values
Method Detail

getParentJoint

public Joint getParentJoint()

getChildrenJoints

public java.util.ArrayList<Joint> getChildrenJoints()

recursiveGetChildrenJoints

public void recursiveGetChildrenJoints(java.util.ArrayList<Joint> arrayListToPack)

recursiveGetOneDegreeOfFreedomJoints

public void recursiveGetOneDegreeOfFreedomJoints(java.util.ArrayList<OneDegreeOfFreedomJoint> oneDegreeOfFreedomJointsToPack)

getName

public java.lang.String getName()
Retrieves the joint name.

Returns:
Name of this joint as specified at construction.

getUnitVector

public javax.vecmath.Vector3d getUnitVector()

getJointAxis

public void getJointAxis(javax.vecmath.Vector3d axisToPack)

changeOffsetVector

public void changeOffsetVector(javax.vecmath.Vector3d newOffsetVector)
Changes the offset between the current joint and its parent joint.

Parameters:
newOffsetVector - Vector3d representing this new offset.

changeOffsetVector

public void changeOffsetVector(double x,
                               double y,
                               double z)
Changes the offset between the current joint and its parent joint based on the provided x, y, and z components.

Parameters:
x - Component of the new offset vector.
y - Component of the new offset vector.
z - Component of the new offset vector.

isDynamic

public boolean isDynamic()
Indiciates whether or not this joint is dynamic. By default, all joints are dynamic meaning they are used during dynamics calculations. Non dynamic root joints only deal with position and velocity through Featherstone pass one. They also store values for runge-kutta calculations.

Returns:
Is this joint dynamic?

setDynamic

public void setDynamic(boolean isDynamic)
Specify whether or not this particular joint is dynamic. This only matters if the joint is a root joint.

Parameters:
isDynamic - Indicate whether or not the joint is dynamic, which is true by default.

toString

public java.lang.String toString()
Returns a string representation of this joint. This includes the joint's name, its parent joint, offset vector, link, and all associated kinematic and external force points. Once this information is displayed the joint calls toString for each of it's children.

Overrides:
toString in class java.lang.Object
Returns:
String representation of this joint and its children.

getJointTransform3D

public javax.media.j3d.Transform3D getJointTransform3D()
Retrieves the Transform3D for this joint. This transform is used in graphics and position calculations and as such is called by the recursiveUpdateJoints methods. It is also used when creating a branch group copy of a specified joint.

Specified by:
getJointTransform3D in interface CommonJoint
Returns:
Transform3D belonging to this joint.

addJoint

public void addJoint(Joint nextJoint)
Adds the specified joint as a child of this joint. This function also handles all setup necessary for back tracking from child to parent. Each joint must have an associated link before being added.

Parameters:
nextJoint - Child joint to be added.

getOffsetTransform3D

public javax.media.j3d.Transform3D getOffsetTransform3D()
Retrieves the transform describing the translation between the current joint and the previous joint. This transform is translation only, with all but the last column mimicking the identity matrix.

Specified by:
getOffsetTransform3D in interface CommonJoint
Returns:
Transform3D describing the translation between this joint and its parent.

addCameraMount

public void addCameraMount(CameraMount mount)
Adds the specified camera mount to this joint. A single joint may contain multiple mounts.

Parameters:
mount - CameraMount to be added.
See Also:
CameraMount

addIMUMount

public void addIMUMount(IMUMount mount)
Adds the specified imu mount to this joint. A single joint may contain multiple mounts.

Parameters:
mount - IMUMount to be added.
See Also:
IMUMount

addKinematicPoint

public void addKinematicPoint(KinematicPoint point)
Adds the specified KinematicPoint to this joint. These points allow external forces and effects to be applied while also providing a means to monitor position and velocity. Currently the only implementation internal to SCS is the ExternalForcePoint.

Parameters:
point - KinematicPoint to be added.
See Also:
KinematicPoint

addExternalForcePoint

public void addExternalForcePoint(ExternalForcePoint point)
Adds the specified ExternalForcePoint. These points allow forces to be applied to particular joints allowing the creation of certain mechanical structures such as four-bar-linkages. See the tutorial for further details.

Parameters:
point - ExternalForcePoint
See Also:
ExternalForcePoint

addGroundContactPoint

public void addGroundContactPoint(GroundContactPoint point)
Adds the specified GroundContactPoint to this joint. These points allow ground contact modeling to occur which provides a means of robot ground interaction. For further examples see the tutorial.

Parameters:
point - GroundContactPoint
See Also:
GroundContactPoint, GroundContactModel

addGroundContactPoint

public void addGroundContactPoint(int groupIdentifier,
                                  GroundContactPoint point)

getGroundContactPointGroup

public GroundContactPointGroup getGroundContactPointGroup()

getGroundContactPointGroup

public GroundContactPointGroup getGroundContactPointGroup(int identifier)

getLink

public Link getLink()
Retrieves the link associated with this joint. Every joint has a member link which handels the physical and graphical properties of the space between this joint and its children. This includes the link mass and related properties.

Returns:
The link belonging to this joint.

getOffset

public void getOffset(javax.vecmath.Vector3d offsetToPack)

setLink

public void setLink(Link newLink)
Sets the link for this joint. If a previous link existed it is replaced, removing all graphics.

Parameters:
newLink - New link for this joint.

addSensor

public void addSensor(SimulatedSensor simulatedSensor)

getKinematicPoints

public void getKinematicPoints(java.util.ArrayList<KinematicPoint> list)
Returns a list of the kinematic points associated with this joint. (Added by Stelian).

Parameters:
list - ArrayList to which the points are added.
See Also:
KinematicPoint

getExternalForcePoints

public java.util.ArrayList<ExternalForcePoint> getExternalForcePoints()

recursiveGetAllGroundContactPoints

public void recursiveGetAllGroundContactPoints(java.util.ArrayList<GroundContactPoint> list)

getTransformToWorld

public void getTransformToWorld(javax.media.j3d.Transform3D ret)
Sets ret to the transform between world space and this joint space.

Parameters:
ret - Transform3D

getTransformToWorld

public void getTransformToWorld(javax.vecmath.Quat4d rotation,
                                javax.vecmath.Vector3d translation)
Sets rotation and translation to the rotational and translational components of the the transform between world space and this joint space.

Parameters:
rotation - Quat4d representation of the rotational component.
translation - Vector3d representation of the traslational component.

getRotationToWorld

public void getRotationToWorld(javax.vecmath.Matrix3d rotation)
Retrieves the rotational component of the transform between world space and this joint space.

Parameters:
rotation - Matrix3d containing the rotational component.

getRotationToWorld

public void getRotationToWorld(javax.vecmath.Quat4d rotation)
Retrieves the quaternion representation of the rotational component of the transform between world space and this joint space.

Parameters:
rotation - Quat4d to store the rotational transform.

getTranslationToWorld

public void getTranslationToWorld(javax.vecmath.Vector3d translation)
Retrieves the translational component of the transform between world space and this joint space in vector form.

Parameters:
translation - Vector3d representing the translation between world and joint space.

getXYZToWorld

public void getXYZToWorld(DoubleYoVariable x,
                          DoubleYoVariable y,
                          DoubleYoVariable z)
Stores the x, y, and z components of the translation between world space and joint space in the provided YoVariables.

Parameters:
x - YoVariable to store the x component.
y - YoVariable to store the y component.
z - YoVariable to store the z component.

getYawPitchRollToWorld

public void getYawPitchRollToWorld(DoubleYoVariable yaw,
                                   DoubleYoVariable pitch,
                                   DoubleYoVariable roll)
Retrieves the rotation between world space and joint space in terms of yaw, pitch and roll. These values are stored in the provided YoVariables.

Parameters:
yaw - YoVariable to store yaw.
pitch - YoVariable to store pitch.
roll - YoVariable to store roll.

get3DRotation

public double[] get3DRotation()

getLinearVelocityInBody

public void getLinearVelocityInBody(javax.vecmath.Vector3d linearVelocityInBodyToPack,
                                    javax.vecmath.Vector3d pointInBody)

getLinearVelocityInWorld

public void getLinearVelocityInWorld(javax.vecmath.Vector3d linearVelocityInWorldToPack,
                                     javax.vecmath.Vector3d pointInBody)

getAngularVelocityInBody

public void getAngularVelocityInBody(javax.vecmath.Vector3d angularVelocityInBodyToPack)

getAngularVelocityInWorld

public void getAngularVelocityInWorld(javax.vecmath.Vector3d angularVelocityInWorldToPack)

getLinearAccelerationInBody

public void getLinearAccelerationInBody(javax.vecmath.Vector3d linearAccelerationInBodyToPack,
                                        javax.vecmath.Vector3d pointInBody)

getLinearAccelerationInWorld

public void getLinearAccelerationInWorld(javax.vecmath.Vector3d linearAccelerationInWorldToPack,
                                         javax.vecmath.Vector3d pointInBody)

getAngularAccelerationsInBodyFrame

public void getAngularAccelerationsInBodyFrame(javax.vecmath.Vector3d angularAccelerationToPack)

getAngularAccelerationsInWorld

public void getAngularAccelerationsInWorld(javax.vecmath.Vector3d angularAccelerationInWorldToPack)

recursiveDecideGroundContactPointsInContact

public void recursiveDecideGroundContactPointsInContact()
Recurse through the tree deciding if any ground contact points are in contact. This function builds the list of points in contact to be used during dynamics.


recursiveUpdateAllGroundContactPointVelocities

public void recursiveUpdateAllGroundContactPointVelocities()
This function is called once per simulation tick to update the velocities of all ground contact points. Without this function only those points currently in contact would be updated.


freezeFrame

public void freezeFrame()

freezeNextFrame

public boolean freezeNextFrame()

resetFreezeFrame

public void resetFreezeFrame()