Class control_packet_coder

java.lang.Object
  extended bycontrol_packet_coder

public class control_packet_coder
extends java.lang.Object


Constructor Summary
control_packet_coder()
          Creates a new instance of control_packet_coder
 
Method Summary
 byte[] createControlPacket()
          This creates a control packet that can be sent to the robot via the SerialPortControl object.
 int decodeResponsePacket(byte[] rPacket)
          This is used to update all of the object variables to the new values returned in the response packet.
 boolean getAutofocus()
          Returns the autofocus setting.
 byte getBatteryRaw()
          Returns the battery voltage as a raw value from the controller.
 double getBatteryVoltage()
          Returns the battery voltage.
 byte getControllerPcFlags()
          Retuns the controller PC flag byte.
 byte getControllerTetherFlags()
          Retuns the controller Tether flag byte.
 byte getFocusCurrent()
          Returns the focus current.
 boolean getFocusIn()
          Returns the focusIn status.
 boolean getFocusOut()
          Returns the focusOut status.
 byte getJoyX()
          Returns the X postion of the OCU joystick.
 byte getJoyY()
          Returns the Y postition of the OCU joystick.
 boolean getLaser()
          Returns the on/off state of the laser.
 byte getLeftTrack()
          Returns the left track vector.
 byte getLeftTrackCurrent()
          Returns the left track current.
 byte getLight()
          Returns the light intensity setting.
 byte getLightCurrent()
          Returns the light current.
 byte getLightKnob()
          Returns the position of the OCU light knob.
 int getPitch()
          Returns the pitch of the robot.
 byte getRaise()
          Returns the raise of the robot.
 byte getRaiseCurrent()
          Returns the raise current.
 boolean getRaiseDown()
          Returns the RaiseDown status.
 boolean getRaiseUp()
          Returns the RaiseUp status.
 byte getRightTrack()
          Returns the right track vector.
 byte getRightTrackCurrent()
          Returns the right track current.
 byte getTemperature()
          Returns the external temperature at the robot.
 byte getTiltCurrent()
          Returns the tilt current.
 boolean getTiltDown()
          Returns the TiltDown status.
 boolean getTiltUp()
          Returns the TiltUp status.
 boolean getWarning()
          Returns the OCU warning light status.
 boolean getZoomIn()
          Returns the ZoomIn status.
 boolean getZoomOut()
          Returns the ZoomOut status.
 boolean getZoomSpeed()
          Returns the ZoomSpeed status.
 void setAutofocus(boolean autofocusOn)
          Sets the camera Autofocus on or off.
 void setFocusIn(boolean focusIn)
          Makes the camera focus in.
 void setFocusOut(boolean focusOut)
          Makes the camera focus out.
 void setLaser(boolean laserOn)
          Sets the laser on or off.
 void setLeftTrack(byte speed)
          Sets the speed and direction for the left track on the robot.
 void setLight(byte intensity)
          Sets the intensity of the robot head lights.
 void setRaiseDown(boolean raiseDown)
          Causes the robot to lower its configuration.
 void setRaiseUp(boolean raiseUp)
          Causes the robot to raise its configuration.
 void setRightTrack(byte speed)
          Sets the speed and direction for the left track on the robot.
 void setTiltDown(boolean tiltDown)
          Causes the camera to tilt down.
 void setTiltUp(boolean tiltUp)
          Causes the camera to tilt up.
 void setWarning(boolean warning)
          Sets the waring light on the OCU.
 void setZoomIn(boolean zoomIn)
          Causes the camera to zoom in.
 void setZoomOut(boolean zoomOut)
          Causes the camera to zoom out.
 void setZoomSpeed(boolean zoomSpeed)
          Sets the zoom speed of the camera.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

control_packet_coder

public control_packet_coder()
Creates a new instance of control_packet_coder

Method Detail

setLeftTrack

public void setLeftTrack(byte speed)
Sets the speed and direction for the left track on the robot.

Parameters:
speed - Signed Byte that indicates speed and direction of the motor. Negative numbers move the moter in reverse.

setRightTrack

public void setRightTrack(byte speed)
Sets the speed and direction for the left track on the robot.

Parameters:
speed - Signed Byte that indicates speed and direction of the motor. Negative numbers move the moter in reverse.

setLight

public void setLight(byte intensity)
Sets the intensity of the robot head lights.

Parameters:
intensity - Unsigned Byte indicating how bright the robot head lights are. 0 is off 255 (or -1) is Max.

setAutofocus

public void setAutofocus(boolean autofocusOn)
Sets the camera Autofocus on or off.

Parameters:
autofocusOn - True for autofocus False for manual.

setLaser

public void setLaser(boolean laserOn)
Sets the laser on or off.

Parameters:
laserOn - True to turn the laser on, False to turn the laser off.

setFocusOut

public void setFocusOut(boolean focusOut)
Makes the camera focus out. If both focus in and out are set the robot will default to in.

Parameters:
focusOut - True to focus out.

setFocusIn

public void setFocusIn(boolean focusIn)
Makes the camera focus in. If both focus in and out are set the robot will default to in.

Parameters:
focusIn - True to focus in.

setRaiseDown

public void setRaiseDown(boolean raiseDown)
Causes the robot to lower its configuration.

Parameters:
raiseDown - True to lower the robot.

setRaiseUp

public void setRaiseUp(boolean raiseUp)
Causes the robot to raise its configuration.

Parameters:
raiseUp - True to raise the robot.

setTiltDown

public void setTiltDown(boolean tiltDown)
Causes the camera to tilt down.

Parameters:
tiltDown - True to tilt down.

setTiltUp

public void setTiltUp(boolean tiltUp)
Causes the camera to tilt up.

Parameters:
tiltUp - True to tilt up.

setWarning

public void setWarning(boolean warning)
Sets the waring light on the OCU.

Parameters:
warning - True to turn the light on, False to turn it off.

setZoomIn

public void setZoomIn(boolean zoomIn)
Causes the camera to zoom in.

Parameters:
zoomIn - True to zoom in.

setZoomOut

public void setZoomOut(boolean zoomOut)
Causes the camera to zoom out.

Parameters:
zoomOut - True to zoom out.

setZoomSpeed

public void setZoomSpeed(boolean zoomSpeed)
Sets the zoom speed of the camera. There are two settings, fast and slow.

Parameters:
zoomSpeed - True for fast, false for slow.

decodeResponsePacket

public int decodeResponsePacket(byte[] rPacket)
This is used to update all of the object variables to the new values returned in the response packet. It takes an array of bytes (a response packet) that you get from the SerialPortControl object.

Parameters:
rPacket - This is the response packet array. Get this from the SerialPortControl object.
Returns:
Returns 0 if the packet was OK, returns -1 if there was a checksum error.

createControlPacket

public byte[] createControlPacket()
This creates a control packet that can be sent to the robot via the SerialPortControl object.

Returns:
The returned byte array is the control packet. Send it to the robot via the SerialPortControl object.

getLeftTrack

public byte getLeftTrack()
Returns the left track vector. Postitive values indicate forward, negative values indicate backwards.

Returns:
The return byte indicates the speed and direction of the left track.

getRightTrack

public byte getRightTrack()
Returns the right track vector. Postitive values indicate forward, negative values indicate backwards.

Returns:
The return byte indicates the speed and direction of the left track.

getLight

public byte getLight()
Returns the light intensity setting.

Returns:
This byte indicates how bright the light is set. This should be interpreted as an unsigned byte and is on a scale where 0 is off and 255 is brightest.

getBatteryVoltage

public double getBatteryVoltage()
Returns the battery voltage.

Returns:
The battery voltage in volts.

getBatteryRaw

public byte getBatteryRaw()
Returns the battery voltage as a raw value from the controller. This is not the actual voltage.

Returns:
A byte that returns the RAW battery voltage number from the controller.

getTemperature

public byte getTemperature()
Returns the external temperature at the robot.

Returns:
Temperature at the robot in degrees Farenheight.

getPitch

public int getPitch()
Returns the pitch of the robot.

Returns:
This signed integer indicates pitch of the robot in degrees above or below horizontal.

getRaise

public byte getRaise()
Returns the raise of the robot.

Returns:
This byte indicates the raise of the robot from 0-90 degrees above horizontal.

getJoyY

public byte getJoyY()
Returns the Y postition of the OCU joystick.

Returns:
This is a signed value indicating the Y position of the OCU joystick. Returns 0 when the joystick is centered.

getJoyX

public byte getJoyX()
Returns the X postion of the OCU joystick.

Returns:
This is a signed value indicating the Y position of the OCU joystick. Returns 0 when the joystick is centered.

getAutofocus

public boolean getAutofocus()
Returns the autofocus setting.

Returns:
A boolean value that is true if autofocus is enabled and false if it is disabled.

getLaser

public boolean getLaser()
Returns the on/off state of the laser.

Returns:
A boolean value that is true for on and false for off.

getFocusOut

public boolean getFocusOut()
Returns the focusOut status.

Returns:
A boolean value that is true if focusOut is enabled and false if it is not.

getFocusIn

public boolean getFocusIn()
Returns the focusIn status.

Returns:
A boolean value that is true if focusIn is enabled and false if it is not.

getRaiseDown

public boolean getRaiseDown()
Returns the RaiseDown status.

Returns:
A boolean value that is true if RaiseDown is enabled, false if it is not.

getRaiseUp

public boolean getRaiseUp()
Returns the RaiseUp status.

Returns:
A boolean value that is true if RaiseUp is enabled, false if it is not.

getTiltDown

public boolean getTiltDown()
Returns the TiltDown status.

Returns:
A boolean value that is true if TiltDown is enabled, false if it is not.

getTiltUp

public boolean getTiltUp()
Returns the TiltUp status.

Returns:
A boolean value that is true if TiltUp is enabled, false if it is not.

getWarning

public boolean getWarning()
Returns the OCU warning light status.

Returns:
A boolean value that is true if the warning light is enabled, false if it is not.

getZoomIn

public boolean getZoomIn()
Returns the ZoomIn status.

Returns:
A boolean value that is true if ZoomIn is enabled, false if it is not.

getZoomOut

public boolean getZoomOut()
Returns the ZoomOut status.

Returns:
A boolean value that is true if ZoomOut is enabled, false if it is not.

getZoomSpeed

public boolean getZoomSpeed()
Returns the ZoomSpeed status.

Returns:
A boolean value that is true if ZoomSpeed is fast, false if it is slow.

getTiltCurrent

public byte getTiltCurrent()
Returns the tilt current.

Returns:
A byte that indicates the current draw of the tilt motor.

getRaiseCurrent

public byte getRaiseCurrent()
Returns the raise current.

Returns:
A byte that indicates the current draw of the raise motor.

getLightCurrent

public byte getLightCurrent()
Returns the light current.

Returns:
A byte that indicates the current draw of the headlights.

getLeftTrackCurrent

public byte getLeftTrackCurrent()
Returns the left track current.

Returns:
A byte that indicates the current draw of the left track motor.

getRightTrackCurrent

public byte getRightTrackCurrent()
Returns the right track current.

Returns:
A byte that indicates the current draw of the right track motor.

getFocusCurrent

public byte getFocusCurrent()
Returns the focus current.

Returns:
A byte that indicates the current draw of the focus motor.

getLightKnob

public byte getLightKnob()
Returns the position of the OCU light knob.

Returns:
An unsigned byte that indicates the position of the OCU light knob.

getControllerTetherFlags

public byte getControllerTetherFlags()
Retuns the controller Tether flag byte. This is part of the return packet.

Returns:
A byte that contains the raw Controller Tether Flags, these are accessable with the get functions in this object.

getControllerPcFlags

public byte getControllerPcFlags()
Retuns the controller PC flag byte. This is part of the return packet.

Returns:
A byte that contains the raw Controller PC Flags, these are accessable with the get functions in this object.