dlife.robot.khepera2
Class Khepera2ProximitySensor
java.lang.Object
java.util.Observable
dlife.robot.Device
dlife.robot.ArraySensor<Integer>
dlife.robot.khepera2.Khepera2IRSensor
dlife.robot.khepera2.Khepera2ProximitySensor
public class Khepera2ProximitySensor
- extends Khepera2IRSensor
A class for reading the Khepera2's proximity sensors. Each sensor reading is
an integer value in the range [0...1023] with larger values indicating closer
obstacles. Note that the value returned depends not only on the distance to
the obstacle but also on the IR reflectivity of its material. Thus there is
no direct conversion from a proximity sensor reading to the distance to the
obstacle. See the Khepera2 Manuals for more information.
The proximity sensors are active sensors. They emit a burst of IR light and
then detect how much of it is reflected. This allows the sensor to detect
obstacles but can also be used to distinguish between surfaces with different
IR reflectivity.
The proximity sensors are arranged around the robot as shown in Figure 1
below.

Figure 1: A Khepera2 robot withthe IR/Proximity sensors labeled.
Numerals in the circles correspond to the index of the sensor data
in the Khepera2IRSensor and Khepera2ProximitySensor
objects.
See the Khepera2IRSensor documentation for
examples of how to access the sensor values.
- Version:
- Jan 19, 2011
- Author:
- Grant Braught, Dickinson College
| Fields inherited from class dlife.robot.khepera2.Khepera2IRSensor |
ALL, FRONT_GROUP, FRONT_LEFT, FRONT_RIGHT, LEFT, LEFT_FRONT, LEFT_GROUP, LEFT_REAR, REAR_GROUP, RIGHT, RIGHT_FRONT, RIGHT_GROUP, RIGHT_REAR |
|
Method Summary |
protected DeviceDisplay[] |
createGUIObjects()
Get the object that is the GUI for this Khepera2ProximitySensor. |
static void |
main(String[] args)
A little test program for the HemissonProximitySensor. |
void |
readStateFromRobot()
Get the current proximity sensor readings from the Khepera2. |
| 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.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Khepera2ProximitySensor
public Khepera2ProximitySensor()
- Construct a new Khepera2ProximitySensor.
readStateFromRobot
public void readStateFromRobot()
- Get the current proximity sensor readings from the Khepera2. The new
values are copied into the values array defined by the IntegerArraySensor
class.
- Overrides:
readStateFromRobot in class Khepera2IRSensor
- Throws:
RobotCommunicationException - if unable to communicate with the
Khepera2.
createGUIObjects
protected DeviceDisplay[] createGUIObjects()
- Get the object that is the GUI for this Khepera2ProximitySensor.
- Overrides:
createGUIObjects in class Khepera2IRSensor
- Returns:
- an array of DeviceDisplay subclass objects that make up the GUI
for this Device.
main
public static void main(String[] args)
- A little test program for the HemissonProximitySensor. This creates a new
Hemisson and a new HemissonProximitySensor. It displays the GUI for the
sensor readings and then updates the sensor readings until the window is
closed.
- Parameters:
args - none