public abstract class BodyConnector extends RenderableComponentBase implements ScalableUnits, TransformableGeometry, HasNumericState, Constrainer, HasCoordinateFrame
ModelComponent.NavpanelVisibility
Modifier and Type | Field and Description |
---|---|
static boolean |
debug |
static PropertyList |
myProps |
static boolean |
useOldDerivativeMethod |
enforceUniqueCompositeNames, enforceUniqueNames, myNumber, NULL_OBJ, useCompactPathNames
TG_ARTICULATED, TG_DRAGGER, TG_PRESERVE_ORIENTATION, TG_SIMULATING
TRANSPARENT, TWO_DIMENSIONAL
Modifier and Type | Method and Description |
---|---|
int |
addBilateralConstraints(SparseBlockMatrix GT,
VectorNd dg,
int numb)
Appends the current bilateral force constraint matrix
Gc^T to the
matrix GT , by appending block columns to it. |
int |
addFrictionConstraints(SparseBlockMatrix DT,
java.util.ArrayList<FrictionInfo> finfo,
boolean prune,
int numf)
Appends the friction force constraint matrix
Dc^T to the matrix
DT , by appending block columns to it. |
void |
addMasterBlocks(SparseBlockMatrix GT,
int bj,
Matrix GC,
FrameAttachment attachment) |
void |
addTransformableDependencies(TransformGeometryContext context,
int flags)
Adds to
context any transformable components which should be
transformed as the same time as this component. |
int |
addUnilateralConstraints(SparseBlockMatrix NT,
VectorNd dn,
int numu)
Appends the current unilateral force constraint matrix
Nc^T to the
matrix NT , by appending block columns to it. |
void |
computeConstraintMatrixA(Matrix6x1 GC,
Wrench wr,
double scale) |
void |
computeConstraintMatrixB(Matrix6x1 GC,
Wrench wr,
double scale) |
void |
connectToHierarchy(CompositeComponent hcomp)
Called by the system after this component, or an ancestor of this
component, is added to the component hierarchy (i.e., added as
a child of another CompositeComponent).
|
BodyConnector |
copy(int flags,
java.util.Map<ModelComponent,ModelComponent> copyMap) |
void |
disconnectFromHierarchy(CompositeComponent hcomp)
Called by the system after this component, or an ancestor of this
component, is removed from the component hierarchy (i.e., removed as a
child of its parent).
|
static boolean |
findAttachedBodies(ConnectableBody body,
ConnectableBody exclude,
java.util.List<ConnectableBody> bodies)
Finds all connectable bodies which are attached to a given body via
connectors.
|
double |
getActivation(int idx)
Deprecated.
Use
getConstraintForce(int) instead. |
PropertyInfoList |
getAllPropertyInfo()
Returns a list giving static information about all properties exported by
this object.
|
double |
getAxisLength() |
Wrench |
getBilateralForceInA()
If body A is a Frame, computes and returns the wrench acting on body A in
response to the most recent bilateral constraint forces.
|
void |
getBilateralForceInA(Wrench wr)
If body A is a Frame, computes the wrench acting on body A in response to
the most recent bilateral constraint forces.
|
Wrench |
getBilateralForceInB()
If body B is a Frame, computes and returns the wrench acting on body B in
response to the most recent bilateral constraint forces.
|
void |
getBilateralForceInB(Wrench wr)
If body B is a Frame, computes the wrench acting on body B in response to
the most recent bilateral constraint forces.
|
Wrench |
getBilateralForceInC()
Returns the most recent bilateral constraint wrench acting on constraint
frame C.
|
void |
getBilateralForceInC(Wrench wr)
Gets the most recent bilateral constraint wrench acting on constraint
frame C.
|
int |
getBilateralForces(VectorNd lam,
int idx)
Returns the bilateral forces that were most recently set for this
constrainer using
Constrainer.setBilateralForces(maspack.matrix.VectorNd, double, int) . |
int |
getBilateralInfo(MechSystem.ConstraintInfo[] ginfo,
int idx)
Returns constraint information for each row of the bilateral
constraint system
|
void |
getBilateralSizes(VectorNi sizes)
Returns the sizes of each block column in the bilateral force constraint
matrix.
|
ConnectableBody |
getBodyA()
Returns the first body associated with this constrainer.
|
ConnectableBody |
getBodyB()
Returns the second body associated with this constrainer, or null if there
is no such body.
|
VectorNd |
getCompliance()
Returns the compliance settings for all the constraints in this
connector.
|
void |
getConstrainedComponents(java.util.List<DynamicComponent> list)
Collected all the dynamic components constrained by this constrainer.
|
RigidBodyConstraint |
getConstraint(int idx)
For debugging.
|
VectorNi |
getConstraintFlags()
Returns flags for all this connector's constraints.
|
double |
getConstraintForce(int idx)
Returns the current force for the
idx -th constraint in this
connector. |
boolean |
getCopyReferences(java.util.List<ModelComponent> refs,
ModelComponent ancestor) |
RigidBodyCoupling |
getCoupling()
Returns the coupling used by this connector.
|
void |
getCurrentTCD(RigidTransform3d TCD)
Queries the current transform from frame C to D.
|
RigidTransform3d |
getCurrentTCW()
Returns the current pose of the C frame, in world coordinates.
|
void |
getCurrentTCW(RigidTransform3d TCW)
Returns the current pose of the C frame, in world coordinates.
|
RigidTransform3d |
getCurrentTDW()
Returns the current pose of the D frame, in world coordinates.
|
void |
getCurrentTDW(RigidTransform3d TDW)
Returns the current pose of the D frame, in world coordinates.
|
VectorNd |
getDamping()
Returns the damping settings for all the constraints in this
connector.
|
Renderer.AxisDrawStyle |
getDrawFrameC() |
Renderer.AxisDrawStyle |
getDrawFrameD() |
FrameAttachment |
getFrameAttachmentA()
Returns the
Frame attachment which attaches connector frame C to the
coordinate frame of body A. |
FrameAttachment |
getFrameAttachmentB()
Returns the
Frame attachment which attaches connector frame D to
the coordinate frame of body B (or to world if body B is null ). |
int |
getFrictionForces(VectorNd phi,
int idx)
Returns the friction forces that were most recently set for this
constrainer using
Constrainer.setFrictionForces(maspack.matrix.VectorNd, double, int) . |
int |
getFrictionState(VectorNi state,
int idx) |
void |
getHardReferences(java.util.List<ModelComponent> refs)
Appends all hard references for this component to a list.
|
double |
getLinearCompliance()
Returns the uniform compliance value, if any, for the linear constraints
of this connector.
|
double |
getPenetrationTol()
Queries the penetration tolerance for this connector.
|
PropertyMode |
getPenetrationTolMode() |
void |
getPose(RigidTransform3d TDW)
Returns the pose of this connector, which is defined by its
D coordinate frame.
|
RigidTransform3d |
getRenderFrame() |
double |
getRotaryCompliance()
Returns the uniform compliance value, if any, for the rotary constraints
of this connector.
|
double |
getRotaryLimitTol()
Queries the rotary limit tolerance for this connector.
|
PropertyMode |
getRotaryLimitTolMode() |
void |
getState(DataBuffer data)
Saves state information for this component by adding data to the
supplied DataBuffer.
|
int |
getStateVersion()
Returns a version number for this component's state.
|
boolean |
getTransformDGeometryOnly()
Queries whether geometry transforms applied to this connector change only
the D frame.
|
boolean |
getTransformPositionOnly()
Queries whether geometry transforms applied to this connector change only
the origins of the transforms TDW and/or TDC.
|
Wrench |
getUnilateralForceInA()
If body A is a Frame, computes and returns the wrench acting on body A in
response to the most recent unilateral constraint forces.
|
void |
getUnilateralForceInA(Wrench wr)
If body A is a Frame, computes the wrench acting on body A in response to
the most recent unilateral constraint forces.
|
Wrench |
getUnilateralForceInB()
If body B is a Frame, computes and returns the wrench acting on body B in
response to the most recent unilateral constraint forces.
|
void |
getUnilateralForceInB(Wrench wr)
If body B is a Frame, computes the wrench acting on body B in response to
the most recent unilateral constraint forces.
|
Wrench |
getUnilateralForceInC()
Returns the most recent unilateral constraint wrench acting on constraint
frame C.
|
void |
getUnilateralForceInC(Wrench wr)
Gets the most recent unilateral constraint wrench acting on constraint
frame C.
|
int |
getUnilateralForces(VectorNd the,
int idx)
Returns the unilateral forces that were most recently set for this
constrainer using
Constrainer.setUnilateralForces(maspack.matrix.VectorNd, double, int) . |
int |
getUnilateralInfo(MechSystem.ConstraintInfo[] ninfo,
int idx)
Returns constraint information for each row of the unilateral
constraint system
|
void |
getUnilateralSizes(VectorNi sizes)
Returns the sizes of each block column in the unilateral force constraint
matrix.
|
int |
getUnilateralState(VectorNi state,
int idx) |
boolean |
hasState()
Queries if this component has state.
|
boolean |
isActive()
Returns true if this connector is enabled and at least one of
it's underlying master components is active.
|
boolean |
isConnectedToBodies()
Queries whether or not this connector is connected to its bodies
via a component hierarchy.
|
boolean |
isDuplicatable() |
boolean |
isEnabled()
Queries whether this connector is enabled.
|
boolean |
isNotAttached()
Returns true if this connector is enabled and at least one of
it's underlying master components is not attached.
|
int |
maxFrictionConstraintSets()
Returns the maximum number of friction constraint sets that can be
expected for this constraint.
|
int |
numBilateralConstraints()
Returns the number of bilateral constraints associated with this
connector.
|
int |
numConstraints()
Returns the total number of constraints associated with this
connector.
|
int |
numEngagedUnilateralConstraints()
Returns the number of unilateral constraints which are currently engaged.
|
int |
numUnilateralConstraints()
Returns the number of unilateral constraints associated with this
connector (engaged or otherwise).
|
void |
prerender(RenderList list)
Called prior to rendering to allow this object to update the internal
state required for rendering (such as by caching rendering coordinates).
|
static void |
printConnectedBodies(ConnectableBody body) |
void |
printConstraintInfo()
Prints constraint information to the standard output.
|
void |
render(Renderer renderer,
int flags)
Render this object using the functionality of the supplied
Renderer . |
void |
scaleDistance(double s)
Scales all distance coordinates.
|
void |
scaleMass(double m)
Nothing to do for scale mass.
|
void |
setAlwaysAdjustBodyA(boolean set)
Sets the connector to explicitly adjust body A's pose only when
pose needs to be manually corrected to account for constraints.
|
void |
setAxisLength(double len) |
int |
setBilateralForces(VectorNd lam,
double s,
int idx)
Sets the bilateral forces that were computed to enforce this
constraint.
|
void |
setBodies(ConnectableBody bodyA,
ConnectableBody bodyB,
RigidTransform3d TDW)
Attaches two connectable bodies,
bodyA and bodyB , to this
connector. |
void |
setBodies(ConnectableBody bodyA,
ConnectableBody bodyB,
RigidTransform3d TCW,
RigidTransform3d TDW)
Attaches two connectable bodies,
bodyA and bodyB , to this
connector. |
void |
setBodies(ConnectableBody bodyA,
FrameAttachment attachmentA,
ConnectableBody bodyB,
FrameAttachment attachmentB)
Attaches two connectable bodies,
bodyA and bodyB , to this
connector, using explicitly specified Frame attachments to attach
the connector frames C and D to the coordinate frames A and B of the two
bodies. |
void |
setBodies(RigidBody bodyA,
RigidTransform3d TCA,
RigidBody bodyB,
RigidTransform3d TDB)
Attaches two rigid bodies,
bodyA and bodyB , to this
connector. |
void |
setCompliance(VectorNd compliance)
Sets the compliance settings for the constraints in this connector,
including bilateral and unilateral constraints.
|
void |
setCurrentTCW(RigidTransform3d TCW)
Sets the current pose of the C frame, in world coordinates, and
updates the attachment between C and body A accordingly.
|
void |
setCurrentTDW(RigidTransform3d TDW)
Sets the current pose of the D frame, in world coordinates, and
updates the attachment between D and body B accordingly.
|
void |
setDamping(VectorNd damping)
Sets the damping settings for the constraints in this connector,
including bilateral and unilateral constraints.
|
void |
setDrawFrameC(Renderer.AxisDrawStyle style) |
void |
setDrawFrameD(Renderer.AxisDrawStyle style) |
void |
setEnabled(boolean enabled)
Sets whether or not this connector is enabled.
|
int |
setFrictionForces(VectorNd phi,
double s,
int idx)
Sets the friction forces that were computed to enforce this
constraint.
|
int |
setFrictionState(VectorNi state,
int idx) |
void |
setLinearCompliance(double c)
Sets a uniform compliance for the linear constraints of this connector.
|
void |
setPenetrationTol(double tol)
Sets the penetration tolerance for this connector.
|
void |
setPenetrationTolMode(PropertyMode mode) |
void |
setRotaryCompliance(double c)
Sets a uniform compliance for the rotary constraints of this connector.
|
void |
setRotaryLimitTol(double tol)
Sets the rotary limit tolerance for this connector.
|
void |
setRotaryLimitTolMode(PropertyMode mode) |
void |
setState(DataBuffer data)
Restores the state for this component by reading from the supplied
data buffer, starting at the current buffer offsets.
|
void |
setTransformDGeometryOnly(boolean enable)
Sets whether geometry transforms applied to this connector change only
the D frame.
|
void |
setTransformPositionOnly(boolean posOnly)
Sets whether geometry transforms applied to this connector change only
the origins of the transforms TDW and/or TDC (and ignore changed in
orientation).
|
int |
setUnilateralForces(VectorNd the,
double s,
int idx)
Sets the unilateral forces that were computed to enforce this
constraint.
|
int |
setUnilateralState(VectorNi state,
int idx) |
void |
transformGeometry(AffineTransform3dBase X)
Applies an affine transformation to the geometry of this component.
|
void |
transformGeometry(GeometryTransformer gtr,
TransformGeometryContext context,
int flags)
Transforms the geometry of this component, using the geometry transformer
gtr to transform its individual attributes. |
void |
updateAttachments()
XXX Update attachments prior to calling getCurrentTDW(), etc.
|
void |
updateBounds(Vector3d pmin,
Vector3d pmax)
Update the minimum and maximum points for this object.
|
double |
updateConstraints(double t,
int flags)
Updates the current set of constraints, and returns the maximum
penetration
> 0 associated with all of them. |
void |
zeroForces()
Zeros all bilateral and unilateral constraint forces in this constraint.
|
createRenderProps, defaultRenderPropsAreNull, getRenderHints, getRenderProps, getSelection, isSelectable, isVisible, numSelectionQueriesNeeded, setRenderProps, setVisible, updateRenderProps
checkFlag, checkName, checkNameUniqueness, clearFlag, clone, createTempFlag, getChildren, getGrandParent, getName, getNameRange, getNavpanelVisibility, getNavpanelVisibility, getNumber, getParent, getProperty, getSoftReferences, hasChildren, isFixed, isMarked, isScanning, isSelected, isWritable, makeValidName, makeValidName, notifyParentOfChange, postscan, printReferences, recursivelyContained, recursivelyContains, removeTempFlag, scan, setFixed, setFlag, setMarked, setName, setNavpanelVisibility, setNavpanelVisibility, setNumber, setParent, setScanning, setSelected, setWritable, updateReferences, write
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
transformPriority
advanceState, getAuxVarDerivative, getAuxVarState, numAuxVars, requiresAdvance, setAuxVarState
getName, getNavpanelVisibility, getNumber, getParent, getSoftReferences, isFixed, isMarked, isSelected, notifyParentOfChange, scan, setFixed, setMarked, setName, setNumber, setParent, setSelected, setWritable, updateReferences
getProperty
getChildren, hasChildren
postscan
isWritable, write
public static boolean debug
public static boolean useOldDerivativeMethod
public static PropertyList myProps
public void setPenetrationTol(double tol)
tol
- new penetration tolerancepublic double getPenetrationTol()
getPenetrationTol()
.public PropertyMode getPenetrationTolMode()
public void setPenetrationTolMode(PropertyMode mode)
public void setRotaryLimitTol(double tol)
tol
- new rotary limit tolerancepublic double getRotaryLimitTol()
getRotaryLimitTol()
.public PropertyMode getRotaryLimitTolMode()
public void setRotaryLimitTolMode(PropertyMode mode)
public Renderer.AxisDrawStyle getDrawFrameD()
public void setDrawFrameD(Renderer.AxisDrawStyle style)
public Renderer.AxisDrawStyle getDrawFrameC()
public void setDrawFrameC(Renderer.AxisDrawStyle style)
public double getAxisLength()
public void setAxisLength(double len)
public void getBilateralForceInA(Wrench wr)
wr
- returns the bilateral constraint wrench acting on Apublic Wrench getBilateralForceInA()
public void getBilateralForceInB(Wrench wr)
null
,
this method computes the wrench acting on world coordinates. Otherwise,
if body B is not a Frame, the wrench is set to zero. The wrench is in
world coordinates.wr
- returns the bilateral constraint wrench acting on B (or world)public Wrench getBilateralForceInB()
null
, this method computes the wrench acting on world
coordinates. Otherwise, if body B is not a Frame, the wrench is set to
zero. The wrench is in world coordinates.public void getBilateralForceInC(Wrench wr)
wr
- returns the bilateral constraint wrench acting on Cpublic Wrench getBilateralForceInC()
public void printConstraintInfo()
public void getUnilateralForceInA(Wrench wr)
wr
- returns the unilateral constraint wrench acting on Apublic Wrench getUnilateralForceInA()
public void getUnilateralForceInB(Wrench wr)
null
,
this method computes the wrench acting on world coordinates. Otherwise,
if body B is not a Frame, the wrench is set to zero. The wrench is in
world coordinates.wr
- returns the unilateral constraint wrench acting on B (or world)public Wrench getUnilateralForceInB()
null
, this method computes the wrench acting on world
coordinates. Otherwise, if body B is not a Frame, the wrench is set to
zero. The wrench is in world coordinates.public void getUnilateralForceInC(Wrench wr)
wr
- returns the unilateral constraint wrench acting on Cpublic Wrench getUnilateralForceInC()
public VectorNi getConstraintFlags()
RigidBodyConstraint.BILATERAL
,
RigidBodyConstraint.LINEAR
,
RigidBodyConstraint.ROTARY
, and
RigidBodyConstraint.CONSTANT
.public double getLinearCompliance()
-1
indicate that
not uniform value exists.-1
if no
uniform value exists.public void setLinearCompliance(double c)
c
is > 0
, then an appropriate
critical damping value is also set for each linear constraint. A value of
c < 0
is ignored and leaves all compliance and damping values
unchanged.c
- uniform linear compliance valuepublic double getRotaryCompliance()
-1
indicate that
not uniform value exists.-1
if no
uniform value exists.public void setRotaryCompliance(double c)
c
is > 0
, then an appropriate
critical damping value is also set for each rotary constraint. A value of
c < 0
is ignored and leaves all compliance and damping values
unchanged.c
- uniform rotary compliance valuepublic PropertyInfoList getAllPropertyInfo()
HasProperties
getAllPropertyInfo
in interface HasProperties
getAllPropertyInfo
in class RenderableComponentBase
public VectorNd getCompliance()
setCompliance(maspack.matrix.VectorNd)
for more information.public void setCompliance(VectorNd compliance)
If the size n of compliance
is less than numConstraints()
, then compliance
will only be set for the first
n constraints.
compliance
- vector containing new compliance settingspublic VectorNd getDamping()
setDamping(maspack.matrix.VectorNd)
for more information.public void setDamping(VectorNd damping)
If the size n of damping
is less than numConstraints()
, then damping
will only be set for the first
n constraints.
damping
- vector containing new damping settingspublic void setEnabled(boolean enabled)
enabled
- if true
, enables this connectorpublic boolean isEnabled()
true
if this connector is enabledpublic boolean getTransformPositionOnly()
true
if geometry transforms are applied only to the
origins of TDW and/or TCD.public void setTransformPositionOnly(boolean posOnly)
posOnly
- if true
, geometry transforms are applied only to
the origins of TDW and/or TCD.public boolean getTransformDGeometryOnly()
true
if geometry transforms are applied only to the D
frame.public void setTransformDGeometryOnly(boolean enable)
enable
- if true
, geometry transforms are applied only to
the D framepublic RigidBodyCoupling getCoupling()
public ConnectableBody getBodyA()
public ConnectableBody getBodyB()
public boolean isConnectedToBodies()
true
if this connector is connected to its bodiespublic void getCurrentTCD(RigidTransform3d TCD)
getCurrentTCW()
and
getCurrentTDW()
. Otherwise, it is determined from the underling
coupling and its joint coordinate settings (if any).TCD
- returns the transform from C to Dpublic int numConstraints()
numBilateralConstraints()
and numUnilateralConstraints()
.public int numBilateralConstraints()
public int numUnilateralConstraints()
public int numEngagedUnilateralConstraints()
public void getBilateralSizes(VectorNi sizes)
sizes
.getBilateralSizes
in interface Constrainer
sizes
- vector to which the block column sizes are appendedpublic int addBilateralConstraints(SparseBlockMatrix GT, VectorNd dg, int numb)
Gc^T
to the
matrix GT
, by appending block columns to it. If the argument
dg
is non-null
, it should be used to return the
velocity constraint time derivative, defined by
\dot Gc velstarting at the location
numb
. In all cases, the method must
return an updated value of numb
, incremented by the total row
size of Gc
.addBilateralConstraints
in interface Constrainer
GT
- matrix to which the bilateral force contraint matrix
is appended.dg
- if non-null
, returns the velocity constraint time
derivativenumb
- starting index for time derivative in dg
numb
public int getBilateralInfo(MechSystem.ConstraintInfo[] ginfo, int idx)
Gc vel = 0.This information is placed in pre-allocated
MechSystem.ConstraintInfo
structures in ginfo
, starting at idx
. The method must
return an updated value of idx
, incremented by the number of
rows of Gc
.
The constraint information to be set in ConstraintInfo
includes:
dist // distance to the constraint surface. compliance // if > 0, gives constraint compliance value damping // damping; only used if compliance > 0 force // used for computing non-linear compliance
getBilateralInfo
in interface Constrainer
ginfo
- returns the constraint informationidx
- starting location in ginfo
for returning constraint
infoidx
public int setBilateralForces(VectorNd lam, double s, int idx)
lam
, starting at the index idx
, and should be
scaled by s
. (In practice, s
is used to convert from
impulses to forces.) The method must return an updated value of idx
, incremented by the number of forces associated with this constraint.setBilateralForces
in interface Constrainer
lam
- supplies the force impulses, which should be scaled by s
s
- scaling factor for the force valuesidx
- starting index of forces in lam
idx
public int getBilateralForces(VectorNd lam, int idx)
Constrainer.setBilateralForces(maspack.matrix.VectorNd, double, int)
. The forces are returned in
lam
, starting at the index idx
. The method must return
an updated value of idx
, incremented by the number of forces
associated with this constraint.getBilateralForces
in interface Constrainer
lam
- returns the forcesidx
- starting index for forces in lam
idx
public void zeroForces()
zeroForces
in interface Constrainer
public void getUnilateralSizes(VectorNi sizes)
sizes
.getUnilateralSizes
in interface Constrainer
sizes
- vector to which the block column sizes are appendedpublic int addUnilateralConstraints(SparseBlockMatrix NT, VectorNd dn, int numu)
Nc^T
to the
matrix NT
, by appending block columns to it. If the argument
dn
is non-null
, it should be used to return the
velocity constraint time derivative, defined by
\dot Nc velstarting at the location
numu
. In all cases, the method must
return an updated value of numu
, incremented by the total row
size of Nc
.addUnilateralConstraints
in interface Constrainer
NT
- matrix to which the unilateral force contraint matrix
is appended.dn
- if non-null
, returns the velocity constraint time
derivativenumu
- starting index for time derivative in dn
numu
public int getUnilateralInfo(MechSystem.ConstraintInfo[] ninfo, int idx)
Nc vel > 0.This information is placed in pre-allocated
MechSystem.ConstraintInfo
structures in ninfo
, starting at idx
. The method must
return an updated value of idx
, incremented by the number of
rows of Nc
.
The constraint information to be set in ConstraintInfo
includes:
dist // distance to the constraint surface. compliance // if > 0, gives constraint compliance value damping // damping; only used if compliance > 0 force // used for computing non-linear compliance
getUnilateralInfo
in interface Constrainer
ninfo
- returns the constraint informationidx
- starting location in ninfo
for returning constraint
infoidx
public int setUnilateralForces(VectorNd the, double s, int idx)
the
, starting at the index idx
, and should be
scaled by s
. (In practice, s
is used to convert from
impulses to forces.) The method must return an updated value of idx
, incremented by the number of forces associated with this constraint.setUnilateralForces
in interface Constrainer
the
- supplies the force impulses, which should be scaled by s
s
- scaling factor for the force valuesidx
- starting index of forces in the
idx
public int getUnilateralForces(VectorNd the, int idx)
Constrainer.setUnilateralForces(maspack.matrix.VectorNd, double, int)
. The forces are returned in
the
, starting at the index idx
. The method must return
an updated value of idx
, incremented by the number of forces
associated with this constraint.getUnilateralForces
in interface Constrainer
the
- returns the forcesidx
- starting index for forces in the
idx
public int setUnilateralState(VectorNi state, int idx)
setUnilateralState
in interface Constrainer
public int getUnilateralState(VectorNi state, int idx)
getUnilateralState
in interface Constrainer
public int maxFrictionConstraintSets()
finfo
argument that is
passed to Constrainer.addFrictionConstraints(maspack.matrix.SparseBlockMatrix, java.util.ArrayList<maspack.spatialmotion.FrictionInfo>, boolean, int)
.maxFrictionConstraintSets
in interface Constrainer
public int addFrictionConstraints(SparseBlockMatrix DT, java.util.ArrayList<FrictionInfo> finfo, boolean prune, int numf)
Dc^T
to the matrix
DT
, by appending block columns to it. Each block column in Dc^T
corresponds to a friction constraint set, for which
information should be supplied in the pre-allocated FrictionInfo
structures in finfo
, starting at idx
. The method must
return an updated value of idx
, incremented by the number of
friction constraint sets.addFrictionConstraints
in interface Constrainer
DT
- matrix to which the friction force contraint matrix
is appended.finfo
- returns friction constraint information for each
block column in Dc^T
prune
- restrict entries of DT to friction constraints
for which the contact force is > 0
.numf
- starting index for friction information in finfo
idx
public int setFrictionForces(VectorNd phi, double s, int idx)
phi
, starting at the index idx
, and should be
scaled by s
. (In practice, s
is used to convert from
impulses to forces.) The method must return an updated value of idx
, incremented by the number of forces associated with this constraint.setFrictionForces
in interface Constrainer
phi
- supplies the force impulses, which should be scaled by s
s
- scaling factor for the force valuesidx
- starting index of forces in phi
idx
public int getFrictionForces(VectorNd phi, int idx)
Constrainer.setFrictionForces(maspack.matrix.VectorNd, double, int)
. The forces are returned in
phi
, starting at the index idx
. The method must return
an updated value of idx
, incremented by the number of forces
associated with this constraint.getFrictionForces
in interface Constrainer
phi
- returns the forcesidx
- starting index for forces in phi
idx
public int setFrictionState(VectorNi state, int idx)
setFrictionState
in interface Constrainer
public int getFrictionState(VectorNi state, int idx)
getFrictionState
in interface Constrainer
public double updateConstraints(double t, int flags)
>
0 associated with all of them. If no constraints are
presently active, returns -1.updateConstraints
in interface Constrainer
public void getConstrainedComponents(java.util.List<DynamicComponent> list)
getConstrainedComponents
in interface Constrainer
list
- list to which constrained components should be appendedpublic void addMasterBlocks(SparseBlockMatrix GT, int bj, Matrix GC, FrameAttachment attachment)
public void computeConstraintMatrixA(Matrix6x1 GC, Wrench wr, double scale)
public void computeConstraintMatrixB(Matrix6x1 GC, Wrench wr, double scale)
public void setBodies(RigidBody bodyA, RigidTransform3d TCA, RigidBody bodyB, RigidTransform3d TDB)
bodyA
and bodyB
, to this
connector. If A and B describe the coordinate frames of bodyA
and
bodyB
, then TCA
and TDB
give the (fixed)
transforms from the joint's C and D frames to A and B, respectively.
Since C and D are specified independently, the joint transform TCD may
not necessarily be initialized to the identity.
bodyB
may be specified as null
, in which case this
connector will attach bodyA
to ground and TDB
gives
the transform from D to world.
bodyA
- first rigid body to attachTCA
- transform from connector frame C to body frame AbodyB
- second rigid body to attach (or null
)TDB
- transform from connector frame D to body frame B (or world)public void setBodies(ConnectableBody bodyA, FrameAttachment attachmentA, ConnectableBody bodyB, FrameAttachment attachmentB)
bodyA
and bodyB
, to this
connector, using explicitly specified Frame
attachments to attach
the connector frames C and D to the coordinate frames A and B of the two
bodies. This method is intended for situations in which applications wish
to implement a body connector using custom Frame
attachments. The
poses of C and D after this method is called depend entirely on the
configuration of the supplied attachments.
bodyB
may be specified as null
, in which case this
connector will attach bodyA
to ground and attachmentB
should attach D to world.
bodyA
- first body to attachattachmentA
- Frame
attachment connecting connector
frame C to body frame AbodyB
- second body to attach (or null
)attachmentB
- Frame
attachment connecting connector
frame D to body frame B (or world)public void setBodies(ConnectableBody bodyA, ConnectableBody bodyB, RigidTransform3d TDW)
bodyA
and bodyB
, to this
connector. The location of joint frame D is given by TDW
, which
gives the transform from D to world coordinates. The location of joint
frame C is then determined from the transform TCD returned by get getCurrentTCD
. If bodies have not get been attached to this connector,
TCD will then be determined by its joint coordinates, if any. Typically,
if the joint coordinates have 0 values, TCD will be the identity and
C and D will be coincident, but this is not necessarily the case.
bodyB
may be specified as null
, in which case this
connector will attach bodyA
to ground.
bodyA
- first body to attachbodyB
- second body to attach (or null
)TDW
- initial transform from connector frame D to worldpublic void setBodies(ConnectableBody bodyA, ConnectableBody bodyB, RigidTransform3d TCW, RigidTransform3d TDW)
bodyA
and bodyB
, to this
connector. The locations of joint frames D and C are given by TCW
and TDW
, which give the transforms from C and D to world
coordinates.
bodyB
may be specified as null
, in which case this
connector will attach bodyA
to ground.
bodyA
- first body to attachTCW
- initial transform from connector frames C to worldbodyB
- second body to attach (or null
)TDW
- initial transform from connector frames D to worldpublic RigidTransform3d getCurrentTDW()
public void getCurrentTDW(RigidTransform3d TDW)
TDW
- returns the current pose of Dpublic void setCurrentTDW(RigidTransform3d TDW)
TDW
- new pose for the D framepublic void getPose(RigidTransform3d TDW)
getCurrentTDW(RigidTransform3d)
.getPose
in interface HasCoordinateFrame
TDW
- returns the connector posepublic RigidTransform3d getCurrentTCW()
public void getCurrentTCW(RigidTransform3d TCW)
TCW
- returns the current pose of Cpublic void setCurrentTCW(RigidTransform3d TCW)
TCW
- new pose for the C framepublic double getConstraintForce(int idx)
idx
-th constraint in this
connector. This is the Lagrange multiplier used to enforce the
constraint.idx
- index of the constraintidx
-th constraint forcepublic double getActivation(int idx)
getConstraintForce(int)
instead.public void scaleMass(double m)
scaleMass
in interface ScalableUnits
m
- scaling factorpublic void scaleDistance(double s)
scaleDistance
in interface ScalableUnits
s
- scaling factorpublic boolean isActive()
public boolean isNotAttached()
public void transformGeometry(AffineTransform3dBase X)
TransformGeometryContext.transform (this, X, 0);
transformGeometry
in interface TransformableGeometry
X
- affine transformation to apply to the componentpublic void transformGeometry(GeometryTransformer gtr, TransformGeometryContext context, int flags)
gtr
to transform its individual attributes. The
context
argument supplies information about what other
components are currently being transformed, and also allows the
requesting of update actions to be performed after all transform called
have completed. The context is also the usual entity that calls
this method, from within its TransformGeometryContext.apply(maspack.geometry.GeometryTransformer, int)
method. The argument flags
provides flags to specify
various conditions associated with the the transformation.
At present, the available flags are TransformableGeometry.TG_SIMULATING
and
TransformableGeometry.TG_ARTICULATED
.
This method is not usually called directly by applications.
Instead, it is typically called from within the
TransformGeometryContext.apply(maspack.geometry.GeometryTransformer, int)
method of the context,
which takes care of the various operations needed for a
complete transform operation, including calling
TransformableGeometry.addTransformableDependencies(artisynth.core.modelbase.TransformGeometryContext, int)
to collect other
components that should be transformed, calling
TransformableGeometry.transformGeometry(maspack.matrix.AffineTransform3dBase)
for each component, notifying
component parents that the geometry has changed, and calling
any requested TransformGeometryAction
s. More details
are given in the documentation for
TransformGeometryContext.apply(maspack.geometry.GeometryTransformer, int)
.
TransformGeometryContext
provides a number of
static convenience transform
methods
which take care of building the context and calling
apply()
for a specified set of components.
This method should not
generally call transformGeometry()
for its descendant
components. Instead, descendants needing transformation should be
specified by adding them to the context in the method TransformableGeometry.addTransformableDependencies(artisynth.core.modelbase.TransformGeometryContext, int)
.
transformGeometry
in interface TransformableGeometry
gtr
- transformer implementing the transformcontext
- context information, including what other components
are being transformedflags
- specifies conditions associated with the transformationpublic void addTransformableDependencies(TransformGeometryContext context, int flags)
context
any transformable components which should be
transformed as the same time as this component. This will generally
include descendant components, and may also include other components to
which this component is connected in some way.
This method is generally called from with the
TransformGeometryContext.apply(maspack.geometry.GeometryTransformer, int)
method of a
TransformGeometryContext
.
addTransformableDependencies
in interface TransformableGeometry
context
- context information, to which the dependent components
are added.flags
- specifies conditions associated with the transformationpublic void getHardReferences(java.util.List<ModelComponent> refs)
getHardReferences
in interface ModelComponent
getHardReferences
in class ModelComponentBase
refs
- list to which hard references are appendedpublic void connectToHierarchy(CompositeComponent hcomp)
When this method is called, ModelComponent.getParent()
will return the new
parent component; the system will have set this beforehand.
connectToHierarchy
in interface ModelComponent
connectToHierarchy
in class ModelComponentBase
hcomp
- hierarchy component to which this component,
or its ancestor, was attachedpublic void disconnectFromHierarchy(CompositeComponent hcomp)
When this method is called, ModelComponent.getParent()
will still return this
original parent component; the system will set this to null
after.
disconnectFromHierarchy
in interface ModelComponent
disconnectFromHierarchy
in class ModelComponentBase
hcomp
- hierarchy component from which this component,
or its ancestor, was detachedpublic boolean isDuplicatable()
public boolean getCopyReferences(java.util.List<ModelComponent> refs, ModelComponent ancestor)
public BodyConnector copy(int flags, java.util.Map<ModelComponent,ModelComponent> copyMap)
copy
in class RenderableComponentBase
public void setAlwaysAdjustBodyA(boolean set)
set
- if true, only adjusts body Apublic void getState(DataBuffer data)
getState
in interface HasNumericState
data
- buffer for storing the state values.public void setState(DataBuffer data)
setState
in interface HasNumericState
data
- buffer containing the state informationpublic int getStateVersion()
getStateVersion
in interface HasNumericState
public boolean hasState()
hasState
in interface HasNumericState
hasState
in interface ModelComponent
hasState
in class ModelComponentBase
true
if this component has statepublic static void printConnectedBodies(ConnectableBody body)
public static boolean findAttachedBodies(ConnectableBody body, ConnectableBody exclude, java.util.List<ConnectableBody> bodies)
body
and expands outward by
recursively examining all bodies attached to all its connectors,
excluding the body specified by exclude
if exclude
is non-null
. body
itself will be included in the search
results (unless exclude
is also set to body
, in which no
bodies will be found). The results of the search are appended to list
.body
- starting body for the searchexclude
- if non-null
, body to be excluded from the searchbodies
- collects the search results.true
if the found bodies are not attached to ground.public FrameAttachment getFrameAttachmentA()
Frame
attachment which attaches connector frame C to the
coordinate frame of body A.public FrameAttachment getFrameAttachmentB()
Frame
attachment which attaches connector frame D to
the coordinate frame of body B (or to world if body B is null
).public RigidBodyConstraint getConstraint(int idx)
public void updateBounds(Vector3d pmin, Vector3d pmax)
IsRenderable
updateBounds
in interface IsRenderable
updateBounds
in class RenderableComponentBase
pmin
- minimum pointpmax
- maximum pointpublic void prerender(RenderList list)
IsRenderable
list.addIfVisible (obj);
for each of the objects in question.prerender
in interface IsRenderable
prerender
in class RenderableComponentBase
list
- list of objects to be renderedpublic void render(Renderer renderer, int flags)
IsRenderable
Renderer
.render
in interface IsRenderable
render
in class RenderableComponentBase
renderer
- provides the functionality used to perform the rendering.flags
- flags that may be used to control different
aspects of the rendering. Flags are defined in Renderer
and currently include
Renderer.HIGHLIGHT
and
Renderer.SORT_FACES
.public RigidTransform3d getRenderFrame()
public void updateAttachments()