public class TrackingController extends ControllerBase implements CompositeComponent, RenderableComponent
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.
CompositeComponent.NavpanelDisplay
ModelComponent.NavpanelVisibility
Modifier and Type | Field and Description |
---|---|
static double |
DEFAULT_MAX_EXCITATION_JUMP |
static boolean |
DEFAULT_USE_INVERSE_MANAGER |
static PropertyList |
myProps |
enforceUniqueCompositeNames, enforceUniqueNames, myNumber, NULL_OBJ, useCompactPathNames
TRANSLUCENT, TWO_DIMENSIONAL
Constructor and Description |
---|
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
|
Modifier and Type | Method and Description |
---|---|
void |
addCostTerm(LeastSquaresTerm term)
Add another term to the optimization, typically
for regularization
|
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 |
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.
|
java.util.ArrayList<LeastSquaresTerm> |
getConstraintTerms()
Retrieves a list of all terms, including the tracking error
and any regularization terms
|
java.util.ArrayList<LeastSquaresTerm> |
getCostTerms()
Retrieves a list of all terms, including the tracking error
and any regularization terms
|
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.
|
L2RegularizationTerm |
getRegularizationTerm() |
LeastSquaresSolver |
getSolver()
Gets the solver object
|
boolean |
getSourcesVisible() |
boolean |
getTargetsVisible() |
ListView<MotionTargetComponent> |
getTargetView() |
boolean |
getUsePDControl() |
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 |
setUsePDControl(boolean usePD) |
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) |
render
copy, createRenderProps, createState, getInitialState, getInitialState, getRenderHints, getRenderProps, getSelection, getState, hasState, isSelectable, numSelectionQueriesNeeded, setInitialState, setRenderProps, setState, updateBounds
finalize, getModel, initialize, setModel, setModelFromComponent, write
checkFlag, checkName, checkNameUniqueness, clearFlag, clone, connectToHierarchy, createTempFlag, disconnectFromHierarchy, getChildren, getGrandParent, getHardReferences, getName, getNameRange, getNavpanelVisibility, getNavpanelVisibility, getNumber, getParent, getProperty, getSoftReferences, hasChildren, isFixed, isMarked, isSelected, isWritable, makeValidName, makeValidName, notifyParentOfChange, printReferences, recursivelyContained, recursivelyContains, removeTempFlag, setFixed, setFlag, setMarked, setName, setNavpanelVisibility, setNavpanelVisibility, setNumber, setParent, setSelected, updateReferences
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
connectToHierarchy, disconnectFromHierarchy, getHardReferences, getName, getNavpanelVisibility, getNumber, getParent, getSoftReferences, hasState, isFixed, isMarked, isSelected, notifyParentOfChange, setFixed, setMarked, setName, setNumber, setParent, setSelected, updateReferences
getProperty
getChildren, hasChildren
isWritable, write
getSelection, isSelectable, numSelectionQueriesNeeded
getRenderHints, render, updateBounds
createRenderProps, getRenderProps, setRenderProps
getModel, initialize, setModel
createState, getInitialState, getState, setState
public static final boolean DEFAULT_USE_INVERSE_MANAGER
public static double DEFAULT_MAX_EXCITATION_JUMP
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()
HasProperties
getAllPropertyInfo
in interface HasProperties
getAllPropertyInfo
in class ModelComponentBase
public MotionTargetTerm getMotionTerm()
public L2RegularizationTerm getRegularizationTerm()
public void apply(double t0, double t1)
apply
in interface Controller
public void dispose()
dispose
in interface ModelAgent
dispose
in class ModelAgentBase
public void addCostTerm(LeastSquaresTerm term)
term
- the term to addpublic java.util.ArrayList<LeastSquaresTerm> getCostTerms()
public java.util.ArrayList<LeastSquaresTerm> getConstraintTerms()
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 indexex
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 indexidx+numExcitations()
public MotionTargetComponent addMotionTarget(MotionTargetComponent source)
source
- point or frame to trackpublic 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 contributionpublic 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 void setUsePDControl(boolean usePD)
public boolean getUsePDControl()
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 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-componentpublic ModelComponent get(int idx)
get
in interface CompositeComponent
get
in interface IndexedComponentList
idx
- index of the sub-componentpublic ModelComponent getByNumber(int num)
getByNumber
in interface CompositeComponent
num
- number of the sub-componentpublic 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-componentpublic 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 objectsjava.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