|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectartisynth.core.modelbase.ModelComponentBase
artisynth.core.modelbase.ModelAgentBase
artisynth.core.modelbase.ControllerMonitorBase
artisynth.core.modelbase.ControllerBase
artisynth.core.inverse.TrackingController
public class TrackingController
"Inverse" controller for computing muscle activations based on a set of kinematic target trajectories.
Terminology:
"Targets" | are trajectories of points/frames that we wish our model to follow |
"Markers" or "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.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface artisynth.core.modelbase.CompositeComponent |
---|
CompositeComponent.NavpanelDisplay |
Nested classes/interfaces inherited from interface artisynth.core.modelbase.ModelComponent |
---|
ModelComponent.NavpanelVisibility |
Field Summary | |
---|---|
static double |
DEFAULT_MAX_EXCITATION_JUMP
|
static boolean |
DEFAULT_USE_INVERSE_MANAGER
|
static PropertyList |
myProps
|
Fields inherited from class artisynth.core.modelbase.ModelComponentBase |
---|
enforceUniqueCompositeNames, enforceUniqueNames, myNumber, NULL_OBJ, useCompactPathNames |
Fields inherited from interface maspack.render.GLRenderable |
---|
TRANSLUCENT, TWO_DIMENSIONAL |
Constructor Summary | |
---|---|
TrackingController()
|
|
TrackingController(MechSystemBase m)
Creates a tracking controller for a given mech system |
|
TrackingController(MechSystemBase m,
java.lang.String name)
Creates and names a tracking controller for a given mech system |
Method Summary | |
---|---|
DampingTerm |
addDampingTerm()
Adds and returns a standard damping term on excitations |
DampingTerm |
addDampingTerm(double w)
Adds and returns a standard damping term on excitations, weighted by the supplied value |
void |
addExciter(ExcitationComponent ex)
Adds an exciter to be used as a free variable in the inverse routine |
void |
addExciter(ExcitationComponent ex,
double gain)
|
L2RegularizationTerm |
addL2RegularizationTerm()
Adds and returns a standard L2 regularization term on excitations |
L2RegularizationTerm |
addL2RegularizationTerm(double w)
Adds and returns a standard L2 regularization term on excitations, weighted by the supplied value |
MotionTargetComponent |
addMotionTarget(MotionTargetComponent source)
Adds a source for the tracking and creates a corresponding target point or frame object |
MotionTargetComponent |
addMotionTarget(MotionTargetComponent source,
double weight)
Adds a source for the tracking and creates a corresponding target point or frame object |
void |
addRegularizationTerms(java.lang.Double w_l2norm,
java.lang.Double w_damping)
Adds both L2 and damping regularization terms with supplied weights |
void |
addTerm(LeastSquaresTerm term)
Add another term to the optimization, typically for regularization |
void |
apply(double t0,
double t1)
Applies the controller, estimating and setting the next set of muscle activations |
void |
clearExciters()
Clears all exciters |
void |
componentChanged(ComponentChangeEvent e)
Notifies this composite component that a change has occured within one or more of its descendants. |
ControlPanel |
createInverseControlPanel()
Creates a control panel for this inverse controller |
void |
dispose()
Clears all terms and disposes storage |
ModelComponent |
findComponent(java.lang.String path)
Recursively searches for a sub-component of this ModelComponent, identified by a path of component names. |
ModelComponent |
get(int idx)
Returns a specific sub-component of this ModelComponent, identified by index. |
ModelComponent |
get(java.lang.String nameOrNumber)
Returns a specific sub-component of this ModelComponent, identified by name or string representation of the sub-component's number |
PropertyList |
getAllPropertyInfo()
Returns a list giving static information about all properties exported by this object. |
ModelComponent |
getByNumber(int num)
Returns a specific sub-component of this ModelComponent, identified by number. |
boolean |
getDebug()
|
int |
getExcitations(VectorNd ex,
int idx)
Fills the supplied ex vector with current excitation
values starting at index idx |
ListView<ExcitationComponent> |
getExciters()
Gets the list of excitators used as free variables in the inverse routine |
void |
getForces(VectorNd forces,
VectorNd excitations)
Determines the set of forces given a set of excitations. |
MechSystemSolver.Integrator |
getIntegrator()
Returns the integrator used by the mech system |
double |
getMaxExcitationJump()
Gets the governor's maximum excitation jump |
MechSystemBase |
getMech()
Gets the mechanical system used for computing forces |
java.util.ArrayList<MotionTargetComponent> |
getMotionSources()
Returns the set of sources |
java.util.ArrayList<MotionTargetComponent> |
getMotionTargets()
Returns the set of targets |
MotionTargetTerm |
getMotionTargetTerm()
Returns the motion target term, responsible for trajectory error |
VectorNd |
getMotionTargetWeights()
Returns the set of target weights |
MotionTargetTerm |
getMotionTerm()
Returns the "motion" term, responsible for tracking error |
MuscleExciter |
getMuscleExciter()
|
CompositeComponent.NavpanelDisplay |
getNavpanelDisplay()
Returns the DisplayMode for this component. |
int |
getNumberLimit()
Returns the current upper limit for numbers among all sub-components in this composite. |
LeastSquaresSolver |
getSolver()
Gets the solver object |
boolean |
getSourcesVisible()
|
boolean |
getTargetsVisible()
|
double |
getTargetVelocityFactor()
Gets the velocity factor to use for trajectory tracking. |
ListView<MotionTargetComponent> |
getTargetView()
|
java.util.ArrayList<LeastSquaresTerm> |
getTerms()
Retrieves a list of all terms, including the tracking error and any regularization terms |
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 sub-component, or -1 if that the component is not present. |
void |
initializeExcitations()
Initialize the controller with the current excitations in the model, allows for non-zero starting excitations |
boolean |
isEnabled()
Returns whether or not the controller is enabled |
boolean |
isManaged()
Flag used by InverseManager telling it whether or not to set up and control the targets with probes |
int |
numComponents()
Returns the number of components in this CompositeComponent. |
int |
numExcitations()
Number of exciters controlled by this controller |
void |
postscan(java.util.Deque<ScanToken> tokens,
CompositeComponent ancestor)
Performs any required post-scanning for this component. |
void |
prerender(RenderList list)
Prepare for rendering, and potentially add itself to a list to be drawn by a GLRenderer. |
void |
removeMotionTarget(MotionTargetComponent source)
|
void |
scan(ReaderTokenizer rtok,
java.lang.Object ref)
Scans this element from a ReaderTokenizer. |
void |
setDebug(boolean b)
Puts controller into debug mode, printing messages |
void |
setEnabled(boolean enabled)
Enable or disable the controller |
void |
setExcitationBounds(double lower,
double upper)
Sets bounds for the excitations |
int |
setExcitations(VectorNd ex,
int idx)
Sets excitations provided in the ex vector
starting at index idx . |
void |
setInitialExcitations(VectorNd init)
Sets initial excitations to the supplied values |
void |
setManaged(boolean set)
Sets a flag used by InverseManager telling it whether or not to set up and control the targets with probes. |
void |
setMaxExcitationJump(double j)
For the governor, limits jump in excitation for all exciters to the supplied delta |
void |
setMech(MechSystemBase m)
Set the mech system, used by the solver to compute forces |
void |
setMotionRenderProps(RenderProps targets,
RenderProps sources)
Sets render properties for targets and sources |
void |
setMotionTargetWeight(MotionTargetComponent comp,
double w)
|
void |
setSourcesVisible(boolean show)
Show or hide the sources |
void |
setTargetsPointRadius(double radius)
Sets targets to shows a spheres with given radius |
void |
setTargetsVisible(boolean show)
Show or hide the targets |
void |
setTargetVelocityFactor(double k)
Sets the velocity factor to use for trajectory tracking. |
void |
updateConstraints(double t)
Updates constraints in the mech system at time t, including contacts |
void |
updateNameMap(java.lang.String newName,
java.lang.String oldName,
ModelComponent comp)
|
Methods inherited from class artisynth.core.modelbase.ControllerBase |
---|
render |
Methods inherited from class artisynth.core.modelbase.ControllerMonitorBase |
---|
copy, createRenderProps, createState, getInitialState, getInitialState, getRenderHints, getRenderProps, getSelection, getState, hasState, isSelectable, numSelectionQueriesNeeded, setInitialState, setRenderProps, setState, updateBounds |
Methods inherited from class artisynth.core.modelbase.ModelAgentBase |
---|
finalize, getModel, initialize, setModel, setModelFromComponent, write |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface artisynth.core.modelbase.ModelComponent |
---|
connectToHierarchy, disconnectFromHierarchy, getHardReferences, getName, getNavpanelVisibility, getNumber, getParent, getSoftReferences, hasState, isFixed, isMarked, isSelected, notifyParentOfChange, setFixed, setMarked, setName, setNumber, setParent, setSelected, updateReferences |
Methods inherited from interface maspack.properties.HasProperties |
---|
getProperty |
Methods inherited from interface maspack.properties.HierarchyNode |
---|
getChildren, hasChildren |
Methods inherited from interface maspack.util.Scannable |
---|
isWritable, write |
Methods inherited from interface maspack.render.GLSelectable |
---|
getSelection, isSelectable, numSelectionQueriesNeeded |
Methods inherited from interface maspack.render.GLRenderable |
---|
getRenderHints, render, updateBounds |
Methods inherited from interface maspack.render.HasRenderProps |
---|
createRenderProps, getRenderProps, setRenderProps |
Methods inherited from interface artisynth.core.modelbase.ModelAgent |
---|
getModel, initialize, setModel |
Methods inherited from interface artisynth.core.modelbase.HasState |
---|
createState, getInitialState, getState, setState |
Field Detail |
---|
public static final boolean DEFAULT_USE_INVERSE_MANAGER
public static double DEFAULT_MAX_EXCITATION_JUMP
public static PropertyList myProps
Constructor Detail |
---|
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 controllerMethod Detail |
---|
public PropertyList getAllPropertyInfo()
HasProperties
getAllPropertyInfo
in interface HasProperties
getAllPropertyInfo
in class ModelComponentBase
public MotionTargetTerm getMotionTerm()
public void apply(double t0, double t1)
apply
in interface Controller
public void dispose()
dispose
in interface ModelAgent
dispose
in class ModelAgentBase
public void addTerm(LeastSquaresTerm term)
term
- the term to addpublic java.util.ArrayList<LeastSquaresTerm> getTerms()
public boolean isEnabled()
public void setEnabled(boolean enabled)
public void setMech(MechSystemBase m)
public MechSystemBase getMech()
public MechSystemSolver.Integrator getIntegrator()
public LeastSquaresSolver getSolver()
public void setExcitationBounds(double lower, double upper)
lower
- lower-bound (typically 0)upper
- upper-bound (typically 1)public void getForces(VectorNd forces, VectorNd excitations)
forces
- output from the mech systemexcitations
- input muscle excitationspublic void updateConstraints(double t)
public int setExcitations(VectorNd ex, int idx)
ex
vector
starting at index idx
.
ex
- vector of excitations to useidx
- start index
ex
buffer idx+numExcitations()
public ListView<ExcitationComponent> getExciters()
public MuscleExciter getMuscleExciter()
public void addExciter(ExcitationComponent ex)
ex
- public void addExciter(ExcitationComponent ex, double gain)
public void clearExciters()
public int numExcitations()
public int getExcitations(VectorNd ex, int idx)
ex
vector with current excitation
values starting at index idx
ex
- vector of excitations to fillidx
- starting index
idx+numExcitations()
public MotionTargetComponent addMotionTarget(MotionTargetComponent source)
source
- point or frame to track
public void removeMotionTarget(MotionTargetComponent source)
public MotionTargetComponent addMotionTarget(MotionTargetComponent source, double weight)
source
- point or frame to trackweight
- the weight by which to scale this target's contribution
public L2RegularizationTerm addL2RegularizationTerm()
public L2RegularizationTerm addL2RegularizationTerm(double w)
public DampingTerm addDampingTerm()
public DampingTerm addDampingTerm(double w)
public void addRegularizationTerms(java.lang.Double w_l2norm, java.lang.Double w_damping)
public void setMaxExcitationJump(double j)
public double getMaxExcitationJump()
public void setTargetsVisible(boolean show)
public void setSourcesVisible(boolean show)
public void setTargetsPointRadius(double radius)
public boolean getSourcesVisible()
public boolean getTargetsVisible()
public void setDebug(boolean b)
public boolean getDebug()
public boolean isManaged()
public void setManaged(boolean set)
public ControlPanel createInverseControlPanel()
public ListView<MotionTargetComponent> getTargetView()
public MotionTargetTerm getMotionTargetTerm()
public java.util.ArrayList<MotionTargetComponent> getMotionTargets()
public java.util.ArrayList<MotionTargetComponent> getMotionSources()
public void setMotionRenderProps(RenderProps targets, RenderProps sources)
targets
- sources
- public void setTargetVelocityFactor(double k)
MotionTargetTerm.setTargetVelocityFactor(double)
.
k
- public double getTargetVelocityFactor()
MotionTargetTerm.setTargetVelocityFactor(double)
.
public VectorNd getMotionTargetWeights()
public void setMotionTargetWeight(MotionTargetComponent comp, double w)
public void initializeExcitations()
public void setInitialExcitations(VectorNd init)
public void prerender(RenderList list)
GLRenderable
prerender
in interface GLRenderable
prerender
in class ControllerMonitorBase
public ModelComponent get(java.lang.String nameOrNumber)
get
in interface CompositeComponent
nameOrNumber
- name or number of the sub-component
public ModelComponent get(int idx)
get
in interface CompositeComponent
get
in interface IndexedComponentList
idx
- index of the sub-component
public ModelComponent getByNumber(int num)
getByNumber
in interface CompositeComponent
num
- number of the sub-component
public int numComponents()
numComponents
in interface CompositeComponent
numComponents
in interface IndexedComponentList
public int indexOf(ModelComponent comp)
indexOf
in interface CompositeComponent
public ModelComponent findComponent(java.lang.String path)
findComponent
in interface CompositeComponent
path
- path leading to the sub-component
public 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
ModelComponentBase
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 objects
java.io.IOException
- if an I/O or formatting error occuredpublic void postscan(java.util.Deque<ScanToken> tokens, CompositeComponent ancestor) throws java.io.IOException
ModelComponent
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 ModelComponent
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
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |