javaclient
Class SimulationInterface

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

public class SimulationInterface
extends PlayerDevice

Player devices may either be real hardware or virtual devices generated by a simulator such as Stage or Gazebo. This interface provides direct access to a simulator.

Version:
Author:
Radu Bogdan Rusu

Field Summary
protected  short PLAYER_SIMULATION_GET_POSE2D
           
static short PLAYER_SIMULATION_IDENTIFIER_MAXLEN
          the maximum length of a string indentifying a simulation object
protected  short PLAYER_SIMULATION_SET_POSE2D
           
 
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
SimulationInterface(PlayerClient pc, short indexOfDevice)
          Constructor for SimulationInterface.
 
Method Summary
 void get2DPose(java.lang.String identifier)
          Configuration request: get 2D pose of a named simulation object.
 PlayerSimulationPose2D getSimulationPose2D()
          Get the 2D pose of a named simulation object.
 void handleNARMessage()
          Handle negative acknowledgement response messages.
 void handleResponse(int size)
          Handle acknowledgement response messages (threaded mode).
 boolean isPose2DReady()
          Check if pose data is available.
 void set2DPose(java.lang.String identifier, int x, int y, int theta)
          Configuration request: set 2D pose of a named simulation object.
 
Methods inherited from class javaclient.PlayerDevice
getTimeForDataSampled_sec, getTimeForDataSampled_usec, getTimeForDataSampled, getTimeForDataSent_sec, getTimeForDataSent_usec, getTimeForDataSent, handleEARMessage, readData, readHeader, sendHeader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PLAYER_SIMULATION_SET_POSE2D

protected final short PLAYER_SIMULATION_SET_POSE2D
See Also:
Constant Field Values

PLAYER_SIMULATION_GET_POSE2D

protected final short PLAYER_SIMULATION_GET_POSE2D
See Also:
Constant Field Values

PLAYER_SIMULATION_IDENTIFIER_MAXLEN

public static final short PLAYER_SIMULATION_IDENTIFIER_MAXLEN
the maximum length of a string indentifying a simulation object

See Also:
Constant Field Values
Constructor Detail

SimulationInterface

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

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

set2DPose

public void set2DPose(java.lang.String identifier,
                      int x,
                      int y,
                      int theta)
Configuration request: set 2D pose of a named simulation object.

To set or get the pose of an object in a simulator, use this message type. If the subtype is PLAYER_SIMULATION_SET_POSE2D, the server will ask the simulator to move the named object to the location specified by (x,y,a) and return ACK.

See the player_simulation_pose2d_req structure from player.h


get2DPose

public void get2DPose(java.lang.String identifier)
Configuration request: get 2D pose of a named simulation object.

To set or get the pose of an object in a simulator, use this message type. If the subtype is PLAYER_SIMULATION_GET_POSE2D, the server will attempt to locate the named object and reply with the same packet with (x,y,a) filled in. For all message subtypes, if the named object does not exist, or some other error occurs, the request should reply NACK.

See the player_simulation_pose2d_req structure from player.h


handleResponse

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

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

handleNARMessage

public void handleNARMessage()
Handle negative acknowledgement response messages.

Overrides:
handleNARMessage in class PlayerDevice

getSimulationPose2D

public PlayerSimulationPose2D getSimulationPose2D()
Get the 2D pose of a named simulation object.

Returns:
an object of type PlayerSimulationPose2D containing the required pose data

isPose2DReady

public boolean isPose2DReady()
Check if pose data is available.

Returns:
true if ready, false if not ready