|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbrbrain.SequencePlaybackController
public class SequencePlaybackController
PoseSequence
playback controller.
The sequence playback controller is installed into a PoseSequenceGUI
and controls initiation, progress, and termination of pose
sequence playback.
This class gives a default implementation which starts playback whenever
there are more poses in the sequence and stops it when the opposite is true.
Playback is advanced from pose to pose in the sequence order whenever the
time deadline for the current pose expires or whenever the actual mechanism
pose is closeEnough(brbrain.Pose, brbrain.Pose)
to the target pose.
Copyright (C) 2007 Marsette A. Vona, III
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Field Summary | |
---|---|
private static java.lang.String |
cvsid
|
static int |
DEF_EPSILON
default epsilon for closeEnough(brbrain.Pose, brbrain.Pose) |
protected int |
epsilon
the epsilon for closeEnough(brbrain.Pose, brbrain.Pose) |
protected long |
expectedDeadlineNS
the expected deadline of the current pose morph |
Constructor Summary | |
---|---|
SequencePlaybackController()
initializes with DEF_EPSILON |
|
SequencePlaybackController(int epsilon)
initializes with a specific epsilon |
Method Summary | |
---|---|
protected boolean |
advancePose(PoseSequenceGUI psg,
Pose currentActualPose,
Pose currentSequencePose,
int currentSequenceIndex,
java.lang.String reason,
boolean deadlineValid,
long currentTimeNS)
Called by startPlayback(brbrain.PoseSequenceGUI, brbrain.Pose, brbrain.Pose, int) and controlPlayback(brbrain.PoseSequenceGUI, brbrain.Pose, brbrain.Pose, int) to
advance to the next pose. |
protected boolean |
closeEnough(Pose currentActualPose,
Pose currentSequencePose)
Compare AX12Register.AX12_PRESENT_POSITION of the current
actual pose to the current sequence pose and return true iff their
L-infinity norm (maximum element abs difference) is less than epsilon . |
boolean |
controlPlayback(PoseSequenceGUI psg,
Pose currentActualPose,
Pose currentSequencePose,
int currentSequenceIndex)
Called by the PoseSequenceGUI to request control of
playback. |
protected boolean |
epsilonEquals(int p,
int q)
Check if the absolute difference between p and q is less than epsilon . |
boolean |
startPlayback(PoseSequenceGUI psg,
Pose currentActualPose,
Pose currentSequencePose,
int currentSequenceIndex)
Called by the PoseSequenceGUI to request initiation of
playback. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final java.lang.String cvsid
public static final int DEF_EPSILON
closeEnough(brbrain.Pose, brbrain.Pose)
protected long expectedDeadlineNS
protected int epsilon
closeEnough(brbrain.Pose, brbrain.Pose)
Constructor Detail |
---|
public SequencePlaybackController(int epsilon)
epsilon
public SequencePlaybackController()
DEF_EPSILON
Method Detail |
---|
public boolean startPlayback(PoseSequenceGUI psg, Pose currentActualPose, Pose currentSequencePose, int currentSequenceIndex)
Called by the PoseSequenceGUI
to request initiation of
playback.
If playback should be initiated, typically this would call advancePose(brbrain.PoseSequenceGUI, brbrain.Pose, brbrain.Pose, int, java.lang.String, boolean, long)
.
See class header doc for behavior of default impl.
public boolean controlPlayback(PoseSequenceGUI psg, Pose currentActualPose, Pose currentSequencePose, int currentSequenceIndex)
Called by the PoseSequenceGUI
to request control of
playback.
Typically this would call advancePose(brbrain.PoseSequenceGUI, brbrain.Pose, brbrain.Pose, int, java.lang.String, boolean, long)
as necessary.
See class header doc for behavior of default impl.
protected boolean advancePose(PoseSequenceGUI psg, Pose currentActualPose, Pose currentSequencePose, int currentSequenceIndex, java.lang.String reason, boolean deadlineValid, long currentTimeNS)
Called by startPlayback(brbrain.PoseSequenceGUI, brbrain.Pose, brbrain.Pose, int)
and controlPlayback(brbrain.PoseSequenceGUI, brbrain.Pose, brbrain.Pose, int)
to
advance to the next pose.
protected boolean closeEnough(Pose currentActualPose, Pose currentSequencePose)
Compare AX12Register.AX12_PRESENT_POSITION
of the current
actual pose to the current sequence pose and return true iff their
L-infinity norm (maximum element abs difference) is less than epsilon
.
protected boolean epsilonEquals(int p, int q)
Check if the absolute difference between p and q is less
than epsilon
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |