edu.nau.cs.scu
Class Command

java.lang.Object
  extended by edu.nau.cs.scu.Command

public class Command
extends java.lang.Object

This class embodies the Command packet sent over a serial line.

Author:
Sam Mallon

Field Summary
static double ANGLE_RATE_DIVISION_FACTOR
          A constant used when converting between the 24 bit two's complement number and a floating point value of angles and rates.
static int CAGE_MODE
          The byte representing a cage mode command.
static int COMMAND_PACKET_LENGTH
          A constant describing the number of bytes in a command packet as described in the servo controller unit documentation.
static int DISABLE_TORQUERS
          The byte representing a starboard disable torquers command.
static int ENABLE_TORQUERS
          The byte representing an enable torquers command.
static double MAXIMUM_ANGLE_OF_ROTATION
          The maximum angle of rotation, in radians, that can be sent in a command.
static double MAXIMUM_RATE_OF_ROTATION
          The maximum rate of rotation, in radians/second, that can be sent in a command.
static int PORT_ANTENNA_SELECT
          The byte representing a port antenna select command.
static int POSITION_MODE
          The byte representing a position mode command.
static int RATE_MODE
          The byte representing a rate mode command.
static int REQUEST_FOR_STATUS
          The byte representing a request for status command.
static int RUN_BIT
          The byte representing a run BIT command.
static int SET_NEGATIVE_SOFT_STOPS
          The byte representing a set negative soft stops command.
static int SET_POSITIVE_SOFT_STOPS
          The byte representing a set positive soft stops command.
static int STARBOARD_ANTENNA_SELECT
          The byte representing a starboard antenna select command.
static int START_CHARACTER
          The byte of the start character.
 
Constructor Summary
Command(byte[] commandArray)
          The primary constructor for this class.
 
Method Summary
 void execute()
          Looks at the structure of this command object and decides how to process the command by making changes in the physics model.
 double getAzimuth()
          This is a utility method that retrieves the floating point value of the azimuth rate or position (in radians) specified in this command object.
 int getCommandMode()
          Gets the command mode of this command object.
 double getElevation()
          This is a utility method that retrieves the floating point value of the elevation rate or position (in radians) specified in this command object.
 java.lang.String toString()
          Produces a basic string describing this command object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

START_CHARACTER

public static final int START_CHARACTER
The byte of the start character.

See Also:
Constant Field Values

POSITION_MODE

public static final int POSITION_MODE
The byte representing a position mode command.

See Also:
Constant Field Values

RATE_MODE

public static final int RATE_MODE
The byte representing a rate mode command.

See Also:
Constant Field Values

STARBOARD_ANTENNA_SELECT

public static final int STARBOARD_ANTENNA_SELECT
The byte representing a starboard antenna select command.

See Also:
Constant Field Values

PORT_ANTENNA_SELECT

public static final int PORT_ANTENNA_SELECT
The byte representing a port antenna select command.

See Also:
Constant Field Values

DISABLE_TORQUERS

public static final int DISABLE_TORQUERS
The byte representing a starboard disable torquers command.

See Also:
Constant Field Values

ENABLE_TORQUERS

public static final int ENABLE_TORQUERS
The byte representing an enable torquers command.

See Also:
Constant Field Values

CAGE_MODE

public static final int CAGE_MODE
The byte representing a cage mode command.

See Also:
Constant Field Values

RUN_BIT

public static final int RUN_BIT
The byte representing a run BIT command.

See Also:
Constant Field Values

SET_POSITIVE_SOFT_STOPS

public static final int SET_POSITIVE_SOFT_STOPS
The byte representing a set positive soft stops command.

See Also:
Constant Field Values

SET_NEGATIVE_SOFT_STOPS

public static final int SET_NEGATIVE_SOFT_STOPS
The byte representing a set negative soft stops command.

See Also:
Constant Field Values

REQUEST_FOR_STATUS

public static final int REQUEST_FOR_STATUS
The byte representing a request for status command.

See Also:
Constant Field Values

COMMAND_PACKET_LENGTH

public static final int COMMAND_PACKET_LENGTH
A constant describing the number of bytes in a command packet as described in the servo controller unit documentation.

See Also:
Constant Field Values

MAXIMUM_ANGLE_OF_ROTATION

public static final double MAXIMUM_ANGLE_OF_ROTATION
The maximum angle of rotation, in radians, that can be sent in a command.

See Also:
Constant Field Values

MAXIMUM_RATE_OF_ROTATION

public static final double MAXIMUM_RATE_OF_ROTATION
The maximum rate of rotation, in radians/second, that can be sent in a command.

See Also:
Constant Field Values

ANGLE_RATE_DIVISION_FACTOR

public static final double ANGLE_RATE_DIVISION_FACTOR
A constant used when converting between the 24 bit two's complement number and a floating point value of angles and rates.

See Also:
Constant Field Values
Constructor Detail

Command

public Command(byte[] commandArray)
The primary constructor for this class. It takes a byte packet as an argument and produces the corresponding Command object. The structure of the byte array is specified in the servo controller document.

Parameters:
commandArray - The byte packet representing the command
Method Detail

getAzimuth

public double getAzimuth()
This is a utility method that retrieves the floating point value of the azimuth rate or position (in radians) specified in this command object.

Returns:
The azimuth position or rate

getElevation

public double getElevation()
This is a utility method that retrieves the floating point value of the elevation rate or position (in radians) specified in this command object.

Returns:
The elevation position or rate

getCommandMode

public int getCommandMode()
Gets the command mode of this command object.

Returns:
The command mode

execute

public void execute()
Looks at the structure of this command object and decides how to process the command by making changes in the physics model.


toString

public java.lang.String toString()
Produces a basic string describing this command object. Used primarily for debugging.

Overrides:
toString in class java.lang.Object