dLife Home Page

dlife.robot.scribbler
Class FlukeIRSensor

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

public class FlukeIRSensor
extends ArraySensor<Integer>

Sensor for the IR obstacle sensors on the Fluke. This sensor is useful for detecting obstacles to the front-left, front-center or front-right of the Fluke. The Fluke emits IR pulses and measures the number of pulses that return to each sensor. The larger the value the more pulses returned, indicating the presence of an obstacle from which the pulses were reflected.

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 left-right positions of the IR sensors remains 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 IR sensors.

This sensor seems particularly sensitive to the IR Power setting. The default setting is 135 which worked well on the Fluke with which it was tested. You may need to tune this value to something that works well with your Fluke. If your readings are very low, try increasing the power. If the readings are very high try reducing the power.

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

Field Summary
static int CENTER
          Constant for the index of the center IR sensor.
static int LEFT
          Constant for the index of the left IR sensor.
static int RIGHT
          Constant for the index of the right IR 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
FlukeIRSensor()
          Construct a new FlukeIRSensor.
 
Method Summary
protected  DeviceDisplay[] createGUIObjects()
          Get the GUI for the FlukeIRSensor.
 void freeze()
          This method does nothing.
 int getCenterSensor()
          Get the current value of the center IR sensor.
 byte getIRPower()
          Get the current power setting for the IR sensor.
 int getLeftSensor()
          Get the current value of the left IR sensor.
 int getRightSensor()
          Get the current value of the right IR sensor.
 void readStateFromRobot()
          Send a message to the Fluke to read the state of each of its 3 IR sensors and update the values of this sensor.
 void setIRPower(byte power)
          Set the power of the IR transmitters used by the IR sensor.
 void startUp()
          Perform any startup operations for the device.
 
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, 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 IR sensor.

See Also:
Constant Field Values

CENTER

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

See Also:
Constant Field Values

RIGHT

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

See Also:
Constant Field Values
Constructor Detail

FlukeIRSensor

public FlukeIRSensor()
Construct a new FlukeIRSensor.

Method Detail

freeze

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

Specified by:
freeze in class Device

startUp

public void startUp()
Description copied from class: Device
Perform any startup operations for the device. For example, storing a gripper, centering a PTZ or zeroing a dead reckoning device. The implementation provided by this class sets up some timing information necessary for computing sensor read rate statistics and starts the auto read timer if getAutoRead returns true. Subclasses that have their own start up requirements should override this method but should invoke super.startUp() to ensure that the statistics are computed correctly.

The Robot base class invokes this method once in addSensor or addEffector just before the Device is added to the Robot. The Robot will be alive when this method is invoked so it may send commands to the robot. If there are critical problems completing the startUp then this method should throw a RobotCommunicationException.

Overrides:
startUp in class Device

readStateFromRobot

public void readStateFromRobot()
Send a message to the Fluke to read the state of each of its 3 IR sensors and update the values of this sensor.

Specified by:
readStateFromRobot in class Device

getLeftSensor

public int getLeftSensor()
Get the current value of the left IR sensor. Larger values indicate closer obstacles.

Returns:
the value of the left IR sensor.

getCenterSensor

public int getCenterSensor()
Get the current value of the center IR sensor. Larger values indicate closer obstacles.

Returns:
the value of the center IR sensor.

getRightSensor

public int getRightSensor()
Get the current value of the right IR sensor. Larger values indicate closer obstacles.

Returns:
the value of the right IR sensor.

setIRPower

public void setIRPower(byte power)
Set the power of the IR transmitters used by the IR sensor. Increasing the power will increase the values measured by the sensors.

Parameters:
power - the power [0...255].

getIRPower

public byte getIRPower()
Get the current power setting for the IR sensor.

Returns:
the IR sensor power.

createGUIObjects

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

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

dLife Home Page