javaclient
Class PtzInterface

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

public class PtzInterface
extends PlayerDevice

The ptz interface is used to control a pan-tilt-zoom unit, such as a camera.

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

Field Summary
protected  short PLAYER_PTZ_AUTOSERVO
           
protected  short PLAYER_PTZ_CONTROL_MODE_REQ
           
protected  short PLAYER_PTZ_GENERIC_CONFIG_REQ
           
 short PLAYER_PTZ_MAX_CONFIG_LEN
          maximum command length for use with PLAYER_PTZ_GENERIC_CONFIG_REQ, based on the Sony EVID30 camera right now
 
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
PtzInterface(PlayerClient pc, short indexOfDevice)
          Constructor for PtzInterface.
 
Method Summary
 void controlRequest(int mode)
          Configuration request: Control mode.
 void genericRequest(int length, byte[] buf)
          Configuration request: Generic request.
 short getPan()
          Get pan in degrees.
 short getPanSpeed()
          Get current pan velocity in deg/sec.
 short getTilt()
          Get tilt in degrees.
 short getTiltSpeed()
          Get current tilt velocity in deg/sec.
 short getZoom()
          Get field of view in degrees.
 void handleResponse(int size)
          Handle acknowledgement response messages (threaded mode).
 void readData()
          Read the data reflecting the current state of the Pan-Tilt-Zoom unit.
 void setAutoServo(int mode)
          Configuration request: Set AutoServo mode.
 void setPTZ(int pan, int tilt, int zoom, int panspeed, int tiltspeed)
          The ptz interface accepts commands that set change the state of the unit.
 
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_PTZ_MAX_CONFIG_LEN

public final short PLAYER_PTZ_MAX_CONFIG_LEN
maximum command length for use with PLAYER_PTZ_GENERIC_CONFIG_REQ, based on the Sony EVID30 camera right now

See Also:
Constant Field Values

PLAYER_PTZ_GENERIC_CONFIG_REQ

protected final short PLAYER_PTZ_GENERIC_CONFIG_REQ
See Also:
Constant Field Values

PLAYER_PTZ_CONTROL_MODE_REQ

protected final short PLAYER_PTZ_CONTROL_MODE_REQ
See Also:
Constant Field Values

PLAYER_PTZ_AUTOSERVO

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

PtzInterface

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

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

readData

public void readData()
Read the data reflecting the current state of the Pan-Tilt-Zoom unit.

Overrides:
readData in class PlayerDevice

setPTZ

public void setPTZ(int pan,
                   int tilt,
                   int zoom,
                   int panspeed,
                   int tiltspeed)
The ptz interface accepts commands that set change the state of the unit. Note that the commands are absolute, not relative.

Parameters:
pan - pan (degrees): -100..100
tilt - tilt (degrees): -25..25
zoom - field of view (degrees): 0..1023
panspeed - current pan velocity (deg/sec)
tiltspeed - current tilt velocity (deg/sec)

genericRequest

public void genericRequest(int length,
                           byte[] buf)
Configuration request: Generic request. This ioctl allows the client to send a unit-specific command to the unit. Whether data is returned depends on the command that was sent.

Parameters:
length - length of data in config buffer
buf - buffer for command/reply

controlRequest

public void controlRequest(int mode)
Configuration request: Control mode. This ioctl allows the client to switch between position and velocity control, for those drivers that support it. Note that this request changes how the driver interprets forthcoming commands from all clients.

Parameters:
mode - mode to use: must be either PLAYER_PTZ_VELOCITY_CONTROL (0) or PLAYER_PTZ_POSITION_CONTROL (1)

setAutoServo

public void setAutoServo(int mode)
Configuration request: Set AutoServo mode. Enable/Disable AutoServo mode on cameras such as the CMUcam2.

Parameters:
mode - 0=disabled, 1=enabled

getPan

public short getPan()
Get pan in degrees.

Returns:
pan (degrees) as a short

getTilt

public short getTilt()
Get tilt in degrees.

Returns:
tilt (degrees) as a short

getZoom

public short getZoom()
Get field of view in degrees.

Returns:
field of view (degrees) as a short

getPanSpeed

public short getPanSpeed()
Get current pan velocity in deg/sec.

Returns:
current pan velocity (deg/sec) as a short

getTiltSpeed

public short getTiltSpeed()
Get current tilt velocity in deg/sec.

Returns:
current tilt velocity (deg/sec) as a short

handleResponse

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

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