public class OpenSimCustomCoupling extends RigidBodyCoupling
|Modifier and Type||Class and Description|
"Coordinate" that drives the motion
Axes (either translation or rotation) that is driven by the coordinates and a "function"
|Constructor and Description|
|Modifier and Type||Method and Description|
Computes the TCD transform for a set of coordinates, if coordinates are supported.
Gets the z-y-x (intrinsic) roll-pitch-yaw angles corresponding to a given rotation.
Called inside the
Returns the number of bilateral constraints associated with this coupling.
Returns the number of unilateral constraints associated with this coupling, engaged or otherwise.
Project a transform TCD onto the nearest transform TGD that is legal given this coupling's bilateral constraints.
Sets this rotation to one produced by intrinsic roll-pitch-yaw angles (z-y-x).
clipCoordinate, clone, coordinatesToTCD, findNearestAngle, getBilateralConstraints, getBilateralForceG, getBilateralForces, getBreakSpeed, getCompliance, getConstraint, getConstraintFlags, getConstraintForce, getCoordinate, getCoordinateRange, getCoordinates, getDamping, getLinearLimitTol, getRotaryLimitTol, getState, getUnilateralConstraints, getUnilateralForceG, getUnilateralForces, main, numConstraints, numCoordinates, numEngagedUnilaterals, printConstraintInfo, projectAndUpdateCoordinates, scaleDistance, setBilateralForces, setBreakSpeed, setCompliance, setCoordinateRange, setCoordinateValue, setCoordinateValues, setDamping, setLinearLimitTol, setRotaryLimitTol, setState, setUnilateralForces, TCDToCoordinates, transformGeometry, updateBodyStates, updateUnilateralConstraints, zeroForces
public int numBilaterals()
public int numUnilaterals()
public void initializeConstraints()
RigidBodyCouplingconstructor to allocate constraint and coordinate information, using calls to the
addCoordinatemethods. The method may be called at other times if the constraints need to be reconfigured (such as when switching constraints between bilateral and unilateral). Subclasses should implement this method as needed.
public void updateConstraints(RigidTransform3d TGD, RigidTransform3d TCD, Twist errC, Twist velGD, boolean updateEngaged)
RigidBodyCoupling.updateBodyStates(maspack.matrix.RigidTransform3d, maspack.matrix.RigidTransform3d, maspack.matrix.RigidTransform3d, maspack.spatialmotion.Twist, boolean)to update the constraints, usually once per simulation step. This method is responsible for:
true, updating the
distanceattributes for all unilateral constraints not associated with a joint limit.
Wrenches and their derivatives should be computed with respect to frame G, which is frame C with the constraint errors removed.
If the coupling supports coordinates, their values will be updated
before this method is called so as to correspond to
TGD- idealized joint transform from frame G to D, obtained by calling
RigidBodyCoupling.projectToConstraints(maspack.matrix.RigidTransform3d, maspack.matrix.RigidTransform3d, maspack.matrix.VectorNd)on
TCD- actual joint transform from frame C to D; included for legacy reasons and not normally used
errC- error transform from frame C to G, represented as a
velGD- velocity of frame G with respect to D, as seen in frame G
true, requests the updating of unilateral
distanceattributes as describe above.
public void getRPY(Matrix3dBase M, double rpy)
M- Matrix to compute rotations
rpy- returns the angles (roll, pitch, yaw, in that order) in radians.
public void setRPY(Matrix3dBase M, double rpy)
M- Matrix to fill
rpy- roll, pitch, yaw, in order
public void projectToConstraints(RigidTransform3d TGD, RigidTransform3d TCD, VectorNd coords)
Optionally, the coupling may also extend the projection to include
unilateral constraints that are not associated with coordinate
limits. In particular, this should be done for constraints for which is
it desired to have the constraint error included in the
argument that is passed to
RigidBodyCoupling.updateConstraints(maspack.matrix.RigidTransform3d, maspack.matrix.RigidTransform3d, maspack.spatialmotion.Twist, maspack.spatialmotion.Twist, boolean).
If this coupling supports coordinates and
coords is non-
null, then the coordinate values corresponding to
also be computed and returned in
coords. The easiest way to do
this is to simply call
RigidBodyCoupling.TCDToCoordinates(maspack.matrix.VectorNd, maspack.matrix.RigidTransform3d), although in some cases
it may be computationally cheaper to compute both the coordinates and the
projection at the same time. The method should not clip
the resulting coordinates to their range limits.
TGD- returns the nearest transform to
TCDthat is legal with respect to the bilateral (and possibly some unilateral) constraints
TCD- transform from frame C to D to be projected
coords- if non-
null, should be used to return coordinate values
public void coordinatesToTCD(RigidTransform3d TCD, VectorNd coords)