maspack.spatialmotion
Class CustomSphericalCoupling

java.lang.Object
  extended by maspack.spatialmotion.RigidBodyCoupling
      extended by maspack.spatialmotion.CustomSphericalCoupling

public class CustomSphericalCoupling
extends RigidBodyCoupling

Implements a three DOF spherical coupling. Frames C and D share a common origin and are otherwise free to rotate about each other. Travel restrictions can be placed on this coupling by bounding either the maximum tilt of the z axis, or the maximum total rotation. Bounds on the maximum total rotation can be weighted by the rotation direction, so that the maximum rotations about the x, y, and z axes are different.


Field Summary
 boolean applyEuler
           
static int CUSTOM_LIMIT
           
static int ROTATION_LIMIT
           
static int RPY_LIMIT
           
static int TILT_LIMIT
           
 
Fields inherited from class maspack.spatialmotion.RigidBodyCoupling
BILATERAL, LINEAR, ROTARY
 
Constructor Summary
CustomSphericalCoupling()
           
 
Method Summary
 void getConstraintInfo(maspack.spatialmotion.RigidBodyCoupling.ConstraintInfo[] info, RigidTransform3d XCD, RigidTransform3d XFD, RigidTransform3d XERR, boolean setEngaged)
          Computes the constraint frame C and the associated constraint information.
 ProjectedCurve3D getLimitCurve()
           
 double getMaximumRotation()
          Returns the maximum total rotation for this coupling.
 void getMaximumRotation(double[] maxRot)
          Returns the maximum total rotation for each axis.
 double getMaximumTilt()
          Returns the maximum value of theta for this revolute coupling.
 void getPitchRange(double[] minmax)
          Gets the minimum and maximum values for the coupling's pitch angle (in radians).
 int getRangeType()
           
 void getRollRange(double[] minmax)
          Gets the minimum and maximum values for the coupling's roll angle (in radians).
 void getRpy(Vector3d angs, RigidTransform3d XCD)
           
 void getYawRange(double[] minmax)
          Gets the minimum and maximum values for the coupling's yaw angle (in radians).
 void initializeConstraintInfo(maspack.spatialmotion.RigidBodyCoupling.ConstraintInfo[] info)
           
 int maxUnilaterals()
          Returns the maximum number of unilateral constraints associated with this coupling.
 int numBilaterals()
          Returns the number of bilateral constraints associated with this coupling.
 void projectToConstraint(RigidTransform3d XCD, RigidTransform3d XFD)
          Computes the frame C on the constraint surface which is closest to a given frame F.
 void setLimitCurve(ProjectedCurve3D curve)
           
 void setMaximumRotation(double max)
          Sets the maximum total rotation for this coupling.
 void setMaximumRotation(double maxx, double maxy, double maxz)
          Sets the maximum total rotation about the x, y, and z axes.
 void setMaximumTilt(double max)
          Sets the maximum tilt for this coupling.
 void setPitchRange(double min, double max)
          Sets the minimum and maximum values for the coupling's pitch angle (in radians).
 void setRangeType(int type)
           
 void setRollRange(double min, double max)
          Sets the minimum and maximum values for the coupling's roll angle (in radians).
 void setRpy(RigidTransform3d XCD, Vector3d angs)
           
 void setYawRange(double min, double max)
          Sets the minimum and maximum values for the coupling's yaw angle (in radians).
 
Methods inherited from class maspack.spatialmotion.RigidBodyCoupling
findNearestAngle, getAuxState, getBilateralConstraints, getBilateralForceF, getBilateralImpulses, getBreakAccel, getBreakSpeed, getCompliance, getConstraint, getConstraintInfo, getContactDistance, getDamping, getInitialAuxState, getUnilateralConstraints, getUnilateralForceF, getUnilateralImpulses, maxConstraints, numUnilaterals, scaleDistance, setAuxState, setBilateralImpulses, setBreakAccel, setBreakSpeed, setCompliance, setContactDistance, setDamping, setDistanceAndZeroDerivative, setDistancesAndZeroDerivatives, setUnilateralImpulses, skipAuxState, transformGeometry, updateBodyStates, updateConstraintsFromC, updateUnilateralConstraints, zeroImpulses
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

applyEuler

public boolean applyEuler

TILT_LIMIT

public static final int TILT_LIMIT
See Also:
Constant Field Values

ROTATION_LIMIT

public static final int ROTATION_LIMIT
See Also:
Constant Field Values

RPY_LIMIT

public static final int RPY_LIMIT
See Also:
Constant Field Values

CUSTOM_LIMIT

public static final int CUSTOM_LIMIT
See Also:
Constant Field Values
Constructor Detail

CustomSphericalCoupling

public CustomSphericalCoupling()
Method Detail

getRangeType

public int getRangeType()

setRangeType

public void setRangeType(int type)

setLimitCurve

public void setLimitCurve(ProjectedCurve3D curve)

getLimitCurve

public ProjectedCurve3D getLimitCurve()

setMaximumRotation

public void setMaximumRotation(double max)
Sets the maximum total rotation for this coupling. This will only have an effect if the current range type is ROTATION_LIMIT. The maximum must be greater than 0, and will be clipped to the range (0, PI]. Setting the maximum to PI will remove the range restriction.

Parameters:
max - maximum total rotation

setMaximumRotation

public void setMaximumRotation(double maxx,
                               double maxy,
                               double maxz)
Sets the maximum total rotation about the x, y, and z axes. This will only have an effect if the current range type is ROTATION_LIMIT. For a general orientation, the maximum rotation angle will be computed from the length of the rotation axis weighted by the maximum values along each principal axis.

Each maximum must be greater than 0, and will be clipped to the range (0, PI]. Setting all maximums to PI will remove the range restriction.

Parameters:
maxx - maximum total rotation about x
maxy - maximum total rotation about y
maxz - maximum total rotation about z

getMaximumRotation

public void getMaximumRotation(double[] maxRot)
Returns the maximum total rotation for each axis.

Parameters:
maxRot - returns the maximum rotation for each axis

getMaximumRotation

public double getMaximumRotation()
Returns the maximum total rotation for this coupling. If separate maximum rotations have been specified for each axis, then the maximum rotation for the x axis is returned.

Returns:
the maximum rotation for this coupling, or for the x axis if separate limits have been specified for each axis

setRollRange

public void setRollRange(double min,
                         double max)
Sets the minimum and maximum values for the coupling's roll angle (in radians). These only have an effect if the current range type is RPY_LIMIT.

Parameters:
min - Minimum roll angle
max - Maximum roll angle

getRollRange

public void getRollRange(double[] minmax)
Gets the minimum and maximum values for the coupling's roll angle (in radians).

Parameters:
minmax - used to return the minimum and maximum values
See Also:
setRollRange(double, double)

setPitchRange

public void setPitchRange(double min,
                          double max)
Sets the minimum and maximum values for the coupling's pitch angle (in radians). These values only have an effect if the current range type is RPY_LIMIT.

Parameters:
min - Minimum pitch angle
max - Maximum pitch angle

getPitchRange

public void getPitchRange(double[] minmax)
Gets the minimum and maximum values for the coupling's pitch angle (in radians).

Parameters:
minmax - used to return the minimum and maximum values
See Also:
setPitchRange(double, double)

setYawRange

public void setYawRange(double min,
                        double max)
Sets the minimum and maximum values for the coupling's yaw angle (in radians). These only have an effect if the current range type is RPY_LIMIT.

Parameters:
min - Minimum yaw angle
max - Maximum yaw angle

getYawRange

public void getYawRange(double[] minmax)
Gets the minimum and maximum values for the coupling's yaw angle (in radians).

Parameters:
minmax - used to return the minimum and maximum values
See Also:
setYawRange(double, double)

setMaximumTilt

public void setMaximumTilt(double max)
Sets the maximum tilt for this coupling. The tilt is the angle between the initial and current z axis. This will only have an effect if the current range type is TILT_LIMIT. The maximum must be greater than 0, and will be clipped to the range (0, PI].

Parameters:
max - maximum value for theta

getMaximumTilt

public double getMaximumTilt()
Returns the maximum value of theta for this revolute coupling.

Returns:
maximum value for theta

maxUnilaterals

public int maxUnilaterals()
Description copied from class: RigidBodyCoupling
Returns the maximum number of unilateral constraints associated with this coupling.

Specified by:
maxUnilaterals in class RigidBodyCoupling
Returns:
maximum number of unilateral constraints

numBilaterals

public int numBilaterals()
Description copied from class: RigidBodyCoupling
Returns the number of bilateral constraints associated with this coupling.

Specified by:
numBilaterals in class RigidBodyCoupling
Returns:
number of bilateral constraints

projectToConstraint

public void projectToConstraint(RigidTransform3d XCD,
                                RigidTransform3d XFD)
Description copied from class: RigidBodyCoupling
Computes the frame C on the constraint surface which is closest to a given frame F. The input consists of the transform from F to D.

Specified by:
projectToConstraint in class RigidBodyCoupling
Parameters:
XCD - returns the transform from C to D
XFD - transform from frame F to D

getRpy

public void getRpy(Vector3d angs,
                   RigidTransform3d XCD)

setRpy

public void setRpy(RigidTransform3d XCD,
                   Vector3d angs)

initializeConstraintInfo

public void initializeConstraintInfo(maspack.spatialmotion.RigidBodyCoupling.ConstraintInfo[] info)
Specified by:
initializeConstraintInfo in class RigidBodyCoupling

getConstraintInfo

public void getConstraintInfo(maspack.spatialmotion.RigidBodyCoupling.ConstraintInfo[] info,
                              RigidTransform3d XCD,
                              RigidTransform3d XFD,
                              RigidTransform3d XERR,
                              boolean setEngaged)
Description copied from class: RigidBodyCoupling
Computes the constraint frame C and the associated constraint information. C is determined by projecting F onto the constraint surface.

Information for each constraint wrench is returned through an array of ConstraintInfo objects supplied by the argument info. This array should have a fixed number of elements equal to the number of bilateral constraints plus the maximum number of unilateral constraints. Bilateral constraints appear first, followed by the unilateral constraints. Constraint wrenches and their derivatives (with respect to frame C) are set within the fields wrenchC and dotWrenchC, repsectively. Distances to set within the distance; each of these should be the dot product of the wrench with the linearization of the constraint error XFC. For computing wrench derivatives, this method may use myVelBA, which gives the current velocity of B with repsect to A, in coordinate frame D. Information only needs to be returned for constraints which are potentially active, or engaged. Constraints which are engaged have their ConstraintInfo.engaged field set to a non-zero value. Bilateral constraints are always engaged, and their ConstraintInfo.engaged field is automatically set to 1 by the system. For unilateral constraints, the determination of whether or not the constraint is engaged, and the setting of the engaged field, should be done by this method if the argument setEngaged is true. Otherwise, if setEngaged is false, the method should take the engaged settings as given. Constraints which are engaged are those which are returned by the calls getBilateralConstraints or getUnilateralConstraints.

Specified by:
getConstraintInfo in class RigidBodyCoupling
Parameters:
info - used to return information for each possible constraint wrenches
XCD - returns the transform from C to D
XFD - transform from operation frame F to D
XERR - TODO
setEngaged - if true, this method should determine if the constraint is engaged.