public abstract class BodyConnector extends RenderableComponentBase implements ScalableUnits, TransformableGeometry, BodyConstrainer, Constrainer, HasCoordinateFrame
ModelComponent.NavpanelVisibility
Modifier and Type | Field and Description |
---|---|
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) |
int |
addFrictionConstraints(SparseBlockMatrix DT,
MechSystem.FrictionInfo[] finfo,
int numf) |
void |
addMasterBlocks(SparseBlockMatrix GT,
int bj,
MatrixNdBlock 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) |
void |
advanceState(double t0,
double t1)
Called at the very beginning of the time step (in the system's
preadvance() method) to perform any required updating of the component's
state before the application in input probes or controllers.
|
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).
|
ModelComponent |
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) |
double |
getActivation(int idx)
Returns the activation level associated with a specific constraint.
|
PropertyList |
getAllPropertyInfo()
Returns a list giving static information about all properties exported by
this object.
|
int |
getBilateralConstraints(java.util.ArrayList<RigidBodyConstraint> bilaterals)
Gets the bilateral constraints associated with this constrainer.
|
Wrench |
getBilateralForceInA()
If body A is a Frame, computes 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.
|
int |
getBilateralForces(VectorNd lam,
int idx) |
int |
getBilateralInfo(MechSystem.ConstraintInfo[] ginfo,
int idx) |
void |
getBilateralSizes(VectorNi sizes) |
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.
|
double |
getBreakAccel() |
double |
getBreakSpeed() |
VectorNd |
getCompliance() |
void |
getConstrainedComponents(java.util.List<DynamicComponent> list) |
double |
getContactDistance() |
boolean |
getCopyReferences(java.util.List<ModelComponent> refs,
ModelComponent ancestor) |
RigidTransform3d |
getCurrentTCW() |
void |
getCurrentTCW(RigidTransform3d TCW) |
RigidTransform3d |
getCurrentTDW() |
void |
getCurrentTDW(RigidTransform3d TDW) |
RigidTransform3d |
getCurrentTXW(FrameAttachable body) |
VectorNd |
getDamping() |
FrameAttachment |
getFrameAttachmentA() |
FrameAttachment |
getFrameAttachmentB() |
void |
getHardReferences(java.util.List<ModelComponent> refs)
Appends all hard references for this component to a list.
|
double |
getLinearCompliance() |
ConnectableBody |
getOtherBody(ConnectableBody body) |
double |
getPenetrationTol() |
PropertyMode |
getPenetrationTolMode() |
void |
getPose(RigidTransform3d X) |
double |
getRotaryCompliance() |
void |
getState(DataBuffer data)
Saves state information for this component by adding data to the
supplied DataBuffer.
|
double |
getUnilateralConstraints(java.util.ArrayList<RigidBodyConstraint> unilaterals,
boolean setEngaged)
Gets the unilateral constraints associated with this constrainer.
|
Wrench |
getUnilateralForceInA()
If body A is a Frame, computes 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.
|
int |
getUnilateralForces(VectorNd the,
int idx) |
int |
getUnilateralInfo(MechSystem.ConstraintInfo[] ninfo,
int idx) |
void |
getUnilateralSizes(VectorNi sizes) |
boolean |
hasState()
Queries if this component has state.
|
boolean |
hasTranslation() |
boolean |
hasUnilateralConstraints()
Returns true if this constrainer has unilateral constraints.
|
boolean |
isActive()
Returns true if this RigidBodyConnectorX 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() |
int |
maxFrictionConstraintSets() |
int |
numBilateralConstraints()
Returns the number of bilateral constraints associated with this
constrainer.
|
int |
numBodies() |
int |
numUnilateralConstraints()
Returns the number of unilateral constraints which are currently
engaged.
|
void |
printConstraintInfo()
For debugging only
|
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.
|
int |
setBilateralForces(VectorNd lam,
double s,
int idx) |
void |
setBodies(ConnectableBody bodyA,
ConnectableBody bodyB,
RigidTransform3d TDW) |
void |
setBodies(ConnectableBody bodyA,
ConnectableBody bodyB,
RigidTransform3d TCW,
RigidTransform3d TDW) |
void |
setBodies(ConnectableBody bodyA,
FrameAttachment attachmentA,
ConnectableBody bodyB,
FrameAttachment attachmentB) |
void |
setBodies(RigidBody bodyA,
RigidTransform3d TCA,
RigidBody bodyB,
RigidTransform3d TDB) |
void |
setBreakAccel(double a) |
void |
setBreakSpeed(double s) |
void |
setCompliance(VectorNd compliance) |
void |
setContactDistance(double d) |
void |
setCurrentTCW(RigidTransform3d TCW) |
void |
setCurrentTDW(RigidTransform3d TDW) |
void |
setDamping(VectorNd damping) |
void |
setEnabled(boolean enabled) |
void |
setLinearCompliance(double c) |
void |
setPenetrationTol(double tol)
Sets the penetration tolerance for this component.
|
void |
setPenetrationTolMode(PropertyMode mode) |
void |
setRotaryCompliance(double c) |
void |
setState(DataBuffer data)
Restores the state for this component by reading from the supplied
data buffer, starting at the current buffer offsets.
|
int |
setUnilateralForces(VectorNd the,
double s,
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 |
updateBodyStates(double t,
boolean setEngaged)
Updates internal information needed for computing constraints.
|
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 |
updateForBodyPositionChange(ConnectableBody body,
RigidTransform3d TXW) |
void |
updateUnilateralConstraints(java.util.ArrayList<RigidBodyConstraint> unilaterals,
int offset,
int numc)
Updates the unilateral constraints associated with this constrainer.
|
void |
zeroForces() |
createRenderProps, getRenderHints, getRenderProps, getSelection, isSelectable, isVisible, numSelectionQueriesNeeded, prerender, render, 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, updateReferences, write
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getStateVersion
getName, getNavpanelVisibility, getNumber, getParent, getSoftReferences, isFixed, isMarked, isSelected, notifyParentOfChange, scan, setFixed, setMarked, setName, setNumber, setParent, setSelected, updateReferences
getProperty
getChildren, hasChildren
postscan
isWritable, write
public static boolean useOldDerivativeMethod
public static PropertyList myProps
public boolean hasTranslation()
public void setPenetrationTol(double tol)
setPenetrationTol
in interface BodyConstrainer
tol
- new penetration tolerancepublic double getPenetrationTol()
getPenetrationTol
in interface BodyConstrainer
public PropertyMode getPenetrationTolMode()
public void setPenetrationTolMode(PropertyMode mode)
public void getBilateralForceInA(Wrench wr)
wr
- returns the bilateral constraint wrench acting on A,
in the coordinates of Apublic void printConstraintInfo()
public Wrench getBilateralForceInA()
public void getUnilateralForceInA(Wrench wr)
wr
- returns the unilateral constraint wrench acting on A,
in the coordinates of Apublic Wrench getUnilateralForceInA()
public double getLinearCompliance()
public void setLinearCompliance(double c)
public double getRotaryCompliance()
public void setRotaryCompliance(double c)
public PropertyList getAllPropertyInfo()
HasProperties
getAllPropertyInfo
in interface HasProperties
getAllPropertyInfo
in class ModelComponentBase
public VectorNd getCompliance()
public void setCompliance(VectorNd compliance)
public VectorNd getDamping()
public void setDamping(VectorNd damping)
public void setEnabled(boolean enabled)
public boolean isEnabled()
public int numBodies()
public ConnectableBody getBodyA()
BodyConstrainer
getBodyA
in interface BodyConstrainer
public ConnectableBody getBodyB()
BodyConstrainer
getBodyB
in interface BodyConstrainer
public ConnectableBody getOtherBody(ConnectableBody body)
public boolean isConnectedToBodies()
true
if this connector is connected to its bodiespublic int numBilateralConstraints()
BodyConstrainer
numBilateralConstraints
in interface BodyConstrainer
public int numUnilateralConstraints()
BodyConstrainer
getUnilateralConstraints
with
setEngaged
set to false
.numUnilateralConstraints
in interface BodyConstrainer
public void getBilateralSizes(VectorNi sizes)
getBilateralSizes
in interface BodyConstrainer
getBilateralSizes
in interface Constrainer
public void getUnilateralSizes(VectorNi sizes)
getUnilateralSizes
in interface BodyConstrainer
getUnilateralSizes
in interface Constrainer
public double updateConstraints(double t, int flags)
Constrainer
>
0 associated with all of them. If no constraints are
presently active, returns -1.updateConstraints
in interface BodyConstrainer
updateConstraints
in interface Constrainer
public void getConstrainedComponents(java.util.List<DynamicComponent> list)
getConstrainedComponents
in interface Constrainer
public void addMasterBlocks(SparseBlockMatrix GT, int bj, MatrixNdBlock GC, FrameAttachment attachment)
public int addBilateralConstraints(SparseBlockMatrix GT, VectorNd dg, int numb)
addBilateralConstraints
in interface Constrainer
public int addUnilateralConstraints(SparseBlockMatrix NT, VectorNd dn, int numu)
addUnilateralConstraints
in interface Constrainer
public int getBilateralInfo(MechSystem.ConstraintInfo[] ginfo, int idx)
getBilateralInfo
in interface Constrainer
public int getUnilateralInfo(MechSystem.ConstraintInfo[] ninfo, int idx)
getUnilateralInfo
in interface Constrainer
public int maxFrictionConstraintSets()
maxFrictionConstraintSets
in interface Constrainer
public int addFrictionConstraints(SparseBlockMatrix DT, MechSystem.FrictionInfo[] finfo, int numf)
addFrictionConstraints
in interface Constrainer
public void setBodies(RigidBody bodyA, RigidTransform3d TCA, RigidBody bodyB, RigidTransform3d TDB)
public void setBodies(ConnectableBody bodyA, FrameAttachment attachmentA, ConnectableBody bodyB, FrameAttachment attachmentB)
public void setBodies(ConnectableBody bodyA, ConnectableBody bodyB, RigidTransform3d TDW)
public void setBodies(ConnectableBody bodyA, ConnectableBody bodyB, RigidTransform3d TCW, RigidTransform3d TDW)
public RigidTransform3d getCurrentTDW()
public void getCurrentTDW(RigidTransform3d TDW)
public void setCurrentTDW(RigidTransform3d TDW)
public void getPose(RigidTransform3d X)
getPose
in interface HasCoordinateFrame
public RigidTransform3d getCurrentTCW()
public void getCurrentTCW(RigidTransform3d TCW)
public void setCurrentTCW(RigidTransform3d TCW)
public RigidTransform3d getCurrentTXW(FrameAttachable body)
public double getActivation(int idx)
idx
- index of the constraintpublic void updateBodyStates(double t, boolean setEngaged)
BodyConstrainer
updateBodyStates
in interface BodyConstrainer
t
- current time (seconds)setEngaged
- if true
, then the method should determine
which unilateral constraints are engagedpublic void scaleMass(double m)
scaleMass
in interface ScalableUnits
m
- scaling factorpublic void scaleDistance(double s)
ScalableUnits
scaleDistance
in interface ScalableUnits
s
- scaling factorpublic int getBilateralConstraints(java.util.ArrayList<RigidBodyConstraint> bilaterals)
BodyConstrainer
getBilateralConstraints
in interface BodyConstrainer
bilaterals
- array list into which the constrainer places the constraintspublic int setBilateralForces(VectorNd lam, double s, int idx)
setBilateralForces
in interface BodyConstrainer
setBilateralForces
in interface Constrainer
public int getBilateralForces(VectorNd lam, int idx)
getBilateralForces
in interface BodyConstrainer
getBilateralForces
in interface Constrainer
public void zeroForces()
zeroForces
in interface BodyConstrainer
zeroForces
in interface Constrainer
public boolean hasUnilateralConstraints()
BodyConstrainer
hasUnilateralConstraints
in interface BodyConstrainer
public void setContactDistance(double d)
public double getContactDistance()
public void setBreakSpeed(double s)
public double getBreakSpeed()
public void setBreakAccel(double a)
public double getBreakAccel()
public double getUnilateralConstraints(java.util.ArrayList<RigidBodyConstraint> unilaterals, boolean setEngaged)
BodyConstrainer
getUnilateralConstraints
in interface BodyConstrainer
unilaterals
- array list into which the constrainer places the constraintssetEngaged
- if true, recompute the set of unilateral constraints.
If false, the set of unilateral constraints will stay the same.public void updateUnilateralConstraints(java.util.ArrayList<RigidBodyConstraint> unilaterals, int offset, int numc)
BodyConstrainer
getUnilateralConstraints
, located at a specific offset within an array
list.updateUnilateralConstraints
in interface BodyConstrainer
unilaterals
- contains constraints which should be updatedoffset
- starting location of constraints within unilaterals
numc
- number of constraints to updatepublic int setUnilateralForces(VectorNd the, double s, int idx)
setUnilateralForces
in interface BodyConstrainer
setUnilateralForces
in interface Constrainer
public int getUnilateralForces(VectorNd the, int idx)
getUnilateralForces
in interface BodyConstrainer
getUnilateralForces
in interface Constrainer
public boolean isActive()
public void transformGeometry(AffineTransform3dBase X)
TransformableGeometry
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)
TransformableGeometry
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)
TransformableGeometry
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)
ModelComponentBase
getHardReferences
in interface ModelComponent
getHardReferences
in class ModelComponentBase
refs
- list to which hard references are appendedpublic void connectToHierarchy(CompositeComponent hcomp)
ModelComponentBase
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)
ModelComponentBase
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 ModelComponent copy(int flags, java.util.Map<ModelComponent,ModelComponent> copyMap)
copy
in class RenderableComponentBase
public void updateBounds(Vector3d pmin, Vector3d pmax)
IsRenderable
updateBounds
in interface IsRenderable
updateBounds
in class RenderableComponentBase
pmin
- minimum pointpmax
- maximum pointpublic void updateForBodyPositionChange(ConnectableBody body, RigidTransform3d TXW)
public void setAlwaysAdjustBodyA(boolean set)
set
- if true, only adjusts body Apublic void advanceState(double t0, double t1)
HasNumericState
advanceState
in interface HasNumericState
t0
- beginning time associated with the time step advancet1
- end time associated with the time step advancepublic void getState(DataBuffer data)
HasNumericState
getState
in interface HasNumericState
data
- buffer for storing the state values.public void setState(DataBuffer data)
HasNumericState
setState
in interface HasNumericState
data
- buffer containing the state informationpublic boolean hasState()
hasState
in interface HasNumericState
hasState
in interface ModelComponent
hasState
in class ModelComponentBase
true
if this component has statepublic static boolean findAttachedBodies(ConnectableBody body, ConnectableBody exclude, java.util.List<ConnectableBody> bodies)
public FrameAttachment getFrameAttachmentA()
public FrameAttachment getFrameAttachmentB()