javaclient
Class IRInterface

java.lang.Object
  extended by javaclient.PlayerDevice
      extended by javaclient.IRInterface

public class IRInterface
extends PlayerDevice

The ir interface provides access to an array of infrared (IR) range sensors. This interface accepts no commands.

Version:
Author:
Maxim A. Batalin & Radu Bogdan Rusu

Field Summary
static short PLAYER_IR_MAX_SAMPLES
          maximum number of IR samples
protected  short PLAYER_IR_POSE_REQ
           
protected  short PLAYER_IR_POWER_REQ
           
 
Fields inherited from class javaclient.PlayerDevice
device, DIFFERENCE_SYNCH_FACTOR, index, is, os, pc, PLAYER_MAX_REQREP_SIZE, PLAYER_STXX, reserved, size, t_sec, t_usec, ts_sec, ts_usec
 
Constructor Summary
IRInterface(PlayerClient pc, short indexOfDevice)
          Constructor for IRInterface.
 
Method Summary
 PlayerIRPoseReqT getPIPRT()
          Get the geometry data.
 int getRangeCount()
          Returns the number of IR sensors specified in the Player world file (the number of valid range readings).
 int[] getRanges()
          Returns the IR array data ranges up to PLAYER_IR_MAX_SAMPLES.
 int[] getVoltages()
          Returns the IR array data voltages up to PLAYER_IR_MAX_SAMPLES.
 void handleResponse(int size)
          Handle acknowledgement response messages (threaded mode).
 boolean isPIPRTReady()
          Check if geometry data is available.
 void queryPose()
          Configuration request: Query pose.
 void readData()
          Read the IR values.
 void setIRPower(int value)
          Configuration request: IR power.
 
Methods inherited from class javaclient.PlayerDevice
getTimeForDataSampled_sec, getTimeForDataSampled_usec, getTimeForDataSampled, getTimeForDataSent_sec, getTimeForDataSent_usec, getTimeForDataSent, handleEARMessage, handleNARMessage, readHeader, sendHeader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PLAYER_IR_MAX_SAMPLES

public static final short PLAYER_IR_MAX_SAMPLES
maximum number of IR samples

See Also:
Constant Field Values

PLAYER_IR_POSE_REQ

protected final short PLAYER_IR_POSE_REQ
See Also:
Constant Field Values

PLAYER_IR_POWER_REQ

protected final short PLAYER_IR_POWER_REQ
See Also:
Constant Field Values
Constructor Detail

IRInterface

public IRInterface(PlayerClient pc,
                   short indexOfDevice)
Constructor for IRInterface.

Parameters:
pc - a reference to the PlayerClient object
indexOfDevice - the index of the device
Method Detail

readData

public void readData()
Read the IR values.

Overrides:
readData in class PlayerDevice

getVoltages

public int[] getVoltages()
Returns the IR array data voltages up to PLAYER_IR_MAX_SAMPLES.

Returns:
an array filled with the IR voltages

getRanges

public int[] getRanges()
Returns the IR array data ranges up to PLAYER_IR_MAX_SAMPLES.

Returns:
an array filled with the IR ranges

getRangeCount

public int getRangeCount()
Returns the number of IR sensors specified in the Player world file (the number of valid range readings).

Returns:
the number of IR sensors specified in the Player world file as an integer

queryPose

public void queryPose()
Configuration request: Query pose.

See the player_ir_pose structure from player.h


setIRPower

public void setIRPower(int value)
Configuration request: IR power.

Parameters:
value - 0 for power off, 1 for power on

handleResponse

public void handleResponse(int size)
Handle acknowledgement response messages (threaded mode).

Overrides:
handleResponse in class PlayerDevice
Parameters:
size - size of the payload

isPIPRTReady

public boolean isPIPRTReady()
Check if geometry data is available.

Returns:
true if ready, false if not ready

getPIPRT

public PlayerIRPoseReqT getPIPRT()
Get the geometry data.

Returns:
an object of type PlayerIRPoseReqT containing the required geometry data