public class SegmentedPlanarCoupling extends RigidBodyCoupling
debug
Constructor and Description |
---|
SegmentedPlanarCoupling() |
SegmentedPlanarCoupling(double[] segs) |
Modifier and Type | Method and Description |
---|---|
SegmentedPlanarCoupling |
clone() |
Plane |
closestPlane(Point3d p)
Returns the plane closest to a specified point in the D coordinate frame.
|
void |
coordinatesToTCD(RigidTransform3d TCD,
VectorNd coords)
Computes the TCD transform for a set of coordinates, if coordinates are
supported.
|
java.util.ArrayList<Plane> |
getPlanes()
Returns a list of the planes in frame D.
|
java.util.ArrayList<Point3d> |
getSegmentPoints()
Returns a list of points describing the piecewise linear curve in the D
frame x-z plane which defines the plane segments.
|
void |
initializeConstraints()
Called inside the
RigidBodyCoupling constructor to allocate
constraint and coordinate information, using calls to the addConstraint and addCoordinate methods. |
boolean |
isUnilateral() |
int |
numBilaterals()
Returns the number of bilateral constraints associated with this coupling.
|
int |
numPlanes()
Returns the number of planar segments associated with this coupling.
|
int |
numUnilaterals()
Returns the number of unilateral constraints associated with this
coupling, engaged or otherwise.
|
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 |
scaleDistance(double s)
Scales the distance units of this constraint.
|
void |
setSegments(double[] segs)
Sets the plane segments associated with this SegmentedPlanarCoupling.
|
void |
setUnilateral(boolean unilateral) |
void |
transformGeometry(GeometryTransformer gt,
RigidTransform3d TCW,
RigidTransform3d TDW)
Transforms the geometry of this coupling.
|
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, 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, numConstraints, numCoordinates, numEngagedUnilaterals, printConstraintInfo, projectAndUpdateCoordinates, setBilateralForces, setBreakSpeed, setCompliance, setCoordinateLocked, setCoordinateName, setCoordinateRange, setCoordinateValue, setCoordinateValues, setDamping, setLinearLimitTol, setRotaryLimitTol, setState, setUnilateralForces, setUnilateralState, TCDToCoordinates, updateBodyStates, updateUnilateralConstraints, zeroForces
public SegmentedPlanarCoupling()
public SegmentedPlanarCoupling(double[] segs)
public java.util.ArrayList<Point3d> getSegmentPoints()
public java.util.ArrayList<Plane> getPlanes()
public int numPlanes()
public void setUnilateral(boolean unilateral)
public boolean isUnilateral()
public void setSegments(double[] segs)
segs
- x-z coordinate pairs defining the segmentspublic Plane closestPlane(Point3d p)
p
- point to find nearest plane topublic int numUnilaterals()
RigidBodyCoupling
numUnilaterals
in class RigidBodyCoupling
public int numBilaterals()
RigidBodyCoupling
numBilaterals
in class RigidBodyCoupling
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 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 scaleDistance(double s)
RigidBodyCoupling
scaleDistance
in class RigidBodyCoupling
s
- scale factorpublic void transformGeometry(GeometryTransformer gt, RigidTransform3d TCW, RigidTransform3d TDW)
RigidBodyCoupling
transformGeometry
in class RigidBodyCoupling
gt
- transformer implementing the transformationTCW
- current transform from C to worldTDW
- current transform from D to worldpublic 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()
.public SegmentedPlanarCoupling clone()
clone
in class RigidBodyCoupling