|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
javaclient.PlayerClient
public class PlayerClient
The PlayerClient is the main Javaclient class. It contains methods for interacting with the player device. The player device represents the server itself, and is used in configuring the behavior of the server. There is only one such device (with index 0) and it is always open.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
protected java.io.BufferedOutputStream |
buffer
|
protected PlayerDevice[][] |
deviceList
|
java.io.DataInputStream |
is
The input stream for the socket connected to the player server. |
static boolean |
isDebugging
|
static int |
MAX_DEVICES
maximum devices of the same type |
protected static int |
N_DEVICES
|
java.io.DataOutputStream |
os
The output stream for the socket connected to the player server. |
protected static short |
PLAYER_AIO_CODE
|
static short |
PLAYER_ALL_MODE
|
protected static short |
PLAYER_AUDIO_CODE
|
protected static short |
PLAYER_AUDIODSP_CODE
|
protected static short |
PLAYER_AUDIOMIXER_CODE
|
protected static short |
PLAYER_BLINKENLIGHT_CODE
|
protected static short |
PLAYER_BLOBFINDER_CODE
|
protected static short |
PLAYER_BUMPER_CODE
|
protected static short |
PLAYER_CAMERA_CODE
|
static short |
PLAYER_CLOSE_MODE
|
static byte |
PLAYER_DATAMODE_PULL_ALL
Data delivery mode: Only on request (see requestData () request below), send data from ALL subscribed devices, regardless of whether the data is new or old. |
static byte |
PLAYER_DATAMODE_PULL_NEW
Data delivery mode: Only on request (see requestData () request below), send data only from those subscribed devices that have produced new data since the last time data was pushed to this client. |
static byte |
PLAYER_DATAMODE_PUSH_ALL
Data delivery mode: Send data at a fixed rate (default 10Hz; see requestDataDeliveryFrequency() below to change the rate) from ALL subscribed devices , regardless of whether the data is new or old. |
static byte |
PLAYER_DATAMODE_PUSH_ASYNC
Data delivery mode: When a subscribed device produces new data, send it. |
static byte |
PLAYER_DATAMODE_PUSH_NEW
Data delivery mode: Send data at a fixed rate (default 10Hz; see requestDataDeliveryFrequency() below to change the rate) only from those subscribed devices that have produced new data since the last time data was pushed to this client. |
protected static short |
PLAYER_DESCARTES_CODE
|
protected static short |
PLAYER_DIO_CODE
|
protected static short |
PLAYER_ENERGY_CODE
|
static short |
PLAYER_ERROR_MODE
|
protected static short |
PLAYER_FIDUCIAL_CODE
|
protected static short |
PLAYER_GPS_CODE
|
protected static short |
PLAYER_GRIPPER_CODE
|
protected static short |
PLAYER_IDAR_CODE
|
protected static short |
PLAYER_IDARTURRET_CODE
|
protected static short |
PLAYER_IR_CODE
|
protected static short |
PLAYER_JOYSTICK_CODE
|
protected static short |
PLAYER_LASER_CODE
|
protected static short |
PLAYER_LOCALIZE_CODE
|
protected static short |
PLAYER_LOG_CODE
|
protected static short |
PLAYER_MAP_CODE
|
protected static short |
PLAYER_MAX_DEVICE_STRING_LEN
|
protected static short |
PLAYER_MAX_REQREP_SIZE
|
protected static short |
PLAYER_MCOM_CODE
|
protected static short |
PLAYER_MOTOR_CODE
|
protected static short |
PLAYER_MSGTYPE_CMD
|
protected static short |
PLAYER_MSGTYPE_DATA
|
protected static short |
PLAYER_MSGTYPE_REQ
|
protected static short |
PLAYER_MSGTYPE_RESP_ACK
|
protected static short |
PLAYER_MSGTYPE_RESP_ERR
|
protected static short |
PLAYER_MSGTYPE_RESP_NACK
|
protected static short |
PLAYER_MSGTYPE_SYNCH
|
protected static short |
PLAYER_NOMAD_CODE
|
protected static short |
PLAYER_NULL_CODE
|
protected static short |
PLAYER_OPAQUE_CODE
|
protected static short |
PLAYER_PLANNER_CODE
|
protected static short |
PLAYER_PLAYER_AUTH_REQ
|
protected static short |
PLAYER_PLAYER_CODE
|
protected static short |
PLAYER_PLAYER_DATA_REQ
|
protected static short |
PLAYER_PLAYER_DATAFREQ_REQ
|
protected static short |
PLAYER_PLAYER_DATAMODE_REQ
|
protected static short |
PLAYER_PLAYER_DEV_REQ
|
protected static short |
PLAYER_PLAYER_DEVLIST_REQ
|
protected static short |
PLAYER_PLAYER_DRIVERINFO_REQ
|
protected static short |
PLAYER_PLAYER_NAMESERVICE_REQ
|
protected static short |
PLAYER_POSITION_CODE
|
protected static short |
PLAYER_POSITION2D_CODE
|
protected static short |
PLAYER_POSITION3D_CODE
|
protected static short |
PLAYER_POWER_CODE
|
protected static short |
PLAYER_PTZ_CODE
|
static short |
PLAYER_READ_MODE
|
protected static short |
PLAYER_SERVICE_ADV_CODE
|
protected static short |
PLAYER_SIMULATION_CODE
|
protected static short |
PLAYER_SONAR_CODE
|
protected static short |
PLAYER_SOUND_CODE
|
protected static short |
PLAYER_SPEECH_CODE
|
protected static short |
PLAYER_SPEECH_RECOGNITION_CODE
|
protected static short |
PLAYER_STXX
|
protected static short |
PLAYER_TRUTH_CODE
|
protected static short |
PLAYER_WAVEFORM_CODE
|
protected static short |
PLAYER_WIFI_CODE
|
static short |
PLAYER_WRITE_MODE
|
protected java.net.Socket |
socket
|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
PlayerClient(java.lang.String serverName,
int portNumber)
The PlayerClient constructor. |
Method Summary | |
---|---|
void |
close()
The PlayerClient "destructor". |
int |
getI()
Get the device list index. |
PlayerDeviceDriverInfo |
getPDDI()
Get the driver name for a particular device after a PLAYER_PLAYER_DRIVERINFO_REQ request. |
PlayerDeviceDevlistT |
getPDDT()
Get the list of available devices after a PLAYER_PLAYER_DEVLIST_REQ request. |
int |
getPortNumber()
Get the port number for the specified robot after a PLAYER_PLAYER_NAMESERVICE_REQ request. |
void |
handleResponse(int size)
Handle acknowledgement response messages (threaded mode). |
void |
incI(int increment)
Increments the device list index. |
boolean |
isAuthenticated()
Check to see if the client has authenticated successfully. |
boolean |
isReadyPDDI()
Check to see if the Player server replied with a PLAYER_PLAYER_DRIVERINFO_REQ successfully. |
boolean |
isReadyPDDT()
Check to see if the Player server replied with a PLAYER_PLAYER_DEVLIST_REQ successfully. |
boolean |
isReadyPortNumber()
Check to see if the port number has been identified. |
void |
readAll()
Read the Player server replies in non-threaded mode. |
void |
requestAuthentication(byte[] key)
Configuration request: Authentication. |
void |
requestData()
Configuration request: Get data. |
void |
requestDataDeliveryFrequency(short frequency)
Configuration request: Change data delivery frequency. |
void |
requestDataDeliveryMode(byte mode)
Configuration request: Change data delivery mode. |
void |
requestDeviceList()
Configuration request: Get the list of available devices. |
void |
requestDriverName(short device)
Configuration request: Get the driver name for a particular device. |
AIOInterface |
requestInterfaceAIO(int index,
char r)
Request an AIO device. |
AudioInterface |
requestInterfaceAudio(int index,
char r)
Request an Audio device. |
AudioDSPInterface |
requestInterfaceAudioDSP(int index,
char r)
Request an AudioDSP device. |
AudioMixerInterface |
requestInterfaceAudioMixer(int index,
char r)
Request an AudioMixer device. |
BlinkenlightInterface |
requestInterfaceBlinkenlight(int index,
char r)
Request a Blinkenlight device. |
BlobfinderInterface |
requestInterfaceBlobfinder(int index,
char r)
Request a Blobfinder device. |
BumperInterface |
requestInterfaceBumper(int index,
char r)
Request a Bumper device. |
CameraInterface |
requestInterfaceCamera(int index,
char r)
Request a Camera device. |
DIOInterface |
requestInterfaceDIO(int index,
char r)
Request a DIO device. |
EnergyInterface |
requestInterfaceEnergy(int index,
char r)
Request a Energy device. |
FiducialInterface |
requestInterfaceFiducial(int index,
char r)
Request a Fiducial device. |
GPSInterface |
requestInterfaceGPS(int index,
char r)
Request a GPS device. |
GripperInterface |
requestInterfaceGripper(int index,
char r)
Request a Gripper device. |
IRInterface |
requestInterfaceIR(int index,
char r)
Request an IR device. |
JoystickInterface |
requestInterfaceJoystick(int index,
char r)
Request a Joystick device. |
LaserInterface |
requestInterfaceLaser(int index,
char r)
Request a Laser device. |
LocalizeInterface |
requestInterfaceLocalize(int index,
char r)
Request a Localize device. |
LogInterface |
requestInterfaceLog(int index,
char r)
Request a Log device. |
MapInterface |
requestInterfaceMap(int index,
char r)
Request a Map device. |
MComInterface |
requestInterfaceMCom(int index,
char r)
Request a MComm device. |
MotorInterface |
requestInterfaceMotor(int index,
char r)
Request a Motor device. |
NomadInterface |
requestInterfaceNomad(int index,
char r)
Request a Nomad device. |
PlannerInterface |
requestInterfacePlanner(int index,
char r)
Request a Planner device. |
PositionInterface |
requestInterfacePosition(int index,
char r)
Request a Position device. |
Position2DInterface |
requestInterfacePosition2D(int index,
char r)
Request a Position2D device. |
Position3DInterface |
requestInterfacePosition3D(int index,
char r)
Request a Position3D device. |
PowerInterface |
requestInterfacePower(int index,
char r)
Request a Power device. |
PtzInterface |
requestInterfacePtz(int index,
char r)
Request a Ptz device. |
SimulationInterface |
requestInterfaceSimulation(int index,
char r)
Request a Simulation device. |
SonarInterface |
requestInterfaceSonar(int index,
char r)
Request a Sonar device. |
SoundInterface |
requestInterfaceSound(int index,
char r)
Request a Sound device. |
SpeechInterface |
requestInterfaceSpeech(int index,
char r)
Request a Speech device. |
SpeechRecognitionInterface |
requestInterfaceSpeechRecognition(int index,
char r)
Request a Speech Recognition device. |
TruthInterface |
requestInterfaceTruth(int index,
char r)
Request a Truth device. |
WaveformInterface |
requestInterfaceWaveform(int index,
char r)
Request a Waveform device. |
WiFiInterface |
requestInterfaceWiFi(int index,
char r)
Request a WiFi device. |
void |
requestNameService(char[] name)
Use nameservice to get the corresponding port for a robot name (only with Stage). |
void |
run()
Start the Javaclient thread. |
void |
runThreaded(long millis,
int nanos)
Start a threaded copy of Javaclient. |
void |
setNotThreaded()
Change the mode Javaclient runs to non-threaded. |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final boolean isDebugging
protected static final short PLAYER_STXX
protected static final short PLAYER_MAX_DEVICE_STRING_LEN
protected static final short PLAYER_PLAYER_DEVLIST_REQ
protected static final short PLAYER_PLAYER_DRIVERINFO_REQ
protected static final short PLAYER_PLAYER_DEV_REQ
protected static final short PLAYER_PLAYER_DATA_REQ
protected static final short PLAYER_PLAYER_DATAMODE_REQ
protected static final short PLAYER_PLAYER_DATAFREQ_REQ
protected static final short PLAYER_PLAYER_AUTH_REQ
protected static final short PLAYER_PLAYER_NAMESERVICE_REQ
protected static final short PLAYER_MSGTYPE_DATA
protected static final short PLAYER_MSGTYPE_CMD
protected static final short PLAYER_MSGTYPE_REQ
protected static final short PLAYER_MSGTYPE_RESP_ACK
protected static final short PLAYER_MSGTYPE_SYNCH
protected static final short PLAYER_MSGTYPE_RESP_NACK
protected static final short PLAYER_MSGTYPE_RESP_ERR
protected static final short PLAYER_NULL_CODE
protected static final short PLAYER_PLAYER_CODE
protected static final short PLAYER_POWER_CODE
protected static final short PLAYER_GRIPPER_CODE
protected static final short PLAYER_POSITION_CODE
protected static final short PLAYER_SONAR_CODE
protected static final short PLAYER_LASER_CODE
protected static final short PLAYER_BLOBFINDER_CODE
protected static final short PLAYER_PTZ_CODE
protected static final short PLAYER_AUDIO_CODE
protected static final short PLAYER_FIDUCIAL_CODE
protected static final short PLAYER_SPEECH_CODE
protected static final short PLAYER_GPS_CODE
protected static final short PLAYER_BUMPER_CODE
protected static final short PLAYER_TRUTH_CODE
protected static final short PLAYER_IDARTURRET_CODE
protected static final short PLAYER_IDAR_CODE
protected static final short PLAYER_DESCARTES_CODE
protected static final short PLAYER_DIO_CODE
protected static final short PLAYER_AIO_CODE
protected static final short PLAYER_IR_CODE
protected static final short PLAYER_WIFI_CODE
protected static final short PLAYER_WAVEFORM_CODE
protected static final short PLAYER_LOCALIZE_CODE
protected static final short PLAYER_MCOM_CODE
protected static final short PLAYER_SOUND_CODE
protected static final short PLAYER_AUDIODSP_CODE
protected static final short PLAYER_AUDIOMIXER_CODE
protected static final short PLAYER_POSITION3D_CODE
protected static final short PLAYER_SIMULATION_CODE
protected static final short PLAYER_SERVICE_ADV_CODE
protected static final short PLAYER_BLINKENLIGHT_CODE
protected static final short PLAYER_NOMAD_CODE
protected static final short PLAYER_CAMERA_CODE
protected static final short PLAYER_MAP_CODE
protected static final short PLAYER_PLANNER_CODE
protected static final short PLAYER_LOG_CODE
protected static final short PLAYER_ENERGY_CODE
protected static final short PLAYER_MOTOR_CODE
protected static final short PLAYER_POSITION2D_CODE
protected static final short PLAYER_JOYSTICK_CODE
protected static final short PLAYER_SPEECH_RECOGNITION_CODE
protected static final short PLAYER_OPAQUE_CODE
public static final short PLAYER_READ_MODE
public static final short PLAYER_WRITE_MODE
public static final short PLAYER_ALL_MODE
public static final short PLAYER_CLOSE_MODE
public static final short PLAYER_ERROR_MODE
protected static int N_DEVICES
public static int MAX_DEVICES
protected static final short PLAYER_MAX_REQREP_SIZE
public static final byte PLAYER_DATAMODE_PUSH_ALL
requestDataDeliveryFrequency(short)
,
Constant Field Valuespublic static final byte PLAYER_DATAMODE_PULL_ALL
requestData()
,
Constant Field Valuespublic static final byte PLAYER_DATAMODE_PUSH_NEW
requestDataDeliveryFrequency(short)
,
Constant Field Valuespublic static final byte PLAYER_DATAMODE_PULL_NEW
requestData()
,
Constant Field Valuespublic static final byte PLAYER_DATAMODE_PUSH_ASYNC
requestDataDeliveryFrequency(short)
,
Constant Field Valuesprotected PlayerDevice[][] deviceList
protected java.net.Socket socket
protected java.io.BufferedOutputStream buffer
public java.io.DataInputStream is
public java.io.DataOutputStream os
Constructor Detail |
---|
public PlayerClient(java.lang.String serverName, int portNumber)
serverName
- url of the host running PlayerportNumber
- the port number of the Player serverMethod Detail |
---|
public void close()
public void setNotThreaded()
public void runThreaded(long millis, int nanos)
millis
- number of miliseconds to sleep between callsnanos
- number of nanoseconds to sleep between callspublic void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public PowerInterface requestInterfacePower(int index, char r)
index
- the device indexr
- access mode
public GripperInterface requestInterfaceGripper(int index, char r)
index
- the device indexr
- access mode
public PositionInterface requestInterfacePosition(int index, char r)
index
- the device indexr
- access mode
public SonarInterface requestInterfaceSonar(int index, char r)
index
- the device indexr
- access mode
public LaserInterface requestInterfaceLaser(int index, char r)
index
- the device indexr
- access mode
public BlobfinderInterface requestInterfaceBlobfinder(int index, char r)
index
- the device indexr
- access mode
public PtzInterface requestInterfacePtz(int index, char r)
index
- the device indexr
- access mode
public AudioInterface requestInterfaceAudio(int index, char r)
index
- the device indexr
- access mode
public FiducialInterface requestInterfaceFiducial(int index, char r)
index
- the device indexr
- access mode
public SpeechInterface requestInterfaceSpeech(int index, char r)
index
- the device indexr
- access mode
public GPSInterface requestInterfaceGPS(int index, char r)
index
- the device indexr
- access mode
public BumperInterface requestInterfaceBumper(int index, char r)
index
- the device indexr
- access mode
public TruthInterface requestInterfaceTruth(int index, char r)
index
- the device indexr
- access mode
public DIOInterface requestInterfaceDIO(int index, char r)
index
- the device indexr
- access mode
public AIOInterface requestInterfaceAIO(int index, char r)
index
- the device indexr
- access mode
public IRInterface requestInterfaceIR(int index, char r)
index
- the device indexr
- access mode
public WiFiInterface requestInterfaceWiFi(int index, char r)
index
- the device indexr
- access mode
public WaveformInterface requestInterfaceWaveform(int index, char r)
index
- the device indexr
- access mode
public LocalizeInterface requestInterfaceLocalize(int index, char r)
index
- the device indexr
- access mode
public MComInterface requestInterfaceMCom(int index, char r)
index
- the device indexr
- access mode
public SoundInterface requestInterfaceSound(int index, char r)
index
- the device indexr
- access mode
public AudioDSPInterface requestInterfaceAudioDSP(int index, char r)
index
- the device indexr
- access mode
public AudioMixerInterface requestInterfaceAudioMixer(int index, char r)
index
- the device indexr
- access mode
public Position3DInterface requestInterfacePosition3D(int index, char r)
index
- the device indexr
- access mode
public SimulationInterface requestInterfaceSimulation(int index, char r)
index
- the device indexr
- access mode
public BlinkenlightInterface requestInterfaceBlinkenlight(int index, char r)
index
- the device indexr
- access mode
public NomadInterface requestInterfaceNomad(int index, char r)
index
- the device indexr
- access mode
public CameraInterface requestInterfaceCamera(int index, char r)
index
- the device indexr
- access mode
public MapInterface requestInterfaceMap(int index, char r)
index
- the device indexr
- access mode
public PlannerInterface requestInterfacePlanner(int index, char r)
index
- the device indexr
- access mode
public LogInterface requestInterfaceLog(int index, char r)
index
- the device indexr
- access mode
public EnergyInterface requestInterfaceEnergy(int index, char r)
index
- the device indexr
- access mode
public MotorInterface requestInterfaceMotor(int index, char r)
index
- the device indexr
- access mode
public Position2DInterface requestInterfacePosition2D(int index, char r)
index
- the device indexr
- access mode
public JoystickInterface requestInterfaceJoystick(int index, char r)
index
- the device indexr
- access mode
public SpeechRecognitionInterface requestInterfaceSpeechRecognition(int index, char r)
index
- the device indexr
- access mode
public void requestDeviceList()
public void requestDriverName(short device)
device
- the device identifierpublic void requestData()
public void requestDataDeliveryMode(byte mode)
mode
- the requested modepublic void requestDataDeliveryFrequency(short frequency)
frequency
- requested frequency in Hzpublic void requestAuthentication(byte[] key)
key
- the authentication keypublic void requestNameService(char[] name)
name
- the robot namepublic int getI()
incI(int)
public void incI(int increment)
increment
- number of incrementsgetI()
public void readAll()
public void handleResponse(int size)
size
- size of the payloadpublic PlayerDeviceDevlistT getPDDT()
isReadyPDDT()
public PlayerDeviceDriverInfo getPDDI()
isReadyPDDI()
public int getPortNumber()
requestNameService(char[])
,
isReadyPortNumber()
public boolean isReadyPDDT()
getPDDT()
public boolean isReadyPDDI()
getPDDI()
public boolean isAuthenticated()
public boolean isReadyPortNumber()
getPortNumber()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |