dLife Home Page

dlife.robot.scribbler
Class ScribblerLightSensor

java.lang.Object
  extended by java.util.Observable
      extended by dlife.robot.Device
          extended by dlife.robot.ArraySensor<Integer>
              extended by dlife.robot.scribbler.ScribblerLightSensor

public class ScribblerLightSensor
extends ArraySensor<Integer>

Sensor for the Scribbler's light sensors.

Each light sensor has a value indicating the intensity of the light shining on the sensor. Smaller values indicate brighter more direct sources of light.

The light sensors are on the front 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 light sensors are at the rear of the robot. The left-to-right ordering of the light sensors is presented with respect to the robot's current orientation.

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

Field Summary
static int CENTER
          Constant for the index of the center light sensor.
static int LEFT
          Constant for the index of the left light sensor.
static int RIGHT
          Constant for the index of the right light sensor.
 
Fields inherited from class dlife.robot.ArraySensor
length, values
 
Fields inherited from class dlife.robot.Device
DEFAULT_GUI_UPDATE_DELAY, DEFAULT_READ_DELAY, myRobot, readCount
 
Constructor Summary
ScribblerLightSensor()
          Construct a new ScribblerLineSensor.
 
Method Summary
protected  DeviceDisplay[] createGUIObjects()
          Get the GUI for the ScribblerLineSensor.
 void freeze()
          This method does nothing.
 int getCenterSensor()
          Get the current value of the center light sensor.
 int getLeftSensor()
          Get the current value of the left light sensor.
 int getRightSensor()
          Get the current value of the right light sensor.
 void readStateFromRobot()
          Send a message to the Scribbler to read the state of the line sensor and update the values of this sensor.
 
Methods inherited from class dlife.robot.ArraySensor
getAverage, getAverage, getMaximum, getMaximum, getMaximumIndex, getMaximumIndex, getMinimum, getMinimum, getMinimumIndex, getMinimumIndex, getNumValues, getSubset, getValue, getValues
 
Methods inherited from class dlife.robot.Device
getAutoRead, getGUI, getGUIUpdateDelay, getReadDelay, getRobot, getSensorReadCount, getSensorReadRate, setAutoRead, setGUIUpdateDelay, setReadDelay, setRobot, shutDown, startAutoReadTimer, startUp, 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
Constant for the index of the left light sensor.

See Also:
Constant Field Values

CENTER

public static final int CENTER
Constant for the index of the center light sensor.

See Also:
Constant Field Values

RIGHT

public static final int RIGHT
Constant for the index of the right light sensor.

See Also:
Constant Field Values
Constructor Detail

ScribblerLightSensor

public ScribblerLightSensor()
Construct a new ScribblerLineSensor.

Method Detail

freeze

public void freeze()
This method does nothing. There is nothing to freeze for the light sensor.

Specified by:
freeze in class Device

readStateFromRobot

public void readStateFromRobot()
Send a message to the Scribbler to read the state of the line sensor and update the values of this sensor.

Specified by:
readStateFromRobot in class Device

getLeftSensor

public int getLeftSensor()
Get the current value of the left light sensor.

Returns:
the value of the left light sensor.

getCenterSensor

public int getCenterSensor()
Get the current value of the center light sensor.

Returns:
the value of the center light sensor.

getRightSensor

public int getRightSensor()
Get the current value of the right light sensor.

Returns:
the value of the right light sensor.

createGUIObjects

protected DeviceDisplay[] createGUIObjects()
Get the GUI for the ScribblerLineSensor.

Specified by:
createGUIObjects in class Device
Returns:
the GUI.

dLife Home Page