public abstract class BodyConnector extends RenderableComponentBase implements ScalableUnits, TransformableGeometry, BodyConstrainer, Constrainer, HasCoordinateFrame
HasAuxState.StateContext
ModelComponent.NavpanelVisibility
Modifier and Type | Field and Description |
---|---|
static PropertyList |
myProps |
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 |
advanceAuxState(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()
Called by the system after this component is added to the
component hierarchy (i.e., when it is added as a child of another
CompositeComponent).
|
ModelComponent |
copy(int flags,
java.util.Map<ModelComponent,ModelComponent> copyMap) |
void |
disconnectFromHierarchy()
Called by the system after this component is removed from the component
hierarchy (i.e., when it is 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.
|
void |
getAuxState(DataBuffer data)
Saves state information for this component by adding data to the
supplied DataBuffer.
|
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 |
getBilateralImpulses(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() |
void |
getHardReferences(java.util.List<ModelComponent> refs)
Appends all hard references for this component to a list.
|
void |
getInitialAuxState(DataBuffer newData,
DataBuffer oldData)
Saves initial state information data for this component by adding data
to the supplied data buffer.
|
double |
getLinearCompliance() |
ConnectableBody |
getOtherBody(ConnectableBody body) |
double |
getPenetrationTol() |
PropertyMode |
getPenetrationTolMode() |
void |
getPose(RigidTransform3d X) |
double |
getRotaryCompliance() |
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 |
getUnilateralImpulses(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 |
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 |
setAuxState(DataBuffer data)
Restores the state for this component by reading from the supplied
data buffer, starting at the current buffer offsets.
|
int |
setBilateralImpulses(VectorNd lam,
double h,
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) |
int |
setUnilateralImpulses(VectorNd the,
double h,
int idx) |
void |
skipAuxState(DataBuffer data)
Skips over the state information for this component contained
in the supplied data buffer, starting at the current buffer offsets.
|
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) |
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 |
zeroImpulses() |
createRenderProps, getRenderHints, getRenderProps, getSelection, isSelectable, numSelectionQueriesNeeded, prerender, render, setRenderProps, updateRenderProps
checkFlag, checkName, checkNameUniqueness, clearFlag, clone, createTempFlag, getChildren, getGrandParent, getName, getNameRange, getNavpanelVisibility, getNavpanelVisibility, getNumber, getParent, getProperty, getSoftReferences, hasChildren, isConnectedToHierarchy, isFixed, isMarked, isSelected, isWritable, makeValidName, makeValidName, notifyParentOfChange, postscan, printReferences, recursivelyContained, recursivelyContains, removeTempFlag, scan, setFixed, setFlag, setMarked, setName, setNavpanelVisibility, setNavpanelVisibility, setNumber, setParent, setSelected, updateReferences, write
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getName, getNavpanelVisibility, getNumber, getParent, getSoftReferences, isFixed, isMarked, isSelected, notifyParentOfChange, postscan, scan, setFixed, setMarked, setName, setNumber, setParent, setSelected, updateReferences
getProperty
getChildren, hasChildren
isWritable, write
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 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)
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 setBilateralImpulses(VectorNd lam, double h, int idx)
setBilateralImpulses
in interface BodyConstrainer
setBilateralImpulses
in interface Constrainer
public int getBilateralImpulses(VectorNd lam, int idx)
getBilateralImpulses
in interface BodyConstrainer
getBilateralImpulses
in interface Constrainer
public void zeroImpulses()
zeroImpulses
in interface BodyConstrainer
zeroImpulses
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 setUnilateralImpulses(VectorNd the, double h, int idx)
setUnilateralImpulses
in interface BodyConstrainer
setUnilateralImpulses
in interface Constrainer
public int getUnilateralImpulses(VectorNd the, int idx)
getUnilateralImpulses
in interface BodyConstrainer
getUnilateralImpulses
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()
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
public void disconnectFromHierarchy()
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
public 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 advanceAuxState(double t0, double t1)
HasAuxState
advanceAuxState
in interface HasAuxState
t0
- beginning time associated with the time step advancet1
- end time associated with the time step advancepublic void skipAuxState(DataBuffer data)
skipAuxState
in interface HasAuxState
data
- buffer containing the state informationpublic void getAuxState(DataBuffer data)
HasAuxState
getAuxState
in interface HasAuxState
data
- buffer for storing the state values.public void setAuxState(DataBuffer data)
HasAuxState
setAuxState
in interface HasAuxState
data
- buffer containing the state informationpublic void getInitialAuxState(DataBuffer newData, DataBuffer oldData)
HasAuxState
If oldData
is non-null, then this contains
previously stored initial state information (starting at its current
buffer offsets), which should be stored into
newData
in place of the current component state data.
This may only be partially possible if the component's state structure
has changed since oldData
was written.
getInitialAuxState
in interface HasAuxState
newData
- buffer for storing the state values.oldData
- if non-null, contains old state information that should be
written into newData
in place of the current state
information.public boolean hasState()
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)