edu.nau.cs.scu.testcode
Class MEUSimulatorGUI

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by com.lmco.lmpf.plugin.PluginTab
                      extended by edu.nau.cs.scu.testcode.MEUSimulatorGUI
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class MEUSimulatorGUI
extends com.lmco.lmpf.plugin.PluginTab

This class serves as a basic testing unit for sending MEU style commands to a servo controller unit simulation. This class contains all necessary components for communicating over serial.

Author:
Sam Mallon
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
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
(package private)  java.lang.String[] commands
          A list of the commands that can be sent to a servo controller.
 
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
MEUSimulatorGUI()
          The basic constructor for this simulator GUI.
 
Method Summary
 void cageMode()
          Issues a "Cage Mode" command over the serial communications to a servo controller unit.
static byte calculateChecksum(byte[] command)
          This method calculates the checksum of a command byte packet.
 void disableComm()
          This will stop communications on the current port.
 void disableTorquers()
          Issues a "Disable Torquers" command over the serial communications to a servo controller unit.
 void enableTorquers()
          Issues a "Enable Torquers" command over the serial communications to a servo controller unit.
static void main(java.lang.String[] args)
          This will create a new window and display the MEU simulator.
 void positionMode(double a, double e)
          Issues a "Position Mode" command over the serial communications to a servo controller unit.
 void rateMode(double a, double e)
          Issues a "Rate Mode" command over the serial communications to a servo controller unit.
 void requestStatus()
          Issues a "Request for Status" command over the serial communications to a servo controller unit.
 void runBIT()
          Issues a "Run BIT" command over the serial communications to a servo controller unit.
 void selectPortAntenna()
          Issues a "Select Port Antenna" command over the serial communications to a servo controller unit.
 void selectStarboardAntenna()
          Issues a "Select Starboard Antenna" command over the serial communications to a servo controller unit.
 void setNegativeSoftStops(double a, double e)
          Issues a "Negative Soft Stop" command over the serial communications to a servo controller unit.
 void setPort(javax.comm.CommPortIdentifier cpi)
          Sets the port for future communication.
 void setPositiveSoftStops(double a, double e)
          Issues a "Positive Soft Stop" command over the serial communications to a servo controller unit.
 void writeCommand(byte[] packet)
          This method is used to write commands to the serial port.
 
Methods inherited from class com.lmco.lmpf.plugin.PluginTab
addEventListener, removeEventListener
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
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, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, 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
 
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, setLayout, 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

commands

java.lang.String[] commands
A list of the commands that can be sent to a servo controller.

Constructor Detail

MEUSimulatorGUI

public MEUSimulatorGUI()
The basic constructor for this simulator GUI.

Method Detail

calculateChecksum

public static byte calculateChecksum(byte[] command)
This method calculates the checksum of a command byte packet. This checksum calculation is specific to Commands. It will not work on Status packets.

Parameters:
command - The byte packet to calculate the checksum for
Returns:
The checksum of the command packet.

selectPortAntenna

public void selectPortAntenna()
Issues a "Select Port Antenna" command over the serial communications to a servo controller unit.


selectStarboardAntenna

public void selectStarboardAntenna()
Issues a "Select Starboard Antenna" command over the serial communications to a servo controller unit.


runBIT

public void runBIT()
Issues a "Run BIT" command over the serial communications to a servo controller unit.


disableTorquers

public void disableTorquers()
Issues a "Disable Torquers" command over the serial communications to a servo controller unit.


enableTorquers

public void enableTorquers()
Issues a "Enable Torquers" command over the serial communications to a servo controller unit.


cageMode

public void cageMode()
Issues a "Cage Mode" command over the serial communications to a servo controller unit.


requestStatus

public void requestStatus()
Issues a "Request for Status" command over the serial communications to a servo controller unit.


positionMode

public void positionMode(double a,
                         double e)
Issues a "Position Mode" command over the serial communications to a servo controller unit. Uses the values specified in the text boxes for the angles.


rateMode

public void rateMode(double a,
                     double e)
Issues a "Rate Mode" command over the serial communications to a servo controller unit. Uses the values specified in the text boxes for the angles.


setPositiveSoftStops

public void setPositiveSoftStops(double a,
                                 double e)
Issues a "Positive Soft Stop" command over the serial communications to a servo controller unit. Uses the values specified in the text boxes for the angles.


setNegativeSoftStops

public void setNegativeSoftStops(double a,
                                 double e)
Issues a "Negative Soft Stop" command over the serial communications to a servo controller unit. Uses the values specified in the text boxes for the angles.


main

public static void main(java.lang.String[] args)
This will create a new window and display the MEU simulator. This is to rapidly test the functionality of the simulator instead of using the simulator in the plugin framework.

Parameters:
args - Does not require any arguments

disableComm

public void disableComm()
This will stop communications on the current port. No further activity will occur until setPort(CommPortIdentifier) is called again.


setPort

public void setPort(javax.comm.CommPortIdentifier cpi)
Sets the port for future communication. Communications will be stopped on the current port, and communications will be started on the new port.

Parameters:
cpi - The port to communicate on.

writeCommand

public void writeCommand(byte[] packet)
This method is used to write commands to the serial port.

Parameters:
packet - The byte packet to write to the serial stream.