public class TrackingController extends ControllerBase implements CompositeComponent, RenderableComponent
Terminology:
"Targets" | are trajectories of points/frames that we wish our model to follow |
"Sources" | are the points/frames in the model we want to follow the target trajectories |
"Excitation" | we actually mean, "activation", since we are currently ignoring the excitation dynamics |
Papers:
- Ian Stavness, JE Lloyd, and SS Fels. Automatic Prediction of Tongue Muscle
Activations Using a Finite Element Model. Journal of Biomechanics,
45(16):2841-2848, 2012.
- Ian Stavness, AG Hannam, JE Lloyd, and SS Fels. Predicting muscle patterns
for hemimandibulectomy models. Computer Methods in Biomechanics and
Biomedical Engineering, 13(4):483-491, 2010.
CompositeComponent.NavpanelDisplay
ModelComponent.NavpanelVisibility
Modifier and Type | Field and Description |
---|---|
static boolean |
DEFAULT_DEBUG |
static boolean |
DEFAULT_ENABLED |
static DoubleInterval |
DEFAULT_EXCITATION_BOUNDS |
static double |
DEFAULT_EXCITATION_REGULARIZATION_WEIGHT |
static double |
DEFAULT_MAX_EXCITATION_JUMP |
static boolean |
DEFAULT_NORMALIZE_COST_TERMS |
static double |
DEFAULT_PROBE_DURATION |
static double |
DEFAULT_PROBE_INTERVAL |
static boolean |
DEFAULT_SOURCES_VISIBLE |
static boolean |
DEFAULT_TARGETS_VISIBLE |
static boolean |
DEFAULT_USE_KKT_FACTORIZATION |
static boolean |
DEFAULT_USE_TIMESTEP_SCALING |
static int |
DEFAULT_USE_TRAPEZOIDAL_SOLVER |
static PropertyList |
myProps |
enforceUniqueCompositeNames, enforceUniqueNames, myNumber, NULL_OBJ, useCompactPathNames
TRANSPARENT, TWO_DIMENSIONAL
Constructor and Description |
---|
TrackingController()
Creates an empty tracking controller for scanning purposes.
|
TrackingController(MechSystemBase m)
Creates a tracking controller for a given mechanical system.
|
TrackingController(MechSystemBase m,
java.lang.String name)
Creates and names a tracking controller for a given mechanical system
|
Modifier and Type | Method and Description |
---|---|
ConstraintForceTarget |
addConstraintForceTarget(BodyConnector bodyCon)
Adds a body connector for constraint force tracking and creates a
corresponding
ConstraintForceTarget for specifying the target
force and weights. |
ConstraintForceTarget |
addConstraintForceTarget(BodyConnector bodyCon,
double weight)
Adds a body connector for constraint force tracking and creates a
corresponding
ConstraintForceTarget for specifying the target
force and weights. |
void |
addConstraintTerm(QPConstraintTerm term)
Adds a constraint term to this controller.
|
void |
addCostTerm(QPCostTerm term)
Adds a cost term to this controller.
|
DampingTerm |
addDampingTerm()
Deprecated.
Use
setExcitationDamping() instead. |
DampingTerm |
addDampingTerm(double w)
Deprecated.
Use
setExcitationDamping(double) instead. |
void |
addExciter(double weight,
ExcitationComponent ex)
Adds an excitation component to the set of exciters that can be used by
the controller.
|
void |
addExciter(ExcitationComponent ex)
Adds an excitation component to the set of exciters that can be used by
the controller.
|
void |
addExciters(java.util.Collection<? extends ExcitationComponent> exciters)
Adds a collection of excitation component to the set of exciters that
can be used by the controller.
|
ForceEffectorTarget |
addForceEffectorTarget(ForceTargetComponent source)
Adds a force effector component for force tracking and creates a
corresponding
ForceEffectorTarget for specifying the target force
and weights. |
ForceEffectorTarget |
addForceEffectorTarget(ForceTargetComponent source,
double weight)
Adds a force effector component for force tracking and creates a
corresponding
ForceEffectorTarget for specifying the target force
and weights. |
ForceEffectorTarget |
addForceEffectorTarget(ForceTargetComponent source,
double weight,
boolean staticOnly)
Adds a force effector icomponent for force tracking and creates a
corresponding
ForceEffectorTarget for specifying the target force
and weights. |
ForceEffectorTerm |
addForceEffectorTerm()
Deprecated.
The force effector term is now allocated on demand by
getForceEffectorTerm() and other methods. |
ForceTargetTerm |
addForceTargetTerm()
Deprecated.
Replaced by
getConstraintForceTerm() |
TargetFrame |
addFrameTarget(Frame source)
Adds a frame source for motion tracking and creates a corresponding
target component for specifying the target force and weights.
|
TargetFrame |
addFrameTarget(Frame source,
double weight)
Adds a frame source for motion tracking and creates a corresponding
target component for specifying the target force and weights.
|
L2RegularizationTerm |
addL2RegularizationTerm()
Deprecated.
Use
setL2Regularization() instead. |
L2RegularizationTerm |
addL2RegularizationTerm(double w)
Deprecated.
Use
setL2Regularization(double) instead. |
MotionTargetComponent |
addMotionTarget(MotionTargetComponent source)
Deprecated.
Use
addPointTarget(Point) or addFrameTarget(Frame) instead. |
MotionTargetComponent |
addMotionTarget(MotionTargetComponent source,
double weight)
Deprecated.
Use
addPointTarget(Point,double) or addFrameTarget(Frame,double) instead. |
TargetPoint |
addPointTarget(Point source)
Adds a point source for motion tracking and creates a corresponding
target component for specifying the target force and weights.
|
TargetPoint |
addPointTarget(Point source,
double weight)
Adds a point source for motion tracking and creates a corresponding
target component for specifying the target force and weights.
|
void |
addRegularizationTerms(java.lang.Double w_l2norm,
java.lang.Double w_damping)
Deprecated.
Use
setRegularization(double,double) instead. |
void |
apply(double t0,
double t1)
Applies the controller, estimating and setting the next
set of muscle activations
|
void |
clearExciters()
Removes all exciters
|
void |
componentChanged(ComponentChangeEvent e)
Notifies this composite component that a change has occured within one or
more of its descendants.
|
FrameExciter[] |
createAndAddFrameExciters(TrackingController ctrl,
MechModel mech,
Frame frame,
double maxForce,
double maxMoment)
Creates a complete set of FrameExciters for a given frame and adds them
to a MechModel and to a controller.
|
void |
createPanel(RootModel root)
Convenience method that creates a control panel for the tracking
controller.
|
void |
createProbes(RootModel root)
Convenience method that clears all existing probes and then creates a set
of probes for controlling and monitoring the tracking controller.
|
void |
createProbes(RootModel root,
double duration,
double interval)
Convenience method that clears all existing probes and then creates a set
of probes for controlling and monitoring the tracking controller.
|
void |
createProbesAndPanel(RootModel root)
Convenience method that creates both a set of probes and a control panel
for the tracking controller, combining both
createProbes(RootModel) and createPanel(artisynth.core.workspace.RootModel) . |
void |
createProbesAndPanel(RootModel root,
double duration,
double interval)
Convenience method that creates both a set of probes and a control panel
for the tracking controller, combining both
createProbes(RootModel,double,double) and createPanel(artisynth.core.workspace.RootModel) . |
ComponentState |
createState(ComponentState prevState)
Factory routine to create a state object for this component, which can
then be used as an argument for
HasState.setState(artisynth.core.modelbase.ComponentState) and HasState.getState(artisynth.core.modelbase.ComponentState) . |
void |
dispose()
Clears all terms and disposes storage
|
ModelComponent |
findComponent(java.lang.String path)
Recursively searches for a subcomponent of this ModelComponent,
identified by a path of component names.
|
ModelComponent |
get(int idx)
Returns a specific subcomponent of this ModelComponent, identified by
index.
|
ModelComponent |
get(java.lang.String nameOrNumber)
Returns a specific subcomponent of this ModelComponent, identified by
name or string representation of the subcomponent's number
|
PropertyList |
getAllPropertyInfo()
Returns a list giving static information about all properties exported by
this object.
|
BoundsTerm |
getBoundsTerm()
Returns the standard excitation bounds term for this controller.
|
ModelComponent |
getByNumber(int num)
Returns a specific subcomponent of this ModelComponent, identified by
number.
|
java.util.Iterator<? extends HierarchyNode> |
getChildren() |
boolean |
getComputeIncrementally()
Queries whether or not excitations are computed incrementally at each
time step, as described in
setComputeIncrementally(boolean) . |
boolean |
getConfigExcitationColoring()
Queries whether or not the automatic configuration of excitation coloring
for exciters is enabled, as described in
setConfigExcitationColoring(boolean) . |
java.util.ArrayList<BodyConnector> |
getConstraintForceSources()
Returns all the BodyConnectors whose constraint forces are being
controlled.
|
java.util.ArrayList<ConstraintForceTarget> |
getConstraintForceTargets()
Returns the ConstraintForceTargets for all the body connectors being
controlled.
|
ConstraintForceTerm |
getConstraintForceTerm()
Returns the constraint force target term, allocating it if necessary.
|
double |
getConstraintForceTermWeight()
Queries the weight of the constraint force term.
|
java.util.ArrayList<QPCostTerm> |
getCostTerms()
Retrieves a list of all costs terms, including the standard ones.
|
DampingTerm |
getDampingTerm()
Deprecated.
Use
getExcitationDampingTerm() instead. |
boolean |
getDebug()
Queries whether or not debug messages are enabled.
|
java.util.ArrayList<QPConstraintTerm> |
getEqualityConstraints()
Retrieves a list of all equality constraint terms, including the standard
ones.
|
double |
getExcitation(int k)
Queries the current excitation value of the
k -th
exciter. |
DoubleInterval |
getExcitationBounds()
Queries the current default bounds for the excitation values.
|
DoubleInterval |
getExcitationBounds(ExcitationComponent ex)
Queries the excitation bounds for a specific excitation component.
|
PropertyMode |
getExcitationBoundsMode()
Queries the property inheritance mode for the excitation bounds.
|
DampingTerm |
getExcitationDampingTerm()
Returns the excitation damping term, or
null if it is not present. |
double |
getExcitationDampingWeight()
Return the weight assocation with excitation damping, or 0 if
damping is not present.
|
VectorNd |
getExcitations()
Returns a vector containing all the current excitation values.
|
void |
getExcitations(VectorNd values)
Returns the current excitation values in the vector
values . |
int |
getExcitations(VectorNd values,
int idx)
Fills the supplied
values vector with current excitation
values starting at index idx . |
ExcitationComponent |
getExciter(int idx)
Returns the idx-th excitation component used by the controller.
|
ListView<ExcitationComponent> |
getExciters()
Returns a list of the excitation components used by the inverse routine
|
java.util.ArrayList<ForceTargetComponent> |
getForceEffectorSources()
Returns a list of all the force effector components being controlled.
|
java.util.ArrayList<ForceEffectorTarget> |
getForceEffectorTargets()
Returns a list of the ForceEffectorTargets for all the force effector
components being controlled.
|
ForceEffectorTerm |
getForceEffectorTerm()
Returns the force effector target term, allocating it if necessary.
|
double |
getForceEffectorTermWeight()
Queries the weight of the force effector term.
|
ForceTargetTerm |
getForceTargetTerm()
Deprecated.
Replaced by
getConstraintForceTerm() |
VectorNd |
getHlamCol(int j)
Returns the
j -th column of most recently computed Hlam matrix for
the excitation response. |
VectorNd |
getHuCol(int j)
Returns the
j -th column of most recently computed Hu matrix for
the excitation response. |
java.util.ArrayList<QPConstraintTerm> |
getInequalityConstraints()
Retrieves a list of all inequality constraint terms, including the
standard ones.
|
void |
getInitialState(ComponentState newstate,
ComponentState oldstate)
Gets an initial state for this component and returns the value in
state . |
MechSystemSolver.Integrator |
getIntegrator()
Queries the integrator used by the mechanical system.
|
boolean |
getKeepVelocityJacobianConstant()
Queries if recomputation of the velocity Jacobian has been disabled, as
described in
setKeepVelocityJacobianConstant(boolean) . |
L2RegularizationTerm |
getL2RegularizationTerm()
Returns the L2 regularization term, or
null if it is not
present. |
double |
getL2RegularizationWeight()
Return the weight assocation with L2 regularization, or 0 if
regularization is not present.
|
VectorNd |
getLam0()
Returns the most recently computed lam0 vector for the excitation
response.
|
double |
getMaxExcitationJump()
Queries the maximum jump in excitation values permitted between steps.
|
MechSystemBase |
getMech()
Queries the mechanical system being controlled.
|
java.util.ArrayList<MotionTargetComponent> |
getMotionSources()
Returns a list of all motion source components.
|
java.util.ArrayList<MotionTargetComponent> |
getMotionTargets()
Returns a list of all the motion target components.
|
MotionTargetTerm |
getMotionTargetTerm()
Returns the standard motion term for this controller, responsible for
motion tracking.
|
double |
getMotionTargetTermWeight()
Queries the weight of the motion term.
|
double |
getMotionTargetWeight(MotionTargetComponent comp)
Queries the weight for a specific motion target.
|
VectorNd |
getMotionTargetWeights()
Returns a vector of the individual weights for each motion target
component.
|
CompositeComponent.NavpanelDisplay |
getNavpanelDisplay()
Returns the DisplayMode for this component.
|
boolean |
getNormalizeCostTerms()
Queries whether or not cost terms normalization is enabled, as described
in
setNormalizeCostTerms(boolean) . |
boolean |
getNormalizeH()
Deprecated.
Use
getNormalizeCostTerms() intead. |
int |
getNumberLimit()
Returns the current upper limit for numbers among all subcomponents in
this composite.
|
double |
getProbeDuration()
Queries the probe duration used by
createProbes(RootModel) and
createProbesAndPanel(RootModel) . |
double |
getProbeUpdateInterval()
Queries the output probe update interval used by
createProbes(RootModel) and createProbesAndPanel(RootModel) . |
boolean |
getSourcesVisible()
Queries whether the motion sources are being rendered.
|
void |
getState(ComponentState state)
Get the current state of this component.
|
PointList<TargetPoint> |
getTargetPoints()
Returns a list of all points which are being used as motion targets.
|
double |
getTargetPointsRadius() |
boolean |
getTargetsVisible()
Queries whether the motion targets are being rendered.
|
VectorNd |
getU0()
Returns the most recently computed u0 vector for the excitation response.
|
boolean |
getUseKKTFactorization()
Queries whether or not KKT factorization is enabled, as described in
setUseKKTFactorization(boolean) . |
boolean |
getUseTimestepScaling()
Queries whether or not timestep scaling is enabled, as
described in
setUseTimestepScaling(boolean) . |
int |
getUseTrapezoidalSolver()
Queries the use of a trapezoidal solver for setting up the excitation
solve.
|
boolean |
hasChildren() |
boolean |
hasState()
Queries if this component has state.
|
boolean |
hierarchyContainsReferences()
Returns true if the component hierarchy formed by this component and its
descendents is closed with respect to references.
|
int |
indexOf(ModelComponent comp)
Returns the index of a specified subcomponent, or -1 if that the
component is not present.
|
void |
initializeExcitations()
Initialize the controller excitations with values currently stored in the
exciter components, to allow for non-zero starting excitations.
|
boolean |
isEnabled()
Queries whether or not this controller is enabled.
|
int |
numComponents()
Returns the number of components in this CompositeComponent.
|
int |
numConstraintForceTargets()
Returns the number of constraint force targets.
|
int |
numExciters()
Returns the number of excitation components used by the controller.
|
int |
numForceEffectorTargets()
Returns the number of force effector targets.
|
int |
numMotionTargets()
Returns the number of motion targets.
|
void |
postscan(java.util.Deque<ScanToken> tokens,
CompositeComponent ancestor)
Performs any required post-scanning for this component.
|
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).
|
boolean |
removeConstraintForceTarget(BodyConnector bodyCon)
Removes a body connector from constraint force tracking.
|
boolean |
removeConstraintTerm(QPConstraintTerm term)
Removes a constraint term from this controller.
|
boolean |
removeCostTerm(QPCostTerm term)
Remove a cost term from this controller.
|
boolean |
removeDampingTerm()
Deprecated.
Use
removeExcitationDamping() instead. |
boolean |
removeExcitationDamping()
Removes excitation damping.
|
boolean |
removeForceEffectorTarget(ForceTargetComponent source)
Removes a force effector component from force tracking.
|
boolean |
removeForceEffectorTerm()
Deprecated.
The force effector term now remains in place once
allocated. This method does nothing and returns
false . |
void |
removeForceTargetTerm()
Deprecated.
The constraint force term now remains in place once
allocated. This method therefore does nothing.
|
boolean |
removeL2Regularization()
Removes L2 regularization.
|
boolean |
removeL2RegularizationTerm()
Deprecated.
Use
removeL2Regularization() instead. |
boolean |
removeMotionTarget(MotionTargetComponent source)
Removes a source component from motion tracking.
|
void |
scan(ReaderTokenizer rtok,
java.lang.Object ref)
Scans this element from a ReaderTokenizer.
|
void |
setComputeIncrementally(boolean enable)
Enables incremental computation.
|
void |
setConfigExcitationColoring(boolean enable)
Enables the automatic configuration of excitation coloring for exciters
that support this capability.
|
void |
setConstraintForceTermWeight(double w)
Sets the weight of the constraint force term.
|
void |
setDebug(boolean enable)
Enables the printing of debug messages.
|
void |
setExcitationBounds(double lower,
double upper)
Sets the default bounds for the excitation values.
|
void |
setExcitationBounds(DoubleInterval bounds)
Sets the default bounds for the excitation values.
|
void |
setExcitationBounds(ExcitationComponent ex,
double lower,
double upper)
Sets the excitation bounds for a specific excitation component.
|
void |
setExcitationBoundsMode(PropertyMode mode)
Sets the property inheritance mode for the excitation bounds.
|
void |
setExcitationDamping()
Enables excitation damping with a default weight of 1e-5.
|
void |
setExcitationDamping(double w)
Enables excitation damping with a specified weight.
|
void |
setExcitations(VectorNd values)
Sets excitations to the values provided in the vector
values . |
int |
setExcitations(VectorNd values,
int idx)
Sets excitations provided in the
ex vector starting at index
idx . |
void |
setForceEffectorTermWeight(double w)
Sets the weight of the force effector term.
|
void |
setInitialExcitations(VectorNd init)
Sets initial excitations to the supplied values.
|
void |
setKeepVelocityJacobianConstant(boolean enable)
Disables recomputation of the velocity Jacobian.
|
void |
setL2Regularization()
Enables L2 regularization with a default weight of 0.0001.
|
void |
setL2Regularization(double w)
Enables L2 regularization with a specified weight.
|
void |
setLegacyMotionControl()
Sets property settings in the controller and motion control to those used
before PD and chase control were redesigned.
|
void |
setMaxExcitationJump(double maxJump)
Sets the maximum jump in excitation values permitted between steps.
|
void |
setMech(MechSystemBase mech)
Set the mechanical system being controlled.
|
void |
setMotionRenderProps(RenderProps targets,
RenderProps sources)
Sets the render properties used for rendering target and source components.
|
void |
setMotionTargetTermWeight(double w)
Sets the weight of the motion term.
|
void |
setMotionTargetWeight(MotionTargetComponent comp,
double w)
Sets the weight for a specific motion target.
|
void |
setNormalizeCostTerms(boolean enable)
Enables or disbles normalization of the cost terms in the quadratic
program.
|
void |
setNormalizeH(boolean enable)
Deprecated.
Use
setNormalizeCostTerms(boolean) intead. |
void |
setProbeDuration(double duration)
Sets the probe duration used by
createProbes(RootModel) and
createProbesAndPanel(RootModel) . |
void |
setProbeUpdateInterval(double h)
Sets the output probe update interval used by
createProbes(RootModel) and createProbesAndPanel(RootModel) . |
void |
setRegularization(double wL2,
double wdamping)
Sets both L2 regularization and excitation damping with supplied weights.
|
void |
setSourcesVisible(boolean show)
Enables rendering of the motion sources.
|
void |
setState(ComponentState state)
Set the state of this component.
|
void |
setTargetsPointRadius(double radius)
Sets the sphere radius used for rendering target points.
|
void |
setTargetsVisible(boolean show)
Enables rendering of the motion targets.
|
void |
setUseKKTFactorization(boolean enable)
Enables or disables KKT factorization.
|
void |
setUseTimestepScaling(boolean enable)
Enables timestep scaling.
|
void |
setUseTrapezoidalSolver(int code)
Sets when to use a trapezoidal solver for setting up the excitation
solve.
|
void |
updateNameMap(java.lang.String newName,
java.lang.String oldName,
ModelComponent comp) |
render
copy, createRenderProps, getRenderHints, getRenderProps, getSelection, isSelectable, numSelectionQueriesNeeded, setRenderProps, updateBounds
finalize, getModel, initialize, isActive, setActive, setModel, setModelFromComponent, write
checkFlag, checkName, checkNameUniqueness, clearFlag, clone, connectToHierarchy, createTempFlag, disconnectFromHierarchy, getGrandParent, getHardReferences, getName, getNameRange, getNavpanelVisibility, getNavpanelVisibility, getNumber, getParent, getProperty, getSoftReferences, isFixed, isMarked, isScanning, isSelected, isWritable, makeValidName, makeValidName, notifyParentOfChange, printReferences, recursivelyContained, recursivelyContains, removeTempFlag, setFixed, setFlag, setMarked, setName, setNavpanelVisibility, setNavpanelVisibility, setNumber, setParent, setScanning, setSelected, setWritable, updateReferences
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
connectToHierarchy, disconnectFromHierarchy, getHardReferences, getName, getNavpanelVisibility, getNumber, getParent, getSoftReferences, isFixed, isMarked, isSelected, notifyParentOfChange, setFixed, setMarked, setName, setNumber, setParent, setSelected, setWritable, updateReferences
getProperty
isWritable, write
getSelection, isSelectable, numSelectionQueriesNeeded
getRenderHints, render, updateBounds
createRenderProps, getRenderProps, setRenderProps
getModel, initialize, isActive, setModel
public static boolean DEFAULT_ENABLED
public static double DEFAULT_MAX_EXCITATION_JUMP
public static boolean DEFAULT_TARGETS_VISIBLE
public static boolean DEFAULT_SOURCES_VISIBLE
public static final double DEFAULT_PROBE_DURATION
public static final double DEFAULT_PROBE_INTERVAL
public static final boolean DEFAULT_DEBUG
public static boolean DEFAULT_USE_TIMESTEP_SCALING
public static boolean DEFAULT_USE_KKT_FACTORIZATION
public static boolean DEFAULT_NORMALIZE_COST_TERMS
public static DoubleInterval DEFAULT_EXCITATION_BOUNDS
public static int DEFAULT_USE_TRAPEZOIDAL_SOLVER
public static final double DEFAULT_EXCITATION_REGULARIZATION_WEIGHT
public static PropertyList myProps
public TrackingController()
public TrackingController(MechSystemBase m)
m
- mech system, typically your "MechModel"public TrackingController(MechSystemBase m, java.lang.String name)
m
- mech system, typically your "MechModel"name
- name to give the controllerpublic PropertyList getAllPropertyInfo()
getAllPropertyInfo
in interface HasProperties
getAllPropertyInfo
in class ModelAgentBase
public boolean isEnabled()
true
if this controller is enabledpublic double getMaxExcitationJump()
public void setMaxExcitationJump(double maxJump)
[0,1]
.maxJump
- maximum jump in excitation valuespublic boolean getTargetsVisible()
true
if motion target rendering is enabledpublic void setTargetsVisible(boolean show)
show
- if true
, enables motion target renderingpublic boolean getSourcesVisible()
true
if motion source rendering is enabledpublic void setSourcesVisible(boolean show)
show
- if true
, enables motion source renderingpublic double getProbeDuration()
createProbes(RootModel)
and
createProbesAndPanel(RootModel)
.public void setProbeDuration(double duration)
createProbes(RootModel)
and
createProbesAndPanel(RootModel)
.duration
- probe duration to be used for subsequently created probespublic double getProbeUpdateInterval()
createProbes(RootModel)
and createProbesAndPanel(RootModel)
.public void setProbeUpdateInterval(double h)
createProbes(RootModel)
and createProbesAndPanel(RootModel)
.
A value of -1
causes the probes to be updated at the
current simulation rate.h
- new output probe update intervalpublic boolean getDebug()
true
if debug messages are enabledpublic void setDebug(boolean enable)
enable
- if true
, enables debug messagespublic boolean getUseTimestepScaling()
setUseTimestepScaling(boolean)
.true
if timestep scaling is enabledpublic void setUseTimestepScaling(boolean enable)
H
matrix and
b
vector of the motion and force tracking terms are scaled by
1/h
, where h
is the simulation step size, thus making
these terms independent of the step size.
Timestep scaling is disabled by default.
enable
- if true
, enables timestep scalingpublic boolean getComputeIncrementally()
setComputeIncrementally(boolean)
.true
if excitations are computed incrementallypublic void setConfigExcitationColoring(boolean enable)
excitationColor
is inspected. If
it is null
, then it is set to red and the nominal exciter color
is set to white, enabling a white-to-red color transition for the exciter
as it is activated.enable
- if true
, enables incremental computationpublic boolean getConfigExcitationColoring()
setConfigExcitationColoring(boolean)
.true
if configuring excitation coloring is enabledpublic void setComputeIncrementally(boolean enable)
enable
- if true
, enables incremental computationpublic boolean getUseKKTFactorization()
setUseKKTFactorization(boolean)
.true
if KKT factorization is enabledpublic void setUseKKTFactorization(boolean enable)
KKT factorization is disabled by default.
enable
- if true
, enables KKT factorizationpublic boolean getNormalizeH()
getNormalizeCostTerms()
intead.public void setNormalizeH(boolean enable)
setNormalizeCostTerms(boolean)
intead.public boolean getNormalizeCostTerms()
setNormalizeCostTerms(boolean)
.true
if cost term normalization is enabledpublic void setNormalizeCostTerms(boolean enable)
Q
matrix
and b
vector by the Frobenius norm of Q
, before
the term's weight is applied. This helps ensure that the cost term
weights more inititively described the tradeoffs between terms.
Cost term normalization is enabled by default.
enable
- if true
, enables normalizationpublic DoubleInterval getExcitationBounds()
public void setExcitationBounds(DoubleInterval bounds)
[-inf,inf]
, correspnding to no effective bounds.bounds
- default excitation boundspublic void setExcitationBounds(double lower, double upper)
setExcitationBounds(DoubleInterval)
.lower
- lower excitation boundupper
- upper excitation boundpublic PropertyMode getExcitationBoundsMode()
public void setExcitationBoundsMode(PropertyMode mode)
mode
- property inheritance mode for excitationspublic int getUseTrapezoidalSolver()
setUseTrapezoidalSolver(int)
.public void setUseTrapezoidalSolver(int code)
code = 1
means always, code = 0
means never, and
code = -1
means automatic (match the solver being used by the
underlying mechanical system).code
- controls when to use a trapezoidal solverpublic boolean getKeepVelocityJacobianConstant()
setKeepVelocityJacobianConstant(boolean)
.true
if velocity Jacobian recomputation is disabledpublic void setKeepVelocityJacobianConstant(boolean enable)
enable
- if true
, disables velocity Jacobian recomputationpublic void setMech(MechSystemBase mech)
mech
- mechanical system being controlledpublic MechSystemBase getMech()
public MechSystemSolver.Integrator getIntegrator()
null
if
there is no system.public void createProbes(RootModel root)
probeDuration
property, while output probes are given an update
interval specified by the controller's probeUpdateInterval
property.
The probes are created using the InverseManager
.
root
- root model to which the probes should be addedgetProbeDuration()
,
getProbeUpdateInterval()
public void createProbes(RootModel root, double duration, double interval)
InverseManager
.
The probes start at time 0 and stop at the time indicated by duration
. The output probes are updated at the specified interval
; if specified as -1
, then the output probes are updated
at the current simulation sample rate.
The probes are created using the InverseManager
.
root
- root model to which the probes should be addedduration
- time duration for each probeinterval
- update interval for the output probespublic void createPanel(RootModel root)
root
- root model to which the panel should be addedpublic void createProbesAndPanel(RootModel root)
createProbes(RootModel)
and createPanel(artisynth.core.workspace.RootModel)
.root
- root model to which the probes and panel should be addedpublic void createProbesAndPanel(RootModel root, double duration, double interval)
createProbes(RootModel,double,double)
and createPanel(artisynth.core.workspace.RootModel)
.root
- root model to which the probes and panel should be addedduration
- time duration for each probeinterval
- update interval for the output probespublic void apply(double t0, double t1)
apply
in interface Controller
t0
- time at start of simulation stept1
- time at end of simulation steppublic void dispose()
dispose
in interface ModelAgent
dispose
in class ModelAgentBase
public void addExciter(ExcitationComponent ex)
ex
- exciter to addpublic void addExciters(java.util.Collection<? extends ExcitationComponent> exciters)
exciters
- exciter components to addpublic void addExciter(double weight, ExcitationComponent ex)
weight
- regularization weight to be applied to the exciterex
- exciter to addpublic ExcitationComponent getExciter(int idx)
idx
- index of the desired exciterpublic int numExciters()
public void clearExciters()
public ListView<ExcitationComponent> getExciters()
public void setExcitationBounds(ExcitationComponent ex, double lower, double upper)
ex
- excitation component to set bounds forlower
- lower excitation boundupper
- upper excitation boundpublic DoubleInterval getExcitationBounds(ExcitationComponent ex)
ex
- excitation component to request bounds forpublic int setExcitations(VectorNd values, int idx)
ex
vector starting at index
idx
. Both the controller's interval excitation
values and the values in the exciter components are set.values
- vector of excitations to useidx
- start indexex
buffer idx+numExciters()
public void setExcitations(VectorNd values)
values
. Both the controller's interval excitation values
and the values in the exciter components are set.values
- vector of excitations to usepublic int getExcitations(VectorNd values, int idx)
values
vector with current excitation
values starting at index idx
. These excitation
values are reading directly from the exciter components.values
- vector of excitations to fillidx
- starting indexidx+numExciters()
public void getExcitations(VectorNd values)
values
.
These excitation values are reading directly from the exciter components.values
- vector in which to return excitationspublic VectorNd getExcitations()
numExciters()
and
must not be modified.public double getExcitation(int k)
k
-th
exciter. k
must be in the range 0
to numExciters()-1
.k
- index of the excitation value to queryk
-th excitation valuepublic void initializeExcitations()
public void setInitialExcitations(VectorNd init)
init
- initial excitation valuespublic MotionTargetTerm getMotionTargetTerm()
public double getMotionTargetTermWeight()
public void setMotionTargetTermWeight(double w)
w
- motion term weightpublic MotionTargetComponent addMotionTarget(MotionTargetComponent source)
addPointTarget(Point)
or addFrameTarget(Frame)
instead.public MotionTargetComponent addMotionTarget(MotionTargetComponent source, double weight)
addPointTarget(Point,double)
or addFrameTarget(Frame,double)
instead.public TargetPoint addPointTarget(Point source)
addPointTarget(Point,double)
with weight
set
to 1.0.source
- point to trackpublic TargetPoint addPointTarget(Point source, double weight)
source
- point to trackweight
- weight to scale this target's contributionpublic TargetFrame addFrameTarget(Frame source)
addFrameTarget(Frame,double)
with
weight
set to 1.0.source
- body to trackpublic TargetFrame addFrameTarget(Frame source, double weight)
source
- body to trackweight
- weight to scale this target's contributionpublic boolean removeMotionTarget(MotionTargetComponent source)
source
- component to removetrue
if the component was present and removedpublic int numMotionTargets()
public double getTargetPointsRadius()
public void setTargetsPointRadius(double radius)
radius
- sphere radius for rendering target pointspublic java.util.ArrayList<MotionTargetComponent> getMotionTargets()
public java.util.ArrayList<MotionTargetComponent> getMotionSources()
public void setMotionRenderProps(RenderProps targets, RenderProps sources)
targets
- render properties for target componentssources
- render properties for source componentspublic VectorNd getMotionTargetWeights()
public void setMotionTargetWeight(MotionTargetComponent comp, double w)
comp
- source or target component for the motion targetw
- weight to be setpublic double getMotionTargetWeight(MotionTargetComponent comp)
comp
- source or target component for the motion targetpublic PointList<TargetPoint> getTargetPoints()
public ForceEffectorTerm addForceEffectorTerm()
getForceEffectorTerm()
and other methods.public ForceEffectorTerm getForceEffectorTerm()
public boolean removeForceEffectorTerm()
false
.public double getForceEffectorTermWeight()
public void setForceEffectorTermWeight(double w)
w
- force effector term weightpublic ForceEffectorTarget addForceEffectorTarget(ForceTargetComponent source)
ForceEffectorTarget
for specifying the target force
and weights. This method is equivalent to calling addForceEffectorTarget(ForceTargetComponent,double,boolean)
with weight
set to 1.0 and staticOnly
set to true
.source
- force effector componentpublic ForceEffectorTarget addForceEffectorTarget(ForceTargetComponent source, double weight)
ForceEffectorTarget
for specifying the target force
and weights. This method is equivalent to calling addForceEffectorTarget(ForceTargetComponent,double,boolean)
with staticOnly
set to true
.source
- force effector componentweight
- weight to scale this target's contributionpublic ForceEffectorTarget addForceEffectorTarget(ForceTargetComponent source, double weight, boolean staticOnly)
ForceEffectorTarget
for specifying the target force
and weights.source
- force effector componentweight
- weight to scale this target's contributionstaticOnly
- true
if only static forces (i.e., those which
are not velocity dependent) should be controlledpublic boolean removeForceEffectorTarget(ForceTargetComponent source)
source
- force component to removetrue
if the component was present and removedpublic int numForceEffectorTargets()
public java.util.ArrayList<ForceEffectorTarget> getForceEffectorTargets()
public java.util.ArrayList<ForceTargetComponent> getForceEffectorSources()
public ForceTargetTerm addForceTargetTerm()
getConstraintForceTerm()
public ForceTargetTerm getForceTargetTerm()
getConstraintForceTerm()
public void removeForceTargetTerm()
public ConstraintForceTerm getConstraintForceTerm()
public double getConstraintForceTermWeight()
public void setConstraintForceTermWeight(double w)
w
- constraint force term weightpublic ConstraintForceTarget addConstraintForceTarget(BodyConnector bodyCon)
ConstraintForceTarget
for specifying the target
force and weights. This method is equivalent to calling addConstraintForceTarget(BodyConnector,double)
with weight
set
to 1.0.bodyCon
- body connectorpublic ConstraintForceTarget addConstraintForceTarget(BodyConnector bodyCon, double weight)
ConstraintForceTarget
for specifying the target
force and weights.bodyCon
- body connectorweight
- weight to scale this target's contributionpublic boolean removeConstraintForceTarget(BodyConnector bodyCon)
bodyCon
- body connector to removetrue
if the connector was present and removedpublic int numConstraintForceTargets()
public java.util.ArrayList<ConstraintForceTarget> getConstraintForceTargets()
public java.util.ArrayList<BodyConnector> getConstraintForceSources()
public L2RegularizationTerm addL2RegularizationTerm()
setL2Regularization()
instead.public L2RegularizationTerm addL2RegularizationTerm(double w)
setL2Regularization(double)
instead.public boolean removeL2RegularizationTerm()
removeL2Regularization()
instead.public void setL2Regularization(double w)
w
- regularization term weightpublic void setL2Regularization()
public double getL2RegularizationWeight()
public boolean removeL2Regularization()
true
if L2 regularization was activepublic L2RegularizationTerm getL2RegularizationTerm()
null
if it is not
present.null
public DampingTerm addDampingTerm()
setExcitationDamping()
instead.public DampingTerm addDampingTerm(double w)
setExcitationDamping(double)
instead.public DampingTerm getDampingTerm()
getExcitationDampingTerm()
instead.public boolean removeDampingTerm()
removeExcitationDamping()
instead.public void setExcitationDamping(double w)
w
- excitation damping weightpublic void setExcitationDamping()
public double getExcitationDampingWeight()
public boolean removeExcitationDamping()
true
if damping was activepublic DampingTerm getExcitationDampingTerm()
null
if it is not present.public void addRegularizationTerms(java.lang.Double w_l2norm, java.lang.Double w_damping)
setRegularization(double,double)
instead.public void setRegularization(double wL2, double wdamping)
wL2
- L2 regularization weightwdamping
- excitation damping weightpublic BoundsTerm getBoundsTerm()
public void addConstraintTerm(QPConstraintTerm term)
term
- constraint term to addpublic boolean removeConstraintTerm(QPConstraintTerm term)
term
- constraint term to removetrue
if the term was presentpublic void addCostTerm(QPCostTerm term)
term
- cost term to addpublic boolean removeCostTerm(QPCostTerm term)
term
- cost term to removetrue
if the term was presentpublic java.util.ArrayList<QPCostTerm> getCostTerms()
public java.util.ArrayList<QPConstraintTerm> getEqualityConstraints()
public java.util.ArrayList<QPConstraintTerm> getInequalityConstraints()
public void prerender(RenderList list)
IsRenderable
list.addIfVisible (obj);
for each of the objects in question.prerender
in interface IsRenderable
prerender
in class ControllerMonitorBase
list
- list of objects to be renderedpublic ModelComponent get(java.lang.String nameOrNumber)
get
in interface CompositeComponent
nameOrNumber
- name or number of the subcomponentpublic ModelComponent get(int idx)
get
in interface CompositeComponent
get
in interface IndexedComponentList
idx
- index of the subcomponentpublic ModelComponent getByNumber(int num)
getByNumber
in interface CompositeComponent
num
- number of the subcomponentpublic int numComponents()
numComponents
in interface CompositeComponent
numComponents
in interface IndexedComponentList
public int indexOf(ModelComponent comp)
indexOf
in interface CompositeComponent
comp
- component whose index is requestedpublic ModelComponent findComponent(java.lang.String path)
findComponent
in interface CompositeComponent
path
- path leading to the subcomponentpublic int getNumberLimit()
getNumberLimit
in interface CompositeComponent
public CompositeComponent.NavpanelDisplay getNavpanelDisplay()
getNavpanelDisplay
in interface CompositeComponent
public void componentChanged(ComponentChangeEvent e)
This method should propagate the notification up the component hierarchy
by calling notifyParentOfChange
.
componentChanged
in interface ComponentChangeListener
componentChanged
in interface CompositeComponent
e
- optional argument giving specific information about the changepublic void updateNameMap(java.lang.String newName, java.lang.String oldName, ModelComponent comp)
updateNameMap
in interface CompositeComponent
public boolean hierarchyContainsReferences()
In particular, this means that one does not need to search outside the hierarchy when looking for dependencies.
hierarchyContainsReferences
in interface CompositeComponent
public void scan(ReaderTokenizer rtok, java.lang.Object ref) throws java.io.IOException
write
.scan
in interface ModelComponent
scan
in interface Scannable
scan
in class ModelComponentBase
rtok
- Tokenizer from which to scan the elementref
- optional reference object which can be used for resolving references to
other objectsjava.io.IOException
- if an I/O or formatting error occuredpublic void postscan(java.util.Deque<ScanToken> tokens, CompositeComponent ancestor) throws java.io.IOException
scan()
method and stored in the token queue.
The most common use of this method is to resolve the paths
of component references, which may not have been created
at the time of the initial scan()
call.postscan
in interface PostScannable
postscan
in class ModelComponentBase
tokens
- token information that was stored during
scan()
.ancestor
- ancestor component with respect to which
reference component paths are defined.java.io.IOException
- if an error is encountered (such as a reference to a
non-existent component)public boolean hasState()
hasState
in interface ModelComponent
hasState
in class ControllerMonitorBase
true
if this component has statepublic ComponentState createState(ComponentState prevState)
HasState.setState(artisynth.core.modelbase.ComponentState)
and HasState.getState(artisynth.core.modelbase.ComponentState)
. The state object does not have to be set to the component's
current state. If the component does not have any state information,
this method should return an instance of
EmptyState
.createState
in interface HasState
createState
in class ControllerMonitorBase
prevState
- If non-null, supplies a previous state that
was created by this component and which can be used to provide
pre-sizing hints.public void getState(ComponentState state)
getState
in interface HasState
getState
in class ControllerMonitorBase
state
- receives the state informationpublic void setState(ComponentState state)
setState
in interface HasState
setState
in class ControllerMonitorBase
state
- state to be copiedpublic void getInitialState(ComponentState newstate, ComponentState oldstate)
state
. If prevstate
is non-null, then it is
assumed to contain a previous initial state value returned by this
method, and state
should be set to be as consistent with
this previous state as possible. For example, suppose that this component
currently contains subcomponents A, B, and C, while the
prevstate
contains the state from a previous time when it
had components B, C, and D. Then state
should contain
substate values for B and C that are taken from
prevstate
. To facilitate this, the information returned in
state
should contain additional information such as the
identities of all the (current) subcomponents.getInitialState
in interface HasState
getInitialState
in class ControllerMonitorBase
newstate
- receives the state informationoldstate
- previous state information; may be null
.public VectorNd getU0()
ExcitationResponse
for details.public VectorNd getHuCol(int j)
j
-th column of most recently computed Hu matrix for
the excitation response. See ExcitationResponse
for details.j
- requested column from the Hu matrixj
-th column of Hu for the excitation response. Should not
be modified.public VectorNd getLam0()
ExcitationResponse
for details.public VectorNd getHlamCol(int j)
j
-th column of most recently computed Hlam matrix for
the excitation response. See ExcitationResponse
for details.j
- requested column from the Hlam matrixj
-th column of Hlam for the excitation response. Should not
be modified.public FrameExciter[] createAndAddFrameExciters(TrackingController ctrl, MechModel mech, Frame frame, double maxForce, double maxMoment)
ctrl
- Tracking controller to add the exciters tomech
- MechModel to add the exciters toframe
- frame for which the exciters should be createdmaxForce
- maximum translational force along any axismaxMoment
- maximum moment about any axispublic java.util.Iterator<? extends HierarchyNode> getChildren()
getChildren
in interface HierarchyNode
getChildren
in class ModelComponentBase
public boolean hasChildren()
hasChildren
in interface HierarchyNode
hasChildren
in class ModelComponentBase
public void setLegacyMotionControl()