public class InverseManager
extends java.lang.Object
addProbes (rootModel, controller, duration, interval) addInversePanel (rootModel, controller)which create the probes or panel for the indicated controller and add them to the specified root model. The probes start at time 0 and extend for
duration
seconds,
while interval
specifies the update interval for the
output probes. Specifying interval
as -1
will cause
the output probes to update at the current simulation sample rate.
An additional method,
resetProbes (rootModel, controller, duration, interval)behaves identically to
addProbes(artisynth.core.workspace.RootModel, artisynth.core.inverse.TrackingController, double, double)
, but also clears
all existing probes first.
addProbes(artisynth.core.workspace.RootModel, artisynth.core.inverse.TrackingController, double, double)
adds up to three input and three output probes to the
timeline, each identified by an enumerated type InverseManager.ProbeID
. The
input probes are:
TARGET_POSITIONS # desired trajectory for all motion targets TARGET_FORCES # desired trajectory for all constraint force targets INPUT_EXCITATIONS # input excitations to used for forward simulation
TARGET_FORCES
is added only if a force target term has been added to
the controller. Applications can use the TARGET_POSITIONS
and TARGET_FORCES
probes to supply reference trajectories for the motion and
constraint force targets; each supplies a vector controlling all the degrees
of freedom for the motion and force targets. The INPUT_EXCITATIONS
probe is disabled by default, but can be used to supply excitations to run a
forward simulation to generate a reference trajectory that can be later
tracked by the controller, as described below. Once created, the inout
probes may be located within the root model using the method findInputProbe(artisynth.core.workspace.RootModel, artisynth.core.inverse.InverseManager.ProbeID)
, and data for them may be set using setInputProbeData(artisynth.core.workspace.RootModel, artisynth.core.inverse.InverseManager.ProbeID, double[], double)
.
The output probes are:
TRACKED_POSITIONS # current motion targets trajectory SOURCE_POSITIONS # actual trajectory for all motion sources COMPUTED_EXCITATIONS # excitations computed by the inverse solverThe
TRACKED_POSITIONS
and COMPUTED_EXCITATIONS
record the
reference target positions and computed excitations as the inverse
simulation proceeds, while SOURCE_POSITIONS
records the actual
resulting motion trajectory. Once created, these output probes may be
located within the root model using the method findOutputProbe(artisynth.core.workspace.RootModel, java.lang.String)
.
Each probe is assigned a name and an attached file name based on
converted its InverseManager.ProbeID
name to lower case. For example, TARGET_POSITIONS
is given the name "target positions"
and attached
file name "target_positions.txt"
. A probe's attached file name
can be changed using setProbeFileName(artisynth.core.workspace.RootModel, artisynth.core.inverse.InverseManager.ProbeID, java.lang.String)
.
To generate a reference trajectory using a forward simulation, one should
disable the tracking controller (by setting its enabled
property to
false
), and then enable the INPUT_EXCITATIONS
probe and
use it to supply excitations to drive the underlying model. The resulting
motion trajectory is stored in the SOURCE_POSITIONS
probe. The
contents of the SOURCE_POSITIONS
probe can then be transferred to
the TARGET_POSITIONS
input probe, using the method syncTargetProbes(artisynth.core.workspace.RootModel)
, to be used as a control input for inverse simulation
when the controller is reenabled. The ability of the controller to then
follow the prescribed trajectory can then be used as a test of its
capability. Likewise, the contents of the COMPUTED_EXCITATIONS
probe can be transferred to the INPUT_EXCITATIONS
probe using
syncExcitationProbes(artisynth.core.workspace.RootModel)
.
The control panel created by addInversePanel(artisynth.core.workspace.RootModel, artisynth.core.inverse.TrackingController)
allows a user to
interactively adjust properties of the controller and its subcomponents, and
provides three buttons (reset probes
, sync excitations
,
and syncTargets
) that call the methods resetProbes(artisynth.core.workspace.RootModel, artisynth.core.inverse.TrackingController, double, double)
,
syncExcitationProbes(artisynth.core.workspace.RootModel)
, and syncTargetProbes(artisynth.core.workspace.RootModel)
.
Modifier and Type | Class and Description |
---|---|
static class |
InverseManager.InverseControlPanel |
static class |
InverseManager.ProbeID
Identifiers for the probes created by this InverseManager
|
Modifier and Type | Field and Description |
---|---|
static boolean |
useLegacyNames |
Constructor and Description |
---|
InverseManager() |
Modifier and Type | Method and Description |
---|---|
static ControlPanel |
addInversePanel(RootModel root,
TrackingController controller)
Creates a control panel for the specified inverse tracking controller,
and then adds it to a root model and positions it to the side of the main
frame.
|
static void |
addProbes(RootModel root,
TrackingController controller,
double duration,
double interval)
Creates an input probe of the type specified by
pid . |
static NumericOutputProbe |
createComputedExcitationsProbe(TrackingController tcon,
java.lang.String filePath,
double startTime,
double stopTime)
Create an output probe that records all of the excitations computed
by a tracking controller.
|
static NumericInputProbe |
createInputProbe(TrackingController tcon,
InverseManager.ProbeID pid,
java.lang.String filePath,
double startTime,
double stopTime)
Create an input probe of the type specified by
pid . |
static ControlPanel |
createInversePanel(TrackingController controller)
Creates a control panel for the specified inverse tracking controller.
|
static NumericOutputProbe |
createOutputProbe(TrackingController tcon,
InverseManager.ProbeID pid,
java.lang.String filePath,
double startTime,
double stopTime,
double interval)
Create an output probe of the type specified by
pid . |
static NumericInputProbe |
findInputProbe(RootModel root,
InverseManager.ProbeID pid)
Searches for a specified input probe within a root model.
|
static TrackingController |
findInverseController(RootModel root)
Searches for an inverse controller within a root model.
|
static ControlPanel |
findInversePanel(RootModel root)
Searches for an inverse control panel within a root model.
|
static NumericOutputProbe |
findOutputProbe(RootModel root,
InverseManager.ProbeID pid)
Searches for a specified output probe within a root model.
|
static Probe |
findProbe(RootModel root,
InverseManager.ProbeID pid)
Searches for a specified probe within a root model.
|
static void |
resetProbes(RootModel root,
TrackingController controller,
double duration,
double interval)
Clears all probes in a root model and then adds a set of probes for
controlling the inverse simulation, as described for
addProbes(artisynth.core.workspace.RootModel, artisynth.core.inverse.TrackingController, double, double) . |
static boolean |
setInputProbeData(RootModel root,
InverseManager.ProbeID pid,
double[] data,
double timeStep)
Sets the data for a specified input probe within a root model, using the
NumericInputProbe method NumericInputProbe.addData(java.io.File, double) . |
static boolean |
setProbeFileName(RootModel root,
InverseManager.ProbeID pid,
java.lang.String filePath)
Sets the attached file name for a specified probe within a root model.
|
static boolean |
syncExcitationProbes(RootModel root)
Locates the
InverseManager.ProbeID.INPUT_EXCITATIONS probe and
InverseManager.ProbeID.COMPUTED_EXCITATIONS probe
within a root model and copies the contents of the latter to the
former. |
static boolean |
syncTargetProbes(RootModel root)
Locates the
InverseManager.ProbeID.TARGET_POSITIONS probe and
InverseManager.ProbeID.SOURCE_POSITIONS probe
within a root model and copies the contents of the latter to the former. |
public static TrackingController findInverseController(RootModel root)
null
.root
- root model in which to search for the controllernull
public static ControlPanel createInversePanel(TrackingController controller)
controller
- controller to create the panel forpublic static ControlPanel addInversePanel(RootModel root, TrackingController controller)
controller
- controller to create the panel forroot
- root model to add the panel topublic static ControlPanel findInversePanel(RootModel root)
null
.root
- root model in which to search for the panelnull
public static void addProbes(RootModel root, TrackingController controller, double duration, double interval)
pid
.
/**
Adds a set of input and output probes to a root model, for use in
controlling inverse simulation. A description of the created probes is
given in the documentation header for this class. 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.root
- root model to which the probes should be addedcontroller
- inverse controller for which the probes should be
createdduration
- time duration for each probeinterval
- update interval for the output probespublic static NumericOutputProbe findOutputProbe(RootModel root, InverseManager.ProbeID pid)
null
.root
- root model in which to search for the probepid
- probe identifiernull
public static Probe findProbe(RootModel root, InverseManager.ProbeID pid)
null
.root
- root model in which to search for the probepid
- probe identifiernull
public static NumericInputProbe findInputProbe(RootModel root, InverseManager.ProbeID pid)
null
.root
- root model in which to search for the probepid
- probe identifiernull
public static boolean setProbeFileName(RootModel root, InverseManager.ProbeID pid, java.lang.String filePath)
false
.root
- root model in which to search for the probepid
- probe identifierfilePath
- file name to be settrue
if the probe was found and the file was renamedpublic static boolean setInputProbeData(RootModel root, InverseManager.ProbeID pid, double[] data, double timeStep)
NumericInputProbe
method NumericInputProbe.addData(java.io.File, double)
. The
probe is also set be ``active''. The method searches for the probe, and
if it doesn't find it, returns false
.root
- root model in which to search for the probepid
- probe identifierdata
- array specifiying the input datatimeStep
- time step associated with the data; if set
to NumericProbeBase.EXPLICIT_TIME
, the times are
set explicitly within the datatrue
if the probe was found and the data was setpublic static boolean syncTargetProbes(RootModel root)
InverseManager.ProbeID.TARGET_POSITIONS
probe and
InverseManager.ProbeID.SOURCE_POSITIONS
probe
within a root model and copies the contents of the latter to the former.
If either probe is not found, the method does nothing and returns false.root
- root model in which probes should be locatedtrue
if the probes were found and synchronizedpublic static boolean syncExcitationProbes(RootModel root)
InverseManager.ProbeID.INPUT_EXCITATIONS
probe and
InverseManager.ProbeID.COMPUTED_EXCITATIONS
probe
within a root model and copies the contents of the latter to the
former. If either probe is not found, the method does nothing and
returns false.root
- root model in which probes should be locatedtrue
if the probes were found and synchronizedpublic static void resetProbes(RootModel root, TrackingController controller, double duration, double interval)
addProbes(artisynth.core.workspace.RootModel, artisynth.core.inverse.TrackingController, double, double)
.root
- root model to which the probes should be addedcontroller
- inverse controller for which the probes should be
createdduration
- time duration for each probeinterval
- update interval for the output probespublic static NumericInputProbe createInputProbe(TrackingController tcon, InverseManager.ProbeID pid, java.lang.String filePath, double startTime, double stopTime)
pid
.tcon
- tracking controller to create the probe forpid
- specifies the type of input probefilePath
- file associated with the probe, or null
if nonestartTime
- probe start timestopTime
- probe stop timepublic static NumericOutputProbe createOutputProbe(TrackingController tcon, InverseManager.ProbeID pid, java.lang.String filePath, double startTime, double stopTime, double interval)
pid
.tcon
- tracking controller to create the probe forpid
- specifies the type of output probefilePath
- file associated with the probe, or null
if nonestartTime
- probe start timestopTime
- probe stop timeinterval
- probe update interval. or -1 to request updating
with the simulation time steppublic static NumericOutputProbe createComputedExcitationsProbe(TrackingController tcon, java.lang.String filePath, double startTime, double stopTime)
tcon
- tracking controller to create the probe forfilePath
- file associated with the probe, or null
if nonestartTime
- probe start timestopTime
- probe stop time