@ThreadSafe public class InteractorDriver extends TrajectoryDriver
Drives a Joint
sub-transform trajectory from an InteractorDriver.JointInteractor
.
Copyright (C) 2008 Marsette A. Vona, III
Modifier and Type | Class and Description |
---|---|
protected class |
InteractorDriver.JointInteractor
Special
RXSInteractor for manipulating Joint
sub-transforms. |
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
cvsid |
static double |
DEF_MIN_UPDATE_TIME
default value for
getMinUpdateTime() in TrajectoryActor.clock time |
protected boolean |
driveFullGoal
whether to not
onlySetChangedGoalComponents() |
InteractorDriver.JointInteractor |
jointInteractor
the interactor
|
vona.math.RXSInterpolator |
jointInterpolator
the interpolator
|
protected vona.math.RX |
manipulationToGroundRX
An arbitrary rigid transform taking
RXSInteractor manipulation
frame coordinates to Linkage ground frame. |
protected vona.math.RX |
restoreRX
the original
Joint sub-transform state at activate() |
protected vona.math.RX |
subFrameCMT
Temp storage for transform taking the parent frame of the
manipulated
Joint sub-transform to world frame. |
lastUpdateTime
active, clock, joint, slackID, wasOnlySetChangedGoalComponents, xform, xformID
Constructor and Description |
---|
InteractorDriver()
Makes a new interactor driver using a default
Clock (wall-clock
time). |
InteractorDriver(vona.time.Clock clock)
makes a new interactor driver
|
Modifier and Type | Method and Description |
---|---|
void |
activate()
extends superclass impl to
updateInteractor() and enable it |
int |
bind(java.lang.Object... specs)
Fill the set of transforms which this TrajectoryActor reads/writes, in
order.
|
protected void |
checkBindings()
Check that the
Joint of each binding is still present. |
protected boolean |
compareXFormsInNeedsUpdate()
|
void |
deactivate()
extends superclass impl to disable
jointInteractor |
boolean |
getDriveFullGoal()
get
driveFullGoal |
vona.ui.RXSInteractor |
getInteractor()
get
jointInteractor |
vona.math.RXSInterpolator |
getInterpolator()
|
double |
getMinUpdateTime()
Get the minimum time in
TrajectoryActor.clock time between calls to TrajectoryDriver.needsUpdate() which return true. |
protected vona.math.RX |
getOriginalUnsetGoal(int i)
Get the original goal transform to use for comparison purposes in
TrajectoryActor.writeXFormsToModel() . |
void |
modelStructureChanged()
Called by the update thread when this TrajectoryActor is active after
the model structure changes.
|
protected boolean |
onlySetChangedGoalComponents()
Whether to only set changed goal transform components in
TrajectoryActor.writeXFormsToModel() . |
boolean |
restore()
restore(boolean) without jumping |
boolean |
restore(boolean jump)
Restore the
Joint sub-transform to its original state at activate() . |
void |
setDriveFullGoal(boolean driveFullGoal)
set
driveFullGoal |
void |
setManipulationToGround(vona.math.RX rx,
boolean invert)
Set the
manipulationToGroundRX transform by copy. |
void |
unbind()
extends superclass impl to
updateInteractor() after unbinding |
protected void |
updateInteractor()
|
void |
updateManipulationFrameRX()
Update
jointInteractor 's "manipulation"-to-"world"
transform. |
protected void |
updateXForms()
Update the
TrajectoryActor.xform values from their driving source. |
needsUpdate, update, updateXFormsInNeedsUpdate
clampXForms, compareXFormsToModel, getBoundJoint, getBoundXForm, getConstrainedInterpolationType, getDefaultXForm, getNumBindings, getUnconstrainedInterpolationType, isActive, modelStateChanged, readXFormsFromModel, writeXFormsToModel
private static final java.lang.String cvsid
public static final double DEF_MIN_UPDATE_TIME
getMinUpdateTime()
in TrajectoryActor.clock
timepublic final InteractorDriver.JointInteractor jointInteractor
public final vona.math.RXSInterpolator jointInterpolator
protected boolean driveFullGoal
onlySetChangedGoalComponents()
protected final vona.math.RX restoreRX
Joint
sub-transform state at activate()
protected final vona.math.RX manipulationToGroundRX
An arbitrary rigid transform taking RXSInteractor
manipulation
frame coordinates to Linkage
ground frame.
This is one component of the manipulation frame to RXSInteractor
world frame transform, see updateManipulationFrameRX()
for details.
Display
uses an InteractorDriver to implement joint
manipulation, and tracks manipulationToGroundRX to the rigid part of the
navigation view-to-world transform. It also tracks the RXSInteractor
world-to-canvas scale to the product of the Display
world-to-view and view-to-canvas scales.
protected final vona.math.RX subFrameCMT
Temp storage for transform taking the parent frame of the
manipulated Joint
sub-transform to world frame.
Used in updateManipulationFrameRX()
.
public InteractorDriver(vona.time.Clock clock)
public InteractorDriver()
Makes a new interactor driver using a default Clock
(wall-clock
time).
public int bind(java.lang.Object... specs)
Fill the set of transforms which this TrajectoryActor reads/writes, in order.
This impl extends the superclass impl to ensure that at most one transform is bound.
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()
updateInteractor()
after unbindingunbind
in class TrajectoryActor
public void activate()
updateInteractor()
and enable itactivate
in class TrajectoryDriver
public void deactivate()
jointInteractor
deactivate
in class TrajectoryDriver
public void modelStructureChanged()
Called by the update thread when this TrajectoryActor is active after the model structure changes.
Default impl calls TrajectoryActor.checkBindings()
.
This impl chains to the superclass impl and then does updateInteractor()
.
modelStructureChanged
in class TrajectoryActor
public boolean restore(boolean jump)
Restore the Joint
sub-transform to its original state at activate()
.
public boolean restore()
restore(boolean)
without jumpingprotected void checkBindings()
Check that the Joint
of each binding is still present.
Extends superclass impl with additional checks.
checkBindings
in class TrajectoryActor
java.lang.IllegalStateException
- if manipulating mobility and either goal
becomes setjava.lang.IllegalStateException
- if manipulating mobility and joint
becomes a closurejava.lang.IllegalStateException
- if manipulating posture and target
becomes setprotected void updateXForms()
Update the TrajectoryActor.xform
values from their driving source.
This impl reads the current transform from jointInteractor
.
updateXForms
in class TrajectoryDriver
protected boolean compareXFormsInNeedsUpdate()
Whether to TrajectoryActor.compareXFormsToModel()
in TrajectoryDriver.needsUpdate()
.
Default impl returns true.
This impl returns false.
compareXFormsInNeedsUpdate
in class TrajectoryDriver
protected void updateInteractor()
InteractorDriver.JointInteractor.bind(msim.model.Joint, int)
or InteractorDriver.JointInteractor.unbind()
jointInteractor
, as appropriate.
We also re-read TrajectoryActor.xform
(and restoreRX
if the joint
or transform id changed) from the bound sub-transform, and we jump the
interactor to this initial state.
public double getMinUpdateTime()
Get the minimum time in TrajectoryActor.clock
time between calls to TrajectoryDriver.needsUpdate()
which return true.
Default impl returns 0.
This impl returns DEF_MIN_UPDATE_TIME
.
getMinUpdateTime
in class TrajectoryDriver
public vona.ui.RXSInteractor getInteractor()
jointInteractor
public vona.math.RXSInterpolator getInterpolator()
public void setManipulationToGround(vona.math.RX rx, boolean invert)
Set the manipulationToGroundRX
transform by copy.
invert
- whether to invert manipulationToGroundRX
after
setting itpublic void updateManipulationFrameRX()
Update jointInteractor
's "manipulation"-to-"world"
transform.
The interactor's manipulation frame is actually the Display
view frame, and the interactor's "world" frame is the
parent frame of the manipulated transform, which will in general be a
sub-frame of the manipulated joint. The full transform chain in order
is
manipulationToGroundRX
by Display
Joint.getSubFrameRX(int, RX)
)This is called automatically for all active InteractorDrivers whose interactor is currently controlling in manipulation frame by the update thread.
public void setDriveFullGoal(boolean driveFullGoal)
driveFullGoal
public boolean getDriveFullGoal()
driveFullGoal
protected boolean onlySetChangedGoalComponents()
Whether to only set changed goal transform components in TrajectoryActor.writeXFormsToModel()
.
Also see TrajectoryActor.getOriginalUnsetGoal(int)
.
Default impl returns false.
This impl returns the opposite of driveFullGoal
.
onlySetChangedGoalComponents
in class TrajectoryActor
protected vona.math.RX getOriginalUnsetGoal(int i)
Get the original goal transform to use for comparison purposes in
TrajectoryActor.writeXFormsToModel()
.
This is used to implement TrajectoryActor.onlySetChangedGoalComponents()
.
Return null to use the current value of the goal transform of TrajectoryActor.joint
i.
Default impl returns null.
This impl returns restoreRX
.
getOriginalUnsetGoal
in class TrajectoryActor