public class EllipsoidCoupling3d extends RigidBodyCoupling
Modifier and Type | Field and Description |
---|---|
boolean |
myUseOpenSimApprox |
static int |
THETA_IDX |
static int |
X_IDX |
static int |
Y_IDX |
debug
Constructor and Description |
---|
EllipsoidCoupling3d() |
EllipsoidCoupling3d(double a,
double b,
double c) |
EllipsoidCoupling3d(double a,
double b,
double c,
boolean useOpenSimApprox) |
Modifier and Type | Method and Description |
---|---|
MatrixNd |
computeCoordinateJacobian(RigidTransform3d TGD)
Computes the coordinate Jacobian.
|
void |
coordinatesToTCD(RigidTransform3d TCD,
double x,
double y,
double theta) |
void |
coordinatesToTCD(RigidTransform3d TCD,
VectorNd coords)
Computes the TCD transform for a set of coordinates, if coordinates are
supported.
|
Vector3d |
getSemiAxisLengths() |
boolean |
getUseOpenSimApprox() |
void |
initializeConstraints()
Called inside the
RigidBodyCoupling constructor to allocate
constraint and coordinate information, using calls to the addConstraint and addCoordinate methods. |
void |
projectToConstraints(RigidTransform3d TGD,
RigidTransform3d TCD,
VectorNd coords)
Project a transform TCD onto the nearest transform TGD that is legal
given this coupling's bilateral constraints.
|
void |
setSemiAxisLengths(Vector3d lengths) |
void |
setUseOpenSimApprox(boolean enable) |
void |
TCDToCoordinates(VectorNd coords,
RigidTransform3d TCD)
If coordinates are supported by this coupling, compute their values based
on the supplied transform TCD from frame C to D, and return the result in
coords . |
void |
updateConstraints(RigidTransform3d TGD,
RigidTransform3d TCD,
Twist errC,
Twist velGD,
boolean updateEngaged)
Called from
RigidBodyCoupling.updateBodyStates(maspack.matrix.RigidTransform3d, maspack.matrix.RigidTransform3d, maspack.matrix.RigidTransform3d, maspack.spatialmotion.Twist, boolean) to update the constraints, usually
once per simulation step. |
clipCoordinate, clone, coordinatesToTCD, findNearestAngle, getBilateralConstraints, getBilateralForceG, getBilateralForces, getBreakSpeed, getCompliance, getConstraint, getConstraintFlags, getConstraintForce, getCoordinate, getCoordinateIndex, getCoordinateMotionType, getCoordinateName, getCoordinateRange, getCoordinates, getCoordinateSpeed, getCoordinateWrench, getDamping, getLinearLimitTol, getRotaryLimitTol, getState, getUnilateralConstraints, getUnilateralForceG, getUnilateralForces, getUnilateralState, isCoordinateLocked, main, numBilaterals, numConstraints, numCoordinates, numEngagedUnilaterals, numUnilaterals, printConstraintInfo, projectAndUpdateCoordinates, scaleDistance, setBilateralForces, setBreakSpeed, setCompliance, setCoordinateLocked, setCoordinateName, setCoordinateRange, setCoordinateValue, setCoordinateValues, setDamping, setLinearLimitTol, setRotaryLimitTol, setState, setUnilateralForces, setUnilateralState, transformGeometry, updateBodyStates, updateUnilateralConstraints, zeroForces
public static final int X_IDX
public static final int Y_IDX
public static final int THETA_IDX
public boolean myUseOpenSimApprox
public EllipsoidCoupling3d()
public EllipsoidCoupling3d(double a, double b, double c)
public EllipsoidCoupling3d(double a, double b, double c, boolean useOpenSimApprox)
public boolean getUseOpenSimApprox()
public void setUseOpenSimApprox(boolean enable)
public void setSemiAxisLengths(Vector3d lengths)
public Vector3d getSemiAxisLengths()
public void projectToConstraints(RigidTransform3d TGD, RigidTransform3d TCD, VectorNd coords)
RigidBodyCoupling
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 errC
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 TGD
should
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.
projectToConstraints
in class RigidBodyCoupling
TGD
- returns the nearest transform to TCD
that is legal with
respect to the bilateral (and possibly some unilateral) constraintsTCD
- transform from frame C to D to be projectedcoords
- if non-null
, should be used to return coordinate
valuespublic void initializeConstraints()
RigidBodyCoupling
RigidBodyCoupling
constructor to allocate
constraint and coordinate information, using calls to the addConstraint
and addCoordinate
methods. 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.initializeConstraints
in class RigidBodyCoupling
public MatrixNd computeCoordinateJacobian(RigidTransform3d TGD)
public void updateConstraints(RigidTransform3d TGD, RigidTransform3d TCD, Twist errC, Twist velGD, boolean updateEngaged)
RigidBodyCoupling
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:
updateEngaged
is true
, updating the engaged
and distance
attributes 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
.
updateConstraints
in class RigidBodyCoupling
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
TCD
- actual joint transform from frame C to D; included
for legacy reasons and not normally usederrC
- error transform from frame C to G, represented as a
Twist
velGD
- velocity of frame G with respect to D, as seen in frame GupdateEngaged
- if true
, requests the updating of unilateral
engaged
and distance
attributes as describe above.public void TCDToCoordinates(VectorNd coords, RigidTransform3d TCD)
RigidBodyCoupling
coords
. Otherwise this method does nothing.
It is assumed that TCD
is legal with respect the coupling's
bilateral constraints, as defined by RigidBodyCoupling.projectToConstraints(maspack.matrix.RigidTransform3d, maspack.matrix.RigidTransform3d, maspack.matrix.VectorNd)
;
otherwise, RigidBodyCoupling.projectToConstraints(maspack.matrix.RigidTransform3d, maspack.matrix.RigidTransform3d, maspack.matrix.VectorNd)
should be used instead.
When setting coordinate values, they should not be clipped to
their maximum and minimum values (as defined by RigidBodyCoupling.getCoordinateRange(int)
.
TCDToCoordinates
in class RigidBodyCoupling
coords
- returns the coordinate valuesTCD
- transform from frame C to Dpublic void coordinatesToTCD(RigidTransform3d TCD, double x, double y, double theta)
public void coordinatesToTCD(RigidTransform3d TCD, VectorNd coords)
coordinatesToTCD
in class RigidBodyCoupling
TCD
- returns the TCD transformcoords
- supplies the coordinate values and
must have a length >= RigidBodyCoupling.numCoordinates()
.