public class Frame extends DynamicComponentBase implements TransformableGeometry, ScalableUnits, DynamicComponent, Traceable, MotionTargetComponent, CopyableComponent, HasCoordinateFrame, CollidableDynamicComponent, PointAttachable, FrameAttachable, ContactMaster
Modifier and Type | Field and Description |
---|---|
static boolean |
dynamicVelInWorldCoords |
static PropertyList |
myProps |
RigidTransform3d |
myRenderFrame |
enforceUniqueCompositeNames, enforceUniqueNames, myNumber, NULL_OBJ, useCompactPathNames
COPY_REFERENCES, REST_POSITION
TG_ARTICULATED, TG_DRAGGER, TG_PRESERVE_ORIENTATION, TG_SIMULATING
TRANSPARENT, TWO_DIMENSIONAL
Constructor and Description |
---|
Frame() |
Frame(RigidTransform3d X) |
Modifier and Type | Method and Description |
---|---|
void |
add1DConstraintBlocks(SparseBlockMatrix GT,
int bj,
double scale,
ContactPoint cpnt,
Vector3d dir)
Adds blocks to the constraint matrix GT to implement a 1D constraint in a
specified direction.
|
void |
add2DConstraintBlocks(SparseBlockMatrix GT,
int bj,
double scale,
ContactPoint cpnt,
Vector3d dir0,
Vector3d dir1)
Adds blocks to the constraint matrix GT to implement a 2D constraint in
two specified directions.
|
void |
addEffectiveFrameMass(SpatialInertia M,
RigidTransform3d TFL0)
Adds a frame inertia to the effective spatial inertia for this Frame.
|
void |
addEffectivePointMass(double m,
Vector3d loc)
Adds a point mass to the effective spatial inertia for this Frame.
|
void |
addExternalForce(Wrench w) |
int |
addForce(double[] f,
int idx) |
void |
addForce(Wrench w) |
void |
addFrameForce(RigidTransform3d TFL,
Wrench wr)
Adds to this body's forces the wrench arising from applying a wrench
f on an attached frame. |
void |
addPointForce(Point3d loc,
Vector3d f)
Adds to this body's forces the wrench arising from applying a force
f on an attached point. |
void |
addPointForce(Wrench wr,
Point3d loc,
Vector3d f)
Adds to
wr the wrench arising from applying a force
f on a point loc . |
void |
addPosImpulse(double[] xbuf,
int xidx,
double h,
double[] vbuf,
int vidx) |
void |
addPosJacobian(SparseNumberedBlockMatrix S,
double s)
Scales the components of the position Jacobian associated with this force
effector and adds it to the supplied solve matrix M.
|
void |
addRelativeVelocity(Vector3d vel,
double scale,
ContactPoint cpnt)
Accumulate the velocity at the contact due to the current
velocity of the underlying dynamic components.
|
void |
addScaledExternalForce(double s,
Wrench w) |
void |
addSolveBlock(SparseNumberedBlockMatrix S) |
void |
addSolveBlocks(SparseNumberedBlockMatrix S)
Adds any needed blocks to a solve matrix in order to accomodate the
Jacobian terms associated with this force effector.
|
int |
addTargetJacobian(SparseBlockMatrix J,
int bi)
Add a row to the motion target Jacobian for this motion target.
|
void |
addToPointVelocity(Vector3d vel,
double w,
ContactPoint cpnt)
Computes the velocity imparted to a contact point by this component's
current velocity, multiples it by a weighting factor
w ,
and add it to vel . |
void |
addTransformableDependencies(TransformGeometryContext context,
int flags)
Adds to
context any transformable components which should be
transformed as the same time as this component. |
void |
addVelJacobian(SparseNumberedBlockMatrix S,
double s)
Scales the components of the velocity Jacobian associated with this force
effector and adds it to the supplied solve matrix M.
|
void |
applyExternalForces() |
void |
applyForces(double t)
Adds forces to the components affected by this force effector at a
particular time.
|
void |
applyGravity(Vector3d gacc)
Applies a gravity force to this component, given a prescribed
gravity acceleration vector.
|
int |
collectMasterComponents(java.util.HashSet<DynamicComponent> masters,
boolean activeOnly)
Collects all the underlying dynamic ``master'' components.
|
void |
computeAppliedWrench(Wrench wr,
Vector3d f,
Vector3d p)
Deprecated.
|
void |
computeForceOnMasters(VectorNd uvec,
Vector3d fc,
double scale,
ContactPoint cpnt,
SparseBlockMatrix S)
XXX Experimental XXX
Compute the forces on the masters resulting from a force
fc applied at the contact point, and accumulate them in uvec,
whose size should equal that of the system forces.
|
void |
computeFrameLocation(RigidTransform3d TFL,
RigidTransform3d TFW) |
void |
computeFramePosition(RigidTransform3d TFW,
RigidTransform3d TFL) |
void |
computeFramePosVel(RigidTransform3d TFW,
Twist vel,
MatrixBlock J,
Twist dv,
RigidTransform3d TFL) |
void |
computeFrameVelocity(Twist vel,
RigidTransform3d TFL) |
void |
computePointCoriolis(Vector3d cor,
Vector3d loc)
Computes the velocity derivative of a point attached to this frame
that is due to the current velocity of the frame.
|
void |
computePointLocation(Vector3d loc,
Vector3d pos)
Computes the location, in body coordinates, of a point whose position
is given in world coordinates.
|
void |
computePointPosition(Vector3d pos,
Point3d loc)
Computes the position, in world coordinates, of a point attached to this
frame.
|
void |
computePointPosVel(Point3d pos,
Vector3d vel,
MatrixBlock J,
Vector3d dv,
Point3d loc) |
void |
computePointVelocity(Vector3d vel,
Vector3d loc)
Computes the velocity, in world coordinates, of a point attached to this
frame.
|
Frame |
copy(int flags,
java.util.Map<ModelComponent,ModelComponent> copyMap)
Create a copy of this component.
|
FrameFrameAttachment |
createFrameAttachment(Frame frame,
RigidTransform3d TFW)
Returns a FrameAttachment that attaches a
frame to this
component. |
MatrixBlock |
createMassBlock()
Create a matrix block for representing the mass of this component,
initialized to the component's effective mass (instrinsic mass
plus the mass due to all attachmented components).
|
PointFrameAttachment |
createPointAttachment(Point pnt)
Returns a PointAttachment that attaches
pnt
to this component. |
RenderProps |
createRenderProps()
Factory method to create render properties appropriate to this object.
|
PropertyList |
getAllPropertyInfo()
Returns a list giving static information about all properties exported by
this object.
|
Renderer.AxisDrawStyle |
getAxisDrawStyle() |
double |
getAxisLength() |
void |
getBodyForce(Wrench wr) |
void |
getBodyVelocity(Twist v) |
int |
getBodyVelState(double[] buf,
int idx) |
boolean |
getCopyReferences(java.util.List<ModelComponent> refs,
ModelComponent ancestor)
Collects external references which must also be copied in order to
duplicate this component.
|
double |
getEffectiveMass()
Gets the effective scalar mass of this component.
|
void |
getEffectiveMass(Matrix M,
double t)
Gets the effective mass of this component at a particular time.
|
int |
getEffectiveMassForces(VectorNd f,
double t,
int idx)
Gets the mass forces for this component at a particular time.
|
Wrench |
getExternalForce() |
Wrench |
getForce() |
int |
getForce(double[] f,
int idx) |
void |
getForce(Wrench wr) |
double |
getFrameDamping() |
PropertyMode |
getFrameDampingMode() |
int |
getJacobianType()
Returns a code indicating the matrix type that results when the Jacobian
terms of this force effector are added to the solve matrix.
|
double |
getMass(double t)
Returns the scalar mass of this component at time t.
|
void |
getMass(Matrix M,
double t)
Gets the mass of this component at a particular time.
|
Vector3d |
getMoment() |
AxisAngle |
getOrientation() |
void |
getOrientation(AxisAngle axisAng) |
int |
getPosDerivative(double[] dxdt,
int idx) |
RigidTransform3d |
getPose() |
void |
getPose(RigidTransform3d XFrameToWorld) |
Point3d |
getPosition() |
int |
getPosState(double[] buf,
int idx) |
int |
getPosStateSize() |
RigidTransform3d |
getRenderFrame()
Returns the cached copy of this frame's pose that should be
used for rendering.
|
double |
getRotaryDamping() |
PropertyMode |
getRotaryDampingMode() |
Quaternion |
getRotation() |
void |
getSelection(java.util.LinkedList<java.lang.Object> list,
int qid)
Append to
list the component (or components) associated with
the qid -th selection query issued by this component's render
method. |
void |
getState(DataBuffer data)
Saves state information for this component by adding data to the
supplied DataBuffer.
|
MotionTarget.TargetActivity |
getTargetActivity() |
AxisAngle |
getTargetOrientation() |
int |
getTargetPos(double[] post,
double s,
double h,
int idx) |
RigidTransform3d |
getTargetPose() |
Point3d |
getTargetPosition() |
int |
getTargetVel(double[] velt,
double s,
double h,
int idx) |
Twist |
getTargetVelocity() |
java.lang.String |
getTraceablePositionProperty(java.lang.String traceableName)
For a given traceable property, returns the name of a property (if any)
which provides a reference position to be used for the traceable property.
|
java.lang.String[] |
getTraceables()
Returns a list of all traceable properties in this Traceable.
|
Vector3d |
getTransForce() |
Twist |
getVelocity() |
void |
getVelocity(Twist v) |
int |
getVelState(double[] buf,
int idx) |
int |
getVelStateSize() |
int |
getWorldVelState(double[] buf,
int idx) |
boolean |
hasForce()
Queries whether or not this component actually exerts its own
state-dependent forces (typically associated with damping).
|
boolean |
isDuplicatable()
Returns true if this component can be duplicated.
|
boolean |
isMassConstant() |
int |
mulInverseEffectiveMass(Matrix M,
double[] a,
double[] f,
int idx) |
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).
|
void |
render(Renderer renderer,
int flags)
Render this object using the functionality of the supplied
Renderer . |
void |
resetEffectiveMass()
Resets the effective mass of this component to the nominal mass.
|
void |
resetTargets() |
void |
scaleDistance(double s)
Scales all distance coordinates.
|
void |
scaleMass(double s)
Scales all mass units.
|
void |
setAxisDrawStyle(Renderer.AxisDrawStyle style) |
void |
setAxisLength(double len) |
void |
setBodyVelocity(Twist v) |
void |
setContactConstraint(double[] buf,
double w,
Vector3d dir,
ContactPoint cpnt)
Computes the values for the block matrix which defines this component's
contribution to a contact constraint matrix.
|
void |
setExternalForce(Wrench w) |
int |
setForce(double[] f,
int idx) |
void |
setForce(Wrench w) |
void |
setFrameDamping(double d) |
void |
setFrameDampingMode(PropertyMode mode) |
void |
setOrientation(AxisAngle axisAng) |
void |
setPose(RigidTransform3d XFrameToWorld) |
void |
setPosition(Point3d pos) |
int |
setPosState(double[] buf,
int idx) |
void |
setRandomForce()
Sets the force of this component to a random value.
|
void |
setRandomPosState()
Sets the position state of this component to a random value.
|
void |
setRandomVelState()
Sets the velocity state of this component to a random value.
|
void |
setRotaryDamping(double d) |
void |
setRotaryDampingMode(PropertyMode mode) |
void |
setRotation(Quaternion q) |
void |
setState(DataBuffer data)
Restores the state for this component by reading from the supplied
data buffer, starting at the current buffer offsets.
|
void |
setState(Frame frame) |
void |
setTargetActivity(MotionTarget.TargetActivity activity) |
void |
setTargetOrientation(AxisAngle axisAng) |
int |
setTargetPos(double[] post,
int idx) |
void |
setTargetPose(RigidTransform3d X) |
void |
setTargetPosition(Point3d pos) |
int |
setTargetVel(double[] velt,
int idx) |
void |
setTargetVelocity(Twist vel) |
void |
setVelocity(double vx,
double vy,
double vz,
double wx,
double wy,
double wz) |
void |
setVelocity(Twist v) |
int |
setVelState(double[] buf,
int idx) |
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 |
transformPose(RigidTransform3d T) |
void |
updateAttachmentPosStates()
Update the state of any dynamic components which are attached to
this frame.
|
void |
updateBounds(Vector3d pmin,
Vector3d pmax)
Update the minimum and maximum points for this object.
|
boolean |
velocityLimitExceeded(double tlimit,
double rlimit)
Checks if the current component velocity exceeds specified limits.
|
void |
zeroExternalForces() |
void |
zeroForces() |
addAttachmentRequest, addConstrainer, addMasterAttachment, connectToHierarchy, disconnectFromHierarchy, getAttachment, getConstrainers, getInverseMass, getMasterAttachments, getSolveIndex, hasState, isActive, isAttached, isControllable, isDynamic, isParametric, removeAttachmentRequest, removeConstrainer, removeMasterAttachment, setAttached, setSolveIndex, transformGeometry
defaultRenderPropsAreNull, getRenderHints, getRenderProps, isSelectable, isVisible, numSelectionQueriesNeeded, setRenderProps, setVisible, updateRenderProps
checkFlag, checkName, checkNameUniqueness, clearFlag, clone, createTempFlag, getChildren, getGrandParent, getHardReferences, 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
addAttachmentRequest, removeAttachmentRequest
addConstrainer, addMasterAttachment, getAttachment, getConstrainers, getInverseMass, getMasterAttachments, getSolveIndex, isActive, isAttached, isControllable, isDynamic, isParametric, removeConstrainer, removeMasterAttachment, setAttached, setSolveIndex
advanceState, getAuxVarDerivative, getAuxVarState, getStateVersion, hasState, numAuxVars, requiresAdvance, setAuxVarState
transformGeometry, transformPriority
isControllable
public static boolean dynamicVelInWorldCoords
public RigidTransform3d myRenderFrame
public static PropertyList myProps
public Frame()
public Frame(RigidTransform3d X)
public PropertyList getAllPropertyInfo()
HasProperties
getAllPropertyInfo
in interface HasProperties
getAllPropertyInfo
in class RenderableComponentBase
public Wrench getForce()
public void getForce(Wrench wr)
public void getBodyForce(Wrench wr)
public Vector3d getTransForce()
public Vector3d getMoment()
public void setForce(Wrench w)
public void addForce(Wrench w)
public Wrench getExternalForce()
public void setExternalForce(Wrench w)
public void addExternalForce(Wrench w)
public void addScaledExternalForce(double s, Wrench w)
public Twist getVelocity()
public void getVelocity(Twist v)
public void setVelocity(Twist v)
public void setVelocity(double vx, double vy, double vz, double wx, double wy, double wz)
public void setPose(RigidTransform3d XFrameToWorld)
public void transformPose(RigidTransform3d T)
public RigidTransform3d getPose()
public void getPose(RigidTransform3d XFrameToWorld)
getPose
in interface HasCoordinateFrame
public Point3d getPosition()
public void setPosition(Point3d pos)
public AxisAngle getOrientation()
public void getOrientation(AxisAngle axisAng)
public void setOrientation(AxisAngle axisAng)
public Quaternion getRotation()
public void setRotation(Quaternion q)
public void applyGravity(Vector3d gacc)
applyGravity
in interface DynamicAgent
public double getAxisLength()
public void setAxisLength(double len)
public Renderer.AxisDrawStyle getAxisDrawStyle()
public void setAxisDrawStyle(Renderer.AxisDrawStyle style)
public void computePointPosition(Vector3d pos, Point3d loc)
pos
- returns the point positionloc
- position of the point, in body coordinatespublic void computePointLocation(Vector3d loc, Vector3d pos)
computePointPosition(maspack.matrix.Vector3d, maspack.matrix.Point3d)
.loc
- returns the point locationpos
- position of the point, in world coordinatespublic void computePointVelocity(Vector3d vel, Vector3d loc)
vel
- returns the point velocityloc
- position of the point, in body coordinatespublic void computePointPosVel(Point3d pos, Vector3d vel, MatrixBlock J, Vector3d dv, Point3d loc)
public void computeFramePosition(RigidTransform3d TFW, RigidTransform3d TFL)
public void computeFrameLocation(RigidTransform3d TFL, RigidTransform3d TFW)
public void computeFrameVelocity(Twist vel, RigidTransform3d TFL)
public void computeFramePosVel(RigidTransform3d TFW, Twist vel, MatrixBlock J, Twist dv, RigidTransform3d TFL)
public void computePointCoriolis(Vector3d cor, Vector3d loc)
cor
- returns the point Coriolis term (in world coordinates)loc
- position of the point, in body coordinatespublic void addPointForce(Wrench wr, Point3d loc, Vector3d f)
wr
the wrench arising from applying a force
f
on a point loc
.wr
- wrench in which force is accumulated (world coordinatesloc
- location of the point (body coordinates)f
- force applied to the point (world coordinates)public void addPointForce(Point3d loc, Vector3d f)
f
on an attached point.loc
- location of the point (body coordinates)f
- force applied to the point (world coordinates)public void addFrameForce(RigidTransform3d TFL, Wrench wr)
f
on an attached frame.TFL
- location of the frame with respect to the bodywr
- 6 DOF force applied to the frame (world coordinates)public void computeAppliedWrench(Wrench wr, Vector3d f, Vector3d p)
wr
- returns the wrench in body coordinatesf
- applied force at the point (world coordinates)p
- location of the point on the body (body coordinates)public void resetTargets()
resetTargets
in interface MotionTargetComponent
public MotionTarget.TargetActivity getTargetActivity()
getTargetActivity
in interface MotionTargetComponent
public void setTargetActivity(MotionTarget.TargetActivity activity)
setTargetActivity
in interface MotionTargetComponent
public Point3d getTargetPosition()
public void setTargetPosition(Point3d pos)
public AxisAngle getTargetOrientation()
public void setTargetOrientation(AxisAngle axisAng)
public RigidTransform3d getTargetPose()
public void setTargetPose(RigidTransform3d X)
public Twist getTargetVelocity()
public void setTargetVelocity(Twist vel)
public int getTargetVel(double[] velt, double s, double h, int idx)
getTargetVel
in interface MotionTargetComponent
public int setTargetVel(double[] velt, int idx)
public int getTargetPos(double[] post, double s, double h, int idx)
getTargetPos
in interface MotionTargetComponent
public int setTargetPos(double[] post, int idx)
public int addTargetJacobian(SparseBlockMatrix J, int bi)
MotionTargetComponent
vt = J u
addTargetJacobian
in interface MotionTargetComponent
J
- motion target Jacobianbi
- block row index for the row to be addedpublic double getFrameDamping()
public void setFrameDamping(double d)
public PropertyMode getFrameDampingMode()
public void setFrameDampingMode(PropertyMode mode)
public double getRotaryDamping()
public void setRotaryDamping(double d)
public PropertyMode getRotaryDampingMode()
public void setRotaryDampingMode(PropertyMode mode)
public boolean hasForce()
DynamicAgent
Any action that alters the return value of this method should
propagate a StructureChangeEvent
. This can be
a state-not-changed event if component's state structure
is not altered (which it typically won't be).
hasForce
in interface DynamicAgent
true
if this component exerts its own forces.public RigidTransform3d getRenderFrame()
public RenderProps createRenderProps()
HasRenderProps
createRenderProps
in interface HasRenderProps
createRenderProps
in class RenderableComponentBase
public 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 updateBounds(Vector3d pmin, Vector3d pmax)
IsRenderable
updateBounds
in interface IsRenderable
updateBounds
in class RenderableComponentBase
pmin
- minimum pointpmax
- maximum pointpublic 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 void getSelection(java.util.LinkedList<java.lang.Object> list, int qid)
IsSelectable
list
the component (or components) associated with
the qid
-th selection query issued by this component's render
method. This will only be called if this component manages its own
selection (i.e., the number nums
returned by IsSelectable.numSelectionQueriesNeeded()
is positive), and qid
will in
turn be a number between 0 and nums
-1.getSelection
in interface IsSelectable
getSelection
in class RenderableComponentBase
list
- selected objects are appended to the end of this listqid
- index of the selection querypublic 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
transformGeometry
in class DynamicComponentBase
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
addTransformableDependencies
in class DynamicComponentBase
context
- context information, to which the dependent components
are added.flags
- specifies conditions associated with the transformationpublic void scaleDistance(double s)
ScalableUnits
scaleDistance
in interface ScalableUnits
s
- scaling factorpublic void zeroExternalForces()
zeroExternalForces
in interface DynamicAgent
public void zeroForces()
zeroForces
in interface DynamicAgent
public void applyExternalForces()
applyExternalForces
in interface DynamicAgent
public void applyForces(double t)
ForceEffector
applyForces
in interface ForceEffector
t
- time (seconds)public void addVelJacobian(SparseNumberedBlockMatrix S, double s)
ForceEffector
M is guaranteed to be the same matrix supplied in the most recent call to
addSolveBlocks
, and so implementations may choose
to cache the relevant matrix blocks from that call, instead of retrieving
them directly from M.
addVelJacobian
in interface ForceEffector
S
- solve matrix to which scaled velocity Jacobian is to be addeds
- scaling factor for velocity Jacobianpublic void addPosJacobian(SparseNumberedBlockMatrix S, double s)
ForceEffector
M is guaranteed to be the same matrix supplied in the most recent call to
addSolveBlocks
, and so implementations may choose
to cache the relevant matrix blocks from that call, instead of retrieving
them directly from M.
addPosJacobian
in interface ForceEffector
S
- solve matrix to which scaled position Jacobian is to be addeds
- scaling factor for position Jacobianpublic void addSolveBlocks(SparseNumberedBlockMatrix S)
ForceEffector
getSolveIndex
) for all dynamic or attached components affected by this
force effector.addSolveBlocks
in interface ForceEffector
S
- solve matrix to which blocks should be addedpublic int getJacobianType()
ForceEffector
Matrix.SYMMETRIC
or Matrix.POSITIVE_DEFINITE
. The former should be set if adding the Jacobian
terms preserves symmetry, and the latter should be set if positive
definiteness if preserved. Both should be set if there is no Jacobian for
this effector (i.e., the Jacobian methods are not implemented). Matrix
types from all the force effectors are logically and-ed together to
determine the type for the entire solve matrix.getJacobianType
in interface ForceEffector
public void scaleMass(double s)
ScalableUnits
scaleMass
in interface ScalableUnits
s
- scaling factorpublic MatrixBlock createMassBlock()
DynamicAgent
createMassBlock
in interface DynamicAgent
public boolean isMassConstant()
isMassConstant
in interface DynamicAgent
public double getMass(double t)
DynamicAgent
getMass
in interface DynamicAgent
public void getMass(Matrix M, double t)
DynamicAgent
getMass
in interface DynamicAgent
M
- matrix to return the mass int
- current timepublic double getEffectiveMass()
DynamicAgent
getEffectiveMass
in interface DynamicAgent
public void getEffectiveMass(Matrix M, double t)
DynamicAgent
getEffectiveMass
in interface DynamicAgent
M
- matrix to return the mass int
- current timepublic int mulInverseEffectiveMass(Matrix M, double[] a, double[] f, int idx)
mulInverseEffectiveMass
in interface DynamicAgent
public void resetEffectiveMass()
DynamicAgent
resetEffectiveMass
in interface DynamicAgent
public void addEffectivePointMass(double m, Vector3d loc)
m
- mass of the pointloc
- location of the point (in local frame coordinates)public void addEffectiveFrameMass(SpatialInertia M, RigidTransform3d TFL0)
M
- spatial inertia to be addedTFL0
- location of the inertia (in local frame coordinates)public int getEffectiveMassForces(VectorNd f, double t, int idx)
DynamicAgent
f
, starting at the location
specified by idx
. Upon return, this method should
return the value of idx
incremented by the dimension
of the mass forces.getEffectiveMassForces
in interface DynamicAgent
f
- vector to return the forces int
- current timeidx
- starting location within f
where forces should be storedidx
public void addSolveBlock(SparseNumberedBlockMatrix S)
addSolveBlock
in interface DynamicAgent
addSolveBlock
in class DynamicComponentBase
public void setState(Frame frame)
public int getPosState(double[] buf, int idx)
getPosState
in interface DynamicAgent
public int setPosState(double[] buf, int idx)
setPosState
in interface DynamicAgent
public void addPosImpulse(double[] xbuf, int xidx, double h, double[] vbuf, int vidx)
addPosImpulse
in interface DynamicAgent
public int getPosDerivative(double[] dxdt, int idx)
getPosDerivative
in interface DynamicAgent
public int getVelState(double[] buf, int idx)
getVelState
in interface DynamicAgent
public int getBodyVelState(double[] buf, int idx)
public int getWorldVelState(double[] buf, int idx)
public int setVelState(double[] buf, int idx)
setVelState
in interface DynamicAgent
public int setForce(double[] f, int idx)
setForce
in interface DynamicAgent
public int addForce(double[] f, int idx)
addForce
in interface DynamicAgent
public int getForce(double[] f, int idx)
getForce
in interface DynamicAgent
public Frame copy(int flags, java.util.Map<ModelComponent,ModelComponent> copyMap)
CopyableComponent
COPY_REFERENCES
is set in flags
, then any component referenced
by this component should itself be set to a copy. This
should be done first checking copyMap
for an
existing copy of the referenced component. If there is no existing
copy, then a copy should be created by calling copy
recursively and adding the new copy to copyMap
.copy
in interface CopyableComponent
copy
in class DynamicComponentBase
flags
- flags to control the copyingcopyMap
- map to possible existing instances of referenced
componentspublic void setBodyVelocity(Twist v)
public void getBodyVelocity(Twist v)
public java.lang.String[] getTraceables()
getTraceables
in interface Traceable
public java.lang.String getTraceablePositionProperty(java.lang.String traceableName)
+
or
-
character, which is used to control the rendering
of the tracing probe in case the traceable property is a 3-vector.
A prepended +
character means that the vector will
be rendered starting at, and directed away from the reference
position (or render as pull), while a +
character
means that the vector will be rendered starting away from, and
directed into the reference position (or render as push).getTraceablePositionProperty
in interface Traceable
null
.public PointFrameAttachment createPointAttachment(Point pnt)
PointAttachable
pnt
to this component. It should not be assumed that pnt
is currently connected to the component hierarchy, and no attempt
should be made to connect the returned attachment to the hierarchy;
the latter, if desired, is the responsibility of the caller.
In some cases, it may not be possible to attach the point at its present location. In that case, the method will create an attachment to the nearest feasible location.
createPointAttachment
in interface PointAttachable
pnt
- point for which an attachment should be createdpnt
to this componentpublic FrameFrameAttachment createFrameAttachment(Frame frame, RigidTransform3d TFW)
FrameAttachable
frame
to this
component. Once attached the frame will follow the body around. The
initial pose of the frame is specified by TFW
, which gives
its position and orientation in world coordinates. If TFW
is
null
, then the current pose of the frame is used. If
frame
is null
, then a virtual attachment is
created at the initial pose specified by
TFW
. frame
and TFW
cannot both be
null
.
In some cases, it may not be possible to attach the frame at the requested location. In that case, the method will relocate the frame to the nearest feasible attachment location.
createFrameAttachment
in interface FrameAttachable
frame
- frame to be attachedTFW
- transform from (initial) frame coordinates to world
coordinatesframe
to this componentpublic int getVelStateSize()
getVelStateSize
in interface DynamicAgent
getVelStateSize
in interface MotionTargetComponent
public int getPosStateSize()
getPosStateSize
in interface DynamicAgent
getPosStateSize
in interface MotionTargetComponent
public boolean velocityLimitExceeded(double tlimit, double rlimit)
velocityLimitExceeded
in interface DynamicAgent
tlimit
- translational velocity limitrlimit
- rotational velocity limitpublic boolean isDuplicatable()
CopyableComponent
true
if and only if CopyableComponent.getCopyReferences(java.util.List<artisynth.core.modelbase.ModelComponent>, artisynth.core.modelbase.ModelComponent)
returns true.
This method is not currently used. It is intended to provide a faster
way of determining if a component can be duplicated, without having to
use CopyableComponent.getCopyReferences(java.util.List<artisynth.core.modelbase.ModelComponent>, artisynth.core.modelbase.ModelComponent)
to build the list of copy references.
isDuplicatable
in interface CopyableComponent
true
if this component can be duplicated.public boolean getCopyReferences(java.util.List<ModelComponent> refs, ModelComponent ancestor)
CopyableComponent
true
if and only if CopyableComponent.isDuplicatable()
returns
true.getCopyReferences
in interface CopyableComponent
refs
- list to which references are appendedancestor
- root node of the hierarchy from which references are to be excludedpublic void setContactConstraint(double[] buf, double w, Vector3d dir, ContactPoint cpnt)
CollidableDynamicComponent
n
is the component's velocity state size, and the contact is
defined by a direction dir
and a point cpnt
.
The computed values should be scaled by a weighting factor
w
.setContactConstraint
in interface CollidableDynamicComponent
buf
- returns the n values for the block matrixw
- weighting factor by which the values should be scaleddir
- contact direction (world coordinates)cpnt
- contact pointpublic void addToPointVelocity(Vector3d vel, double w, ContactPoint cpnt)
CollidableDynamicComponent
w
,
and add it to vel
.addToPointVelocity
in interface CollidableDynamicComponent
vel
- accumulates contact point velocity (world coordinates)w
- weighting factorcpnt
- contact pointpublic void updateAttachmentPosStates()
public void getState(DataBuffer data)
HasNumericState
getState
in interface DynamicAgent
getState
in interface HasNumericState
data
- buffer for storing the state values.public void setState(DataBuffer data)
HasNumericState
setState
in interface DynamicAgent
setState
in interface HasNumericState
data
- buffer containing the state informationpublic void setRandomPosState()
setRandomPosState
in interface DynamicAgent
public void setRandomVelState()
setRandomVelState
in interface DynamicAgent
public void setRandomForce()
setRandomForce
in interface DynamicAgent
public void add1DConstraintBlocks(SparseBlockMatrix GT, int bj, double scale, ContactPoint cpnt, Vector3d dir)
ContactMaster
bj
,
while the block row(s) are determined internally by the solve indices of
the underlying dynamic components.add1DConstraintBlocks
in interface ContactMaster
GT
- constraint matrixbj
- block column indexscale
- TODOcpnt
- contact pointdir
- friction directionpublic void add2DConstraintBlocks(SparseBlockMatrix GT, int bj, double scale, ContactPoint cpnt, Vector3d dir0, Vector3d dir1)
ContactMaster
bj
, while the block row(s) are determined internally
by the solve indices of the underlying dynamic components.add2DConstraintBlocks
in interface ContactMaster
GT
- constraint matrixbj
- block column indexscale
- TODOcpnt
- contact pointdir0
- first friction directiondir1
- second friction directionpublic void addRelativeVelocity(Vector3d vel, double scale, ContactPoint cpnt)
ContactMaster
addRelativeVelocity
in interface ContactMaster
vel
- accumulates velocityscale
- TODOcpnt
- contact pointpublic void computeForceOnMasters(VectorNd uvec, Vector3d fc, double scale, ContactPoint cpnt, SparseBlockMatrix S)
ContactMaster
computeForceOnMasters
in interface ContactMaster
public int collectMasterComponents(java.util.HashSet<DynamicComponent> masters, boolean activeOnly)
ContactMaster
masters
, i.e., the number of components that were not already present
there.collectMasterComponents
in interface ContactMaster
masters
- set to which the dynamic components should be addedactiveOnly
- restrict collected components to those which are active