@ThreadSafe public class ThresholdDetector extends TrajectoryActor
Detects Joint
sub-transform threshold crossings.
The current implementation watches the TXEM component at txemIndex
of the first bound joint subtransform, and calls crossedThreshold(double, double, int)
on any update where lastXform
satisfied checkBounds(double)
but the new value does not.
Copyright (C) 2008 Marsette A. Vona, III
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
cvsid |
static java.lang.String |
FMT
printf number format
|
protected vona.math.RX[] |
lastXform
The most recently read (since most recent
bind(java.lang.Object...) or activate() ) TrajectoryActor.xform , or null if none. |
protected double[] |
limit
bounds for watched TXEM component, NaN if none
|
static int |
LOWER
limit categories |
protected boolean |
printFullPaths
controls output of default impl of
crossedThreshold(double, double, int) |
protected vona.math.RX |
tempRX
temp space
|
protected int |
txemIndex
The index of the watched TXEM component, or -1 to use first DoF index
of corresponding bound Joint.
|
static int |
UPPER
limit categories |
active, clock, joint, slackID, wasOnlySetChangedGoalComponents, xform, xformID
Constructor and Description |
---|
ThresholdDetector(vona.time.Clock clock,
double min,
double max,
int txemIndex)
Makes a new threshold detector.
|
ThresholdDetector(double min,
double max)
Makes a new threshold detector using a default
Clock
(wall-clock time) and first DoF index of first bound Joint. |
ThresholdDetector(double min,
double max,
int txemIndex)
Makes a new threshold detector using a default
Clock
(wall-clock time). |
Modifier and Type | Method and Description |
---|---|
void |
activate()
Enable this TrajectoryActor for scheduling by the update thread.
|
int |
bind(java.lang.Object... specs)
Fill the set of transforms which this TrajectoryActor reads/writes, in
order.
|
int |
checkBounds(double value)
|
protected void |
crossedThreshold(double lastValue,
double currentValue,
int bound)
Called when a threshold has been crossed.
|
void |
enablePrintFullPaths(boolean enable)
set
printFullPaths |
boolean |
needsUpdate()
Called by the update thread when this TrajectoryActor is active to
check whether
TrajectoryActor.update() needs to be called soon. |
void |
unbind()
Clear the set of transforms which this TrajectoryActor reads/writes.
|
void |
update()
Read/write transform state from/to model.
|
checkBindings, clampXForms, compareXFormsToModel, deactivate, getBoundJoint, getBoundXForm, getConstrainedInterpolationType, getDefaultXForm, getNumBindings, getOriginalUnsetGoal, getUnconstrainedInterpolationType, isActive, modelStateChanged, modelStructureChanged, onlySetChangedGoalComponents, readXFormsFromModel, writeXFormsToModel
private static final java.lang.String cvsid
public static final int LOWER
limit
categoriespublic static final int UPPER
limit
categoriespublic static final java.lang.String FMT
protected vona.math.RX[] lastXform
The most recently read (since most recent bind(java.lang.Object...)
or activate()
) TrajectoryActor.xform
, or null if none.
protected final int txemIndex
The index of the watched TXEM component, or -1 to use first DoF index of corresponding bound Joint.
protected final double[] limit
protected boolean printFullPaths
crossedThreshold(double, double, int)
protected final vona.math.RX tempRX
public ThresholdDetector(vona.time.Clock clock, double min, double max, int txemIndex)
Makes a new threshold detector.
public ThresholdDetector(double min, double max, int txemIndex)
Makes a new threshold detector using a default Clock
(wall-clock time).
public ThresholdDetector(double min, double max)
Makes a new threshold detector using a default Clock
(wall-clock time) and first DoF index of first bound Joint.
public void activate()
Enable this TrajectoryActor for scheduling by the update thread.
This impl extends superclass impl to unset lastXform
.
activate
in class TrajectoryActor
public int bind(java.lang.Object... specs)
Fill the set of transforms which this TrajectoryActor reads/writes, in order.
This impl extends superclass impl to un-set lastXform
.
bind
in class TrajectoryActor
specs
- a set of Joint
sub-transform specifiers, in order,
each of the the form (joint, name, or path, sub-transform
ID...). If no sub-transform IDs are given then TrajectoryActor.getDefaultXForm()
is implied. If more than one sub-transform ID is given
then more than one binding is specified.public void unbind()
Clear the set of transforms which this TrajectoryActor reads/writes.
This impl extends superclass impl to deallocate lastXform
.
unbind
in class TrajectoryActor
public void update()
Read/write transform state from/to model.
This is called automatically by the update thread whenever this TrajectoryActor is active. See class header doc for details.
This impl does TrajectoryActor.readXFormsFromModel()
. Then, if there is at
least one bound transform, checks for threshold crossing, and calls crossedThreshold(double, double, int)
if so.
update
in class TrajectoryActor
public int checkBounds(double value)
public boolean needsUpdate()
Called by the update thread when this TrajectoryActor is active to
check whether TrajectoryActor.update()
needs to be called soon.
This impl always returns true.
needsUpdate
in class TrajectoryActor
public void enablePrintFullPaths(boolean enable)
printFullPaths
protected void crossedThreshold(double lastValue, double currentValue, int bound)
Called when a threshold has been crossed.
Default impl prints a message to System.out.