@ThreadSafe public abstract class TrajectoryObserver extends TrajectoryActor
Base class for observers of Joint sub-transform trajectories.
Default impl provides for time-threshold and/or motion-threshold
waypoints. Each update() constitutes a waypoint, and waypoints may
also be explicitly recorded via waypoint().
Copyright (C) 2008 Marsette A. Vona, III
| Modifier and Type | Field and Description |
|---|---|
private static java.lang.String |
cvsid |
static double |
DEF_MOTION_THRESHOLD
default
motionThreshold |
static double |
DEF_TIME_THRESHOLD
default
timeThreshold |
protected boolean |
forceWaypointPending
whether a forced waypoint has been requested
|
protected double |
motionThreshold
|
protected double |
timeThreshold
|
protected vona.math.RX[] |
waypointRX
snapshot of
TrajectoryActor.xform at most recent waypoint |
protected double |
waypointTime
TrajectoryActor.clock timestamp of last update() since activation or
NaN if none. |
active, clock, joint, slackID, wasOnlySetChangedGoalComponents, xform, xformID| Constructor and Description |
|---|
TrajectoryObserver()
Makes a new trajectory observer using a default
Clock
(wall-clock time), DEF_TIME_THRESHOLD, and DEF_MOTION_THRESHOLD. |
TrajectoryObserver(double motionThreshold)
Makes a new trajectory observer using a default
Clock
(wall-clock time) and DEF_TIME_THRESHOLD. |
TrajectoryObserver(double motionThreshold,
double timeThreshold)
Makes a new trajectory observer using a default
Clock
(wall-clock time). |
TrajectoryObserver(double motionThreshold,
double timeThreshold,
vona.time.Clock clock)
makes a new trajectory observer
|
| Modifier and Type | Method and Description |
|---|---|
void |
activate()
extends superclass impl to un-set
waypointTime |
int |
bind(java.lang.Object... specs)
Fill the set of transforms which this TrajectoryActor reads/writes, in
order.
|
protected boolean |
compareXFormsToWaypoint()
Compare
waypointRX with TrajectoryActor.xform. |
void |
forceWaypoint()
force generation of at least one waypoint
|
double |
getMotionThreshold()
Get the maximum TXEM component diff for
compareXFormsToWaypoint() or NaN to disable motion-threshold
waypoints. |
double |
getTimeThreshold()
Get the maximum time in
TrajectoryActor.clock time between calls to needsUpdate() which return true, or NaN to disable time-threshold
waypoints. |
boolean |
needsUpdate()
Called by the update thread when this TrajectoryActor is active to
check whether
TrajectoryActor.update() needs to be called soon. |
void |
setMotionThreshold(double threshold)
Set
motionThreshold. |
void |
setTimeThreshold(double threshold)
Set
timeThreshold. |
void |
unbind()
Clear the set of transforms which this TrajectoryActor reads/writes.
|
void |
update()
Read/write transform state from/to model.
|
void |
waypoint()
Saves a new waypoint.
|
protected abstract void |
waypointChanged()
Hook called when a new waypoint is generated in
update(). |
checkBindings, clampXForms, compareXFormsToModel, deactivate, getBoundJoint, getBoundXForm, getConstrainedInterpolationType, getDefaultXForm, getNumBindings, getOriginalUnsetGoal, getUnconstrainedInterpolationType, isActive, modelStateChanged, modelStructureChanged, onlySetChangedGoalComponents, readXFormsFromModel, writeXFormsToModelprivate static final java.lang.String cvsid
public static final double DEF_TIME_THRESHOLD
timeThresholdpublic static final double DEF_MOTION_THRESHOLD
motionThresholdprotected volatile double timeThreshold
protected volatile double motionThreshold
protected volatile boolean forceWaypointPending
protected vona.math.RX[] waypointRX
TrajectoryActor.xform at most recent waypointprotected double waypointTime
TrajectoryActor.clock timestamp of last update() since activation or
NaN if none.
public TrajectoryObserver(double motionThreshold,
double timeThreshold,
vona.time.Clock clock)
public TrajectoryObserver(double motionThreshold,
double timeThreshold)
Makes a new trajectory observer using a default Clock
(wall-clock time).
public TrajectoryObserver(double motionThreshold)
Makes a new trajectory observer using a default Clock
(wall-clock time) and DEF_TIME_THRESHOLD.
public TrajectoryObserver()
Makes a new trajectory observer using a default Clock
(wall-clock time), DEF_TIME_THRESHOLD, and DEF_MOTION_THRESHOLD.
public void activate()
waypointTimeactivate in class TrajectoryActorpublic int bind(java.lang.Object... specs)
Fill the set of transforms which this TrajectoryActor reads/writes, in order.
This impl extends superclass impl to allocate waypointRX.
bind in class TrajectoryActorspecs - 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 waypointRX.
unbind in class TrajectoryActorpublic 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 chains to waypoint().
update in class TrajectoryActorpublic void waypoint()
Saves a new waypoint.
Sets waypointTime, does TrajectoryActor.readXFormsFromModel(), copies result to waypointRX and then calls
waypointChanged().
protected abstract void waypointChanged()
Hook called when a new waypoint is generated in update().
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 returns true if
forceWaypointPendingupdate(), and hence no new waypoint, since
the most recent activationgetTimeThreshold() is not NaN and it has been at least this
long since the last update in this activationcompareXFormsToWaypoint() returns false after a fresh TrajectoryActor.readXFormsFromModel()needsUpdate in class TrajectoryActorprotected boolean compareXFormsToWaypoint()
Compare waypointRX with TrajectoryActor.xform.
getMotionThreshold() is NaN or if all
TXEM component diffs are smallerpublic double getTimeThreshold()
Get the maximum time in TrajectoryActor.clock time between calls to needsUpdate() which return true, or NaN to disable time-threshold
waypoints.
Default impl returns timeThreshold.
public void setTimeThreshold(double threshold)
Set timeThreshold.
java.lang.IllegalArgumentException - if threshold is negativepublic double getMotionThreshold()
Get the maximum TXEM component diff for compareXFormsToWaypoint() or NaN to disable motion-threshold
waypoints.
Default impl returns motionThreshold.
public void setMotionThreshold(double threshold)
Set motionThreshold.
java.lang.IllegalArgumentException - if threshold is negativepublic void forceWaypoint()