dLife Home Page

dlife.robot.khepera3
Class Khepera3BatterySensor

java.lang.Object
  extended by java.util.Observable
      extended by dlife.robot.Device
          extended by dlife.robot.ArraySensor<Double>
              extended by dlife.robot.khepera3.Khepera3BatterySensor

public class Khepera3BatterySensor
extends ArraySensor<Double>

A class for reading information about the Khepera 3's battery. Methods are provided for reading the voltage, current, average current, and temperature.

Version:
August 25, 2009
Author:
Russell Toris, Grant Braught, Dickinson College

Field Summary
static int AVERAGE_CURRENT
          The average current sensor number.
static int CURRENT
          The current sensor number.
static int TEMPERATURE
          The temperature sensor number.
static int VOLTAGE
          The voltage sensor number.
 
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
Khepera3BatterySensor()
          Creates a new Khepera3BatterySensor.
 
Method Summary
protected  DeviceDisplay[] createGUIObjects()
          Get the object that is the GUI for this Khepera3BatterySensor.
 void freeze()
          Does nothing.
 double getAverageCurrent()
          Get the average battery current (in amps) at the time of the last call to readStateFromRobot.
 double getCurrent()
          Get the battery current (in amps) at the time of the last call to readStateFromRobot.
 double getTemperature()
          Get the battery temperature (in celsius) at the time of the last call to readStateFromRobot.
 double getVoltage()
          Get the battery voltage (in volts) at the time of the last call to read.
 void readStateFromRobot()
          Get the current battery voltage from the Khepera 3.
 
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

VOLTAGE

public static final int VOLTAGE
The voltage sensor number.

See Also:
Constant Field Values

CURRENT

public static final int CURRENT
The current sensor number.

See Also:
Constant Field Values

AVERAGE_CURRENT

public static final int AVERAGE_CURRENT
The average current sensor number.

See Also:
Constant Field Values

TEMPERATURE

public static final int TEMPERATURE
The temperature sensor number.

See Also:
Constant Field Values
Constructor Detail

Khepera3BatterySensor

public Khepera3BatterySensor()
Creates a new Khepera3BatterySensor. The battery sensor is updated from the robot every 5 seconds.

Method Detail

getVoltage

public double getVoltage()
Get the battery voltage (in volts) at the time of the last call to read.

Returns:
the battery voltage.

getCurrent

public double getCurrent()
Get the battery current (in amps) at the time of the last call to readStateFromRobot.

Returns:
the battery current

getAverageCurrent

public double getAverageCurrent()
Get the average battery current (in amps) at the time of the last call to readStateFromRobot.

Returns:
the average battery current

getTemperature

public double getTemperature()
Get the battery temperature (in celsius) at the time of the last call to readStateFromRobot.

Returns:
the battery temperature

freeze

public void freeze()
Does nothing. The battery device doesn't move so no need to freeze it.

Specified by:
freeze in class Device

readStateFromRobot

public void readStateFromRobot()
Get the current battery voltage from the Khepera 3. The new values is copied into the values array defined by the ArraySensor class.

Specified by:
readStateFromRobot in class Device
Throws:
RobotCommunicationException - if unable to communicate with the Khepera 3.

createGUIObjects

protected DeviceDisplay[] createGUIObjects()
Get the object that is the GUI for this Khepera3BatterySensor.

Specified by:
createGUIObjects in class Device
Returns:
a reference to the GUI.

dLife Home Page