dLife Home Page

dlife.robot.scribbler
Class ScribblerLEDs

java.lang.Object
  extended by java.util.Observable
      extended by dlife.robot.Device
          extended by dlife.robot.OnOffSetEffector
              extended by dlife.robot.scribbler.ScribblerLEDs

public class ScribblerLEDs
extends OnOffSetEffector

A class for controlling the programmable LEDs on the Scribbler and the Fluke. In practice only the left and right LEDs on the Scribbler are programmable. The Scribbler OS blinks the center LED and thus, while its state can be programmed it is quickly lost due to the blinking. The front LED on the Fluke is an on/off led. The back LED on the Fluke can have its brightness adjusted.

The Scribbler's LED are at the rear of the Scribbler in the default orientation (Scribbler.FLUKE_AT_REAR). If the robot's orientation is changed to Scribbler.FLUKE_AT_FRONT then the LED's are near the rear of the robot. The left-to-right ordering of the LEDs is presented with respect to the robot's current orientation.

This class assumes that the Fluke camera always faces the front of the robot. Thus, in FLUKE_AT_REAR mode the reversing dongle is used. When this is done the front, back positions of the LEDs remain the same with respect to the orientation of the robot. If your Fluke is not mounted in the above manner then you will need to compensate for the reversed position of the Fluke when accessing the LEDs.

Version:
Mar 10, 2012
Author:
Grant Braught, Dickinson College

Field Summary
static int CENTER
          The index of the Scribbler's center LED.
static int FRONT
          The index of the Fluke's front LED.
static int LEFT
          The index of the Scribbler's left LED
static int RIGHT
          The index of the Scribbler's right LED.
 
Fields inherited from class dlife.robot.OnOffSetEffector
effectorStates
 
Fields inherited from class dlife.robot.Device
DEFAULT_GUI_UPDATE_DELAY, DEFAULT_READ_DELAY, myRobot, readCount
 
Constructor Summary
ScribblerLEDs()
          Construct a new ScribblerLEDs object.
 
Method Summary
protected  DeviceDisplay[] createGUIObjects()
          Get the object that is the GUI for this Scribbler's LEDs.
 void freeze()
          Does nothing.
 int getRearLEDPercent()
          Get the current percent of maximum brightness setting of the Fluke's rear LED.
 boolean isCenterOn()
          Determine if the center LED is on or off.
 boolean isFrontOn()
          Determine if the Fluke's front LED is on or off.
 boolean isLeftOn()
          Determine if the Scribbler's left LED is on or off.
 boolean isRightOn()
          Determine if the Scribbler's right LED is on or off.
 void readStateFromRobot()
          Does nothing.
 void setCenter(boolean turnOn)
          Set the state of the Scribbler's center LED.
 void setFront(boolean turnOn)
          Set the state of the Fluke's front LED.
 void setLeft(boolean turnOn)
          Set the state of the Scribbler's left LED.
 void setRearLEDPercent(int value)
          Set the brightness of the Fluke's rear LED.
 void setRight(boolean turnOn)
          Set the state of the Scribbler's right LED.
protected  void setRobotEffectorPattern(String pattern)
          Send a message to the Scribbler asking it to set its LEDs according to the specified pattern.
 void shutDown()
          Turns off all of the LED's when the device is shut down.
 
Methods inherited from class dlife.robot.OnOffSetEffector
getEffectorPattern, getNumEffectors, isEffectorOn, setEffector, setEffectorPattern, startUp
 
Methods inherited from class dlife.robot.Device
getAutoRead, getGUI, getGUIUpdateDelay, getReadDelay, getRobot, getSensorReadCount, getSensorReadRate, setAutoRead, setGUIUpdateDelay, setReadDelay, setRobot, startAutoReadTimer, stopAutoReadTimer
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LEFT

public static final int LEFT
The index of the Scribbler's left LED

See Also:
Constant Field Values

CENTER

public static final int CENTER
The index of the Scribbler's center LED.

See Also:
Constant Field Values

RIGHT

public static final int RIGHT
The index of the Scribbler's right LED.

See Also:
Constant Field Values

FRONT

public static final int FRONT
The index of the Fluke's front LED.

See Also:
Constant Field Values
Constructor Detail

ScribblerLEDs

public ScribblerLEDs()
Construct a new ScribblerLEDs object.

Method Detail

shutDown

public void shutDown()
Turns off all of the LED's when the device is shut down.

Overrides:
shutDown in class OnOffSetEffector

freeze

public void freeze()
Does nothing. There is no motion associated with the LEDs.

Specified by:
freeze in class Device

readStateFromRobot

public void readStateFromRobot()
Does nothing. The state of the LEDs cannot be read from the robot.

Specified by:
readStateFromRobot in class Device

setRearLEDPercent

public void setRearLEDPercent(int value)
Set the brightness of the Fluke's rear LED.

Parameters:
value - the percent of maximum brightness of the LED. The value will be bound to the range [0 ... 100] with 0 being off and 100 being the maximum brightness.

getRearLEDPercent

public int getRearLEDPercent()
Get the current percent of maximum brightness setting of the Fluke's rear LED. The value will be bound to the range [0 ... 100] with 0 being off and 100 being the maximum brightness.

Returns:
the current brightness.

setLeft

public void setLeft(boolean turnOn)
Set the state of the Scribbler's left LED.

Parameters:
turnOn - true to turn the LED on, false to turn it off.

isLeftOn

public boolean isLeftOn()
Determine if the Scribbler's left LED is on or off.

Returns:
the state of the left LED.

setCenter

public void setCenter(boolean turnOn)
Set the state of the Scribbler's center LED. NOTE: The Scribbler OS blinks this light steadily during operation. Thus, the physical light on the robot will only reflect this state for a short time.

Parameters:
turnOn - true to turn the light on, false to turn it off.

isCenterOn

public boolean isCenterOn()
Determine if the center LED is on or off.

Returns:
the last state to which the left light was set. NOTE: The Scribbler OS blinks this light steadily during operation. Thus, the physical light on the robot may not reflect this state.

setRight

public void setRight(boolean turnOn)
Set the state of the Scribbler's right LED.

Parameters:
turnOn - true to turn the LED on, false to turn it off.

isRightOn

public boolean isRightOn()
Determine if the Scribbler's right LED is on or off.

Returns:
the state of the right LED.

setFront

public void setFront(boolean turnOn)
Set the state of the Fluke's front LED.

Parameters:
turnOn - true to turn the LED on, false to turn it off.

isFrontOn

public boolean isFrontOn()
Determine if the Fluke's front LED is on or off.

Returns:
the state of the front LED.

setRobotEffectorPattern

protected void setRobotEffectorPattern(String pattern)
Send a message to the Scribbler asking it to set its LEDs according to the specified pattern.

Specified by:
setRobotEffectorPattern in class OnOffSetEffector
Parameters:
pattern - a String of 1's and 0's indicating the pattern of on's and off's for the Scribbler's LEDs.
Throws:
RobotCommunicationException - if unable to communicate with the Scribbler.

createGUIObjects

protected DeviceDisplay[] createGUIObjects()
Get the object that is the GUI for this Scribbler's LEDs.

Specified by:
createGUIObjects in class Device
Returns:
the object that is the GUI for this ScribblerLEDs.

dLife Home Page