dLife Home Page

dlife.robot.scribbler
Class ScribblerLineSensor

java.lang.Object
  extended by java.util.Observable
      extended by dlife.robot.Device
          extended by dlife.robot.ArraySensor<Boolean>
              extended by dlife.robot.scribbler.ScribblerLineSensor

public class ScribblerLineSensor
extends ArraySensor<Boolean>

Sensor for the line sensor on the bottom of the Scribbler.

For each sensor, a value of true indicates the presence of a dark line and false indicates the absence of a dark line.

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

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

Field Summary
static int LEFT
          Constant for the index of the left line sensor.
static int RIGHT
          Constant for the index of the right line 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
ScribblerLineSensor()
          Construct a new ScribblerLineSensor.
 
Method Summary
protected  DeviceDisplay[] createGUIObjects()
          Get the GUI for the ScribblerLineSensor.
 void freeze()
          This method does nothing.
 boolean getLeftSensor()
          Get the current value of the left line sensor.
 boolean getRightSensor()
          Get the current value of the right line 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 line sensor.

See Also:
Constant Field Values

RIGHT

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

See Also:
Constant Field Values
Constructor Detail

ScribblerLineSensor

public ScribblerLineSensor()
Construct a new ScribblerLineSensor.

Method Detail

freeze

public void freeze()
This method does nothing. There is nothing to freeze for the line 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 boolean getLeftSensor()
Get the current value of the left line sensor.

Returns:
the value of the left line sensor.

getRightSensor

public boolean getRightSensor()
Get the current value of the right line sensor.

Returns:
the value of the right line sensor.

createGUIObjects

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

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

dLife Home Page