brbrain
Class PoseSequenceGUI

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.Box
                  extended by brbrain.GUI
                      extended by brbrain.PoseGUI
                          extended by brbrain.PoseSequenceGUI
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class PoseSequenceGUI
extends PoseGUI

GUI for PoseSequences.

The GUI displays the current actual pose, which may be different from any pose in the sequence.

A current sequence pose is also always maintained (getCurrentSequencePose(), getCurrentSequenceIndex()), which is one of the poses in the sequence, if any.

It is legal to create a new PoseSequenceGUI with an empty sequence, but all of the mutators will fail until one of the insertPose*() methods is called at least once.

It is not legal to remove the last remaining pose in a sequence.

insertPose*(), removePose(), previousPose(), and nextPose() all synchronize the current actual pose values with the current sequence pose values, and set a flag indicating that the hardware will be updated with the new current actual pose on the next sync.

User edits to the current actual pose, as well as syncs thereof from the hardware, will be discarded on the next removePose(), previousPose(), or nextPose(), but will be saved as the new current sequence pose by insertPose*().

A morph time in milliseconds is maintained (setMSMorphTime(int)/getMSMorphTime()) which, if positive, is used to compute the AX12Register.AX12_MOVING_SPEED of newly inserted poses to achive the specified morph time from the previous pose in the sequence, if any. If there is no previous pose, or if msMorphTime is non-positive, the moving speed of all dynamixels in newly added poses is set to defaultMovingSpeed.

A speed factor (setSpeedFactor(float)/getSpeedFactor()) is also maintained which, if not 1.0, multiplies the AX12Register.AX12_MOVING_SPEED of the current actual pose whenever it is updated from the current sequence pose, and inversely for updates in the opposite direction.

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.

Author:
Marsette (Marty) A. Vona, III
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class brbrain.PoseGUI
PoseGUI.DynamixelBox, PoseGUI.RegisterNameBox, PoseGUI.ValueBox
 
Nested classes/interfaces inherited from class brbrain.GUI
GUI.RemoveTask
 
Nested classes/interfaces inherited from class javax.swing.Box
javax.swing.Box.AccessibleBox, javax.swing.Box.Filler
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  javax.swing.JCheckBox autoSetSpeedCheckBox
           
protected  javax.swing.JTextField currentIndexField
           
protected  int currentSequenceIndex
          the current sequence pose index, zero based, or -1 if none
protected  Pose currentSequencePose
          the current sequence pose or null if none
protected  javax.swing.JLabel currentSizeLabel
           
private static java.lang.String cvsid
           
static int DEF_MOVING_SPEED
          default defaultMovingSpeed
static int DEF_MS_MORPH_TIME
          default msMorphTime
protected  int defaultMovingSpeed
          default moving speed for inserted poses
protected  javax.swing.JTextField defaultMovingSpeedField
           
protected  javax.swing.JButton insAfterButton
           
protected  javax.swing.JButton insBeforeButton
           
protected  javax.swing.JTextField morphTimeField
           
protected  int msMorphTime
          current morph time in milliseconds for inserted poses
protected  javax.swing.JButton nextButton
           
protected  javax.swing.JButton pauseButton
           
protected  SequencePlaybackController playbackController
          our sequence playback controller
protected  javax.swing.JButton playButton
           
protected  boolean playing
          whether we're currently in play mode
 PoseSequence poseSequence
          the sequence
protected  javax.swing.JButton prevButton
           
protected  javax.swing.JButton removeButton
           
protected  javax.swing.JButton rewindButton
           
protected  java.util.ListIterator<Pose> sequenceIterator
          iterator we always use for all mutations
protected  javax.swing.JCheckBox setGoalFromPresentCheckBox
           
protected  float speedFactor
          the current speed factor, initially 1.0
protected  javax.swing.JTextField speedFactorField
           
protected  javax.swing.JCheckBox speedOverrideCheckBox
           
protected  javax.swing.JButton updateButton
           
 
Fields inherited from class brbrain.PoseGUI
adcValue, AUTO_SYNC_THREAD_GRANULARITY_MS, autoSyncAddList, autoSyncBRBrain, autoSyncCheckBox, autoSyncEnableWrite, autoSyncEnableWriteCheckBox, autoSyncList, autoSyncLock, autoSyncMinUpdatePeriodMS, autoSyncMinUpdatePeriodMSField, autoSyncSaveAndRestoreFormat, autoSyncSaveAndRestoreFormatsCheckBox, autoSyncSetFormats, autoSyncSetFormatsCheckBox, autoSyncThread, axIDs, DEF_SYNC_ENABLE_WRITE, DEF_SYNC_MIN_UPDATE_PERIOD_MS, DEF_SYNC_SAVE_AND_RESTORE_FORMAT, DEF_SYNC_SET_FORMAT, defSyncBRBrain, defSyncEnableWrite, defSyncMinUpdatePeriodMS, defSyncSaveAndRestoreFormats, defSyncSetFormats, dynamixelBoxes, dynamixelNames, enableWriteCheckBox, estopButton, floatFormat, lastSyncStartTimeMS, lastSyncTimeMS, lastUpdatePeriodMS, negVoltageLabel, numDynamixels, numRegisters, numSyncs, pose, poseLock, posVoltageLabel, readAXIDSave, readLengthSave, readNum, readStart, readStartSave, REFRESH_PERIOD_MS, refreshList, refreshLock, refreshPending, refreshThread, registerAxis, registerNameBox, registers, saveAndRestoreFormatsCheckBox, setFormatsCheckBox, STRUT, syncButton, syncReadData, syncText, syncWriteData, syncWritePending, thermLabel, useNaturalUnits, VALUE_FIELD_HEIGHT, VALUE_FIELD_WIDTH, valueBoxes, writeAXIDSave, writeLengthSave, writeNum, writeStart, writeStartSave
 
Fields inherited from class brbrain.GUI
lastFrame, MAX_SPLIT_LABEL_CHARS
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
PoseSequenceGUI(PoseSequence poseSequence, int registerAxis, java.lang.String[] dynamixelNames, boolean showRegisterNames, boolean[] registerEditable, boolean enableShowEstop, boolean showADCs, boolean showManualSync, boolean showAutoSync)
          Make a new GUI for an existing sequence.
PoseSequenceGUI(PoseSequence poseSequence, int registerAxis, java.lang.String[] dynamixelNames, boolean showRegisterNames, boolean editable, boolean enableShowEstop, boolean showADCs, boolean showManualSync, boolean showAutoSync)
          make a gui where everything is either editable or not
 
Method Summary
protected  void addGUI(GUI gui)
          adds the current actual pose gui with a titled border
protected  void applySpeedFactor()
          Update the speed of the current actual pose from that of the current sequence pose, if any, according to speedFactor.
protected  void didSync(Pose pose, BRBrain brBrain, boolean didWrite, boolean didRead, boolean setFormats, boolean savedAndRestoredFormat, int syncNum, long startTime, long duration)
          Calls SequencePlaybackController.controlPlayback(brbrain.PoseSequenceGUI, brbrain.Pose, brbrain.Pose, int) as necessary.
 int getCurrentSequenceIndex()
          get current sequence index or -1 if none
 Pose getCurrentSequencePose()
          get current sequence pose or null if none
 int getDefaultMovingSpeed()
          get the default moving speed for inserted poses
 int getMSMorphTime()
          get the morph time in milliseconds for inserted poses
 float getSpeedFactor()
          get the current speed factor
protected  void handleEditCurrentIndex(java.lang.String s)
          handle edits to current index field
protected  void handleEditDefaultMovingSpeed(java.lang.String s)
          handle edits to default moving speed field
protected  void handleEditMorphTime(java.lang.String s)
          handle edits to morph time field
protected  void handleEditSpeedFactor(java.lang.String s)
          handle edits to speed factor field
 boolean hasNextPose()
          check if there are more poses after the current one in the sequence
 boolean hasPreviousPose()
          check if there are more poses before the current one in the sequence
protected  Pose insertPose(Pose prevSequencePose)
          common insert impl
 Pose insertPoseAfter()
          Inserts the current actual pose as a new pose in the sequence after the current sequence pose (or as the first in the sequence).
 Pose insertPoseBefore()
          similar to insertPoseAfter()
 boolean isPlaying()
          check if in play mode
 Pose nextPose()
          Move to the next pose in the sequence.
 Pose peekNextPose()
          return the next pose, null if none, but don't change to it
 Pose peekPreviousPose()
          return the previous pose, null if none, but don't change to it
 Pose previousPose()
          Move to the previous pose in the sequence.
protected  void refresh()
          refresh the gui components
 Pose removePose()
          Removes the current sequence pose.
 Pose rewindToFirstPose()
          rewind to the first pose in sequence, if any
 int setCurrentSequenceIndex(int currentSequenceIndex)
          Covers setCurrentSequenceIndex(int, boolean), always writes to hardware.
 int setCurrentSequenceIndex(int currentSequenceIndex, boolean writeToHardware)
          Move to the specified pose in the sequence.
 int setDefaultMovingSpeed(int defaultMovingSpeed)
          set the default moving speed for inserted poses
 int setMSMorphTime(int msMorphTime)
          set the morph time in milliseconds for inserted poses
 SequencePlaybackController setSequencePlaybackController(SequencePlaybackController playbackController)
          set the sequence playback controller
protected  void setSpeed(Pose prevSequencePose, Pose currentSequencePose)
          set speed of currentSequencePose
 float setSpeedFactor(float speedFactor)
          set the current speed factor.
protected  void updateCurrentActualPose()
          Update the current actual pose from the current sequence pose and speedFactor.
 void updateCurrentSequencePose()
          Update the current sequence pose from the current actual pose.
 
Methods inherited from class brbrain.PoseGUI
addToRefreshList, autoSync, autoSync, autoSync, autoSync, consEditable, doEstop, getPose, getSyncStats, handleEditAutoSync, refreshFromPose, removeFromRefreshList, setPose, setSyncDefaults, setSyncFormats, setSyncFormats, setUseNaturalUnits, setUseNaturalUnits, sync, sync, sync, useAllLabelledNaturalUnits
 
Methods inherited from class brbrain.GUI
addRemoveTask, addTitledBorder, addTitledBorder, dbgLayout, dbgLayout, makeSplitLabel, otherAxis, wrapInFrame, wrapInFrame
 
Methods inherited from class javax.swing.Box
createGlue, createHorizontalBox, createHorizontalGlue, createHorizontalStrut, createRigidArea, createVerticalBox, createVerticalGlue, createVerticalStrut, getAccessibleContext, paintComponent, setLayout
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

cvsid

private static final java.lang.String cvsid
See Also:
Constant Field Values

DEF_MS_MORPH_TIME

public static final int DEF_MS_MORPH_TIME
default msMorphTime

See Also:
Constant Field Values

DEF_MOVING_SPEED

public static final int DEF_MOVING_SPEED
default defaultMovingSpeed

See Also:
Constant Field Values

poseSequence

public final PoseSequence poseSequence
the sequence


sequenceIterator

protected java.util.ListIterator<Pose> sequenceIterator
iterator we always use for all mutations


currentSequencePose

protected Pose currentSequencePose
the current sequence pose or null if none


currentSequenceIndex

protected int currentSequenceIndex
the current sequence pose index, zero based, or -1 if none


msMorphTime

protected int msMorphTime
current morph time in milliseconds for inserted poses


defaultMovingSpeed

protected int defaultMovingSpeed
default moving speed for inserted poses


speedFactor

protected float speedFactor
the current speed factor, initially 1.0


playing

protected boolean playing
whether we're currently in play mode


playbackController

protected SequencePlaybackController playbackController
our sequence playback controller


prevButton

protected javax.swing.JButton prevButton

rewindButton

protected javax.swing.JButton rewindButton

pauseButton

protected javax.swing.JButton pauseButton

playButton

protected javax.swing.JButton playButton

nextButton

protected javax.swing.JButton nextButton

currentIndexField

protected javax.swing.JTextField currentIndexField

currentSizeLabel

protected javax.swing.JLabel currentSizeLabel

insBeforeButton

protected javax.swing.JButton insBeforeButton

updateButton

protected javax.swing.JButton updateButton

removeButton

protected javax.swing.JButton removeButton

insAfterButton

protected javax.swing.JButton insAfterButton

autoSetSpeedCheckBox

protected javax.swing.JCheckBox autoSetSpeedCheckBox

setGoalFromPresentCheckBox

protected javax.swing.JCheckBox setGoalFromPresentCheckBox

speedFactorField

protected javax.swing.JTextField speedFactorField

defaultMovingSpeedField

protected javax.swing.JTextField defaultMovingSpeedField

speedOverrideCheckBox

protected javax.swing.JCheckBox speedOverrideCheckBox

morphTimeField

protected javax.swing.JTextField morphTimeField
Constructor Detail

PoseSequenceGUI

public PoseSequenceGUI(PoseSequence poseSequence,
                       int registerAxis,
                       java.lang.String[] dynamixelNames,
                       boolean showRegisterNames,
                       boolean[] registerEditable,
                       boolean enableShowEstop,
                       boolean showADCs,
                       boolean showManualSync,
                       boolean showAutoSync)

Make a new GUI for an existing sequence.

If the sequence is not empty then its first pose becomes the current sequence pose and is written to the hardware on the next sync.

See class header doc for additional details.


PoseSequenceGUI

public PoseSequenceGUI(PoseSequence poseSequence,
                       int registerAxis,
                       java.lang.String[] dynamixelNames,
                       boolean showRegisterNames,
                       boolean editable,
                       boolean enableShowEstop,
                       boolean showADCs,
                       boolean showManualSync,
                       boolean showAutoSync)
make a gui where everything is either editable or not

Method Detail

handleEditCurrentIndex

protected void handleEditCurrentIndex(java.lang.String s)
handle edits to current index field


handleEditSpeedFactor

protected void handleEditSpeedFactor(java.lang.String s)
handle edits to speed factor field


handleEditMorphTime

protected void handleEditMorphTime(java.lang.String s)
handle edits to morph time field


handleEditDefaultMovingSpeed

protected void handleEditDefaultMovingSpeed(java.lang.String s)
handle edits to default moving speed field


addGUI

protected void addGUI(GUI gui)
adds the current actual pose gui with a titled border

Overrides:
addGUI in class PoseGUI

getCurrentSequenceIndex

public int getCurrentSequenceIndex()
get current sequence index or -1 if none


getCurrentSequencePose

public Pose getCurrentSequencePose()
get current sequence pose or null if none


setMSMorphTime

public int setMSMorphTime(int msMorphTime)
set the morph time in milliseconds for inserted poses


getMSMorphTime

public int getMSMorphTime()
get the morph time in milliseconds for inserted poses


setDefaultMovingSpeed

public int setDefaultMovingSpeed(int defaultMovingSpeed)
set the default moving speed for inserted poses


getDefaultMovingSpeed

public int getDefaultMovingSpeed()
get the default moving speed for inserted poses


insertPoseAfter

public Pose insertPoseAfter()

Inserts the current actual pose as a new pose in the sequence after the current sequence pose (or as the first in the sequence).

The goal position of the inserted pose will be set from the present position of the current actual pose iff the corresponding GUI checkbox is selected.

If there is a pose before the newly inserted pose, the newly inserted pose AX12Register.AX12_MOVING_SPEED will be set to achieve the current msMorphTime, if positive.

The newly inserted pose is written to the hardware on the next sync, and becomes the new current sequence pose.


insertPoseBefore

public Pose insertPoseBefore()
similar to insertPoseAfter()


insertPose

protected Pose insertPose(Pose prevSequencePose)
common insert impl


setSpeed

protected void setSpeed(Pose prevSequencePose,
                        Pose currentSequencePose)
set speed of currentSequencePose


removePose

public Pose removePose()

Removes the current sequence pose.

The new current sequence pose becomes the pose after the one which was removed, if any, else the last pose in the sequence, and is written to the hardware on the next sync.

Throws:
java.lang.IllegalStateException - if the sequence currently has fewer than two poses

updateCurrentActualPose

protected void updateCurrentActualPose()

Update the current actual pose from the current sequence pose and speedFactor.


updateCurrentSequencePose

public void updateCurrentSequencePose()

Update the current sequence pose from the current actual pose.


nextPose

public Pose nextPose()

Move to the next pose in the sequence.

The current sequence pose is incremented, and is written to the hardware on the next sync.

Throws:
java.lang.IllegalStateException - if the current sequence pose is the last in the sequence or if the sequence is empty

previousPose

public Pose previousPose()

Move to the previous pose in the sequence.

The current sequence pose is decremented, and is written to the hardware on the next sync.

Throws:
java.lang.IllegalStateException - if the current sequence pose is the first in the sequence or if the sequence is empty

rewindToFirstPose

public Pose rewindToFirstPose()
rewind to the first pose in sequence, if any


setCurrentSequenceIndex

public int setCurrentSequenceIndex(int currentSequenceIndex,
                                   boolean writeToHardware)

Move to the specified pose in the sequence.

The current sequence pose is set to the one with the specified zero-based index, and is written to the hardware on the next sync unless otherwise specified.

Throws:
java.lang.IllegalStateException - if the specified index is negative or greater than or equal to the size of the sequence

setCurrentSequenceIndex

public int setCurrentSequenceIndex(int currentSequenceIndex)

Covers setCurrentSequenceIndex(int, boolean), always writes to hardware.


hasNextPose

public boolean hasNextPose()
check if there are more poses after the current one in the sequence


peekNextPose

public Pose peekNextPose()
return the next pose, null if none, but don't change to it


hasPreviousPose

public boolean hasPreviousPose()
check if there are more poses before the current one in the sequence


peekPreviousPose

public Pose peekPreviousPose()
return the previous pose, null if none, but don't change to it


getSpeedFactor

public float getSpeedFactor()
get the current speed factor


isPlaying

public boolean isPlaying()
check if in play mode


setSequencePlaybackController

public SequencePlaybackController setSequencePlaybackController(SequencePlaybackController playbackController)
set the sequence playback controller


setSpeedFactor

public float setSpeedFactor(float speedFactor)

set the current speed factor.

Updates all the AX12Register.AX12_MOVING_SPEED values of the current actual pose appropriately.

Returns:
the old speed factor
Throws:
java.lang.IllegalArgumentException - if speedFactor is not positive

applySpeedFactor

protected void applySpeedFactor()

Update the speed of the current actual pose from that of the current sequence pose, if any, according to speedFactor.


refresh

protected void refresh()
refresh the gui components

Overrides:
refresh in class PoseGUI

didSync

protected void didSync(Pose pose,
                       BRBrain brBrain,
                       boolean didWrite,
                       boolean didRead,
                       boolean setFormats,
                       boolean savedAndRestoredFormat,
                       int syncNum,
                       long startTime,
                       long duration)

Calls SequencePlaybackController.controlPlayback(brbrain.PoseSequenceGUI, brbrain.Pose, brbrain.Pose, int) as necessary.

Overrides:
didSync in class PoseGUI