javaclient2
Class Position2DInterface

java.lang.Object
  extended by javaclient2.PlayerDevice
      extended by javaclient2.AbstractPositionDevice
          extended by javaclient2.Position2DInterface
All Implemented Interfaces:
PlayerConstants

public class Position2DInterface
extends AbstractPositionDevice

The position2d interface is used to control a mobile robot bases in 2D.

Version:
Author:
Radu Bogdan Rusu

Field Summary
 
Fields inherited from class javaclient2.PlayerDevice
is, os, pc
 
Fields inherited from interface javaclient2.structures.PlayerConstants
MCOM_CHANNEL_LEN, MCOM_DATA_BUFFER_SIZE, MCOM_DATA_LEN, MCOM_N_BUFS, PLAYER_ACTARRAY_ACTSTATE_BRAKED, PLAYER_ACTARRAY_ACTSTATE_IDLE, PLAYER_ACTARRAY_ACTSTATE_MOVING, PLAYER_ACTARRAY_ACTSTATE_STALLED, PLAYER_ACTARRAY_BRAKES_REQ, PLAYER_ACTARRAY_CODE, PLAYER_ACTARRAY_DATA_STATE, PLAYER_ACTARRAY_GET_GEOM_REQ, PLAYER_ACTARRAY_HOME_CMD, PLAYER_ACTARRAY_NUM_ACTUATORS, PLAYER_ACTARRAY_POS_CMD, PLAYER_ACTARRAY_POWER_REQ, PLAYER_ACTARRAY_SPEED_CMD, PLAYER_ACTARRAY_SPEED_REQ, PLAYER_ACTARRAY_STRING, PLAYER_ACTARRAY_TYPE_LINEAR, PLAYER_ACTARRAY_TYPE_ROTARY, PLAYER_AIO_CMD_STATE, PLAYER_AIO_CODE, PLAYER_AIO_DATA_STATE, PLAYER_AIO_MAX_INPUTS, PLAYER_AIO_MAX_OUTPUTS, PLAYER_AIO_STRING, PLAYER_AUDIO_CODE, PLAYER_AUDIO_COMMAND_BUFFER_SIZE, PLAYER_AUDIO_DATA_BUFFER_SIZE, PLAYER_AUDIO_PAIRS, PLAYER_AUDIO_STRING, PLAYER_AUDIODSP_CODE, PLAYER_AUDIODSP_DATA_TONES, PLAYER_AUDIODSP_GET_CONFIG, PLAYER_AUDIODSP_MAX_BITSTRING_LEN, PLAYER_AUDIODSP_MAX_FREQS, PLAYER_AUDIODSP_PLAY_CHIRP, PLAYER_AUDIODSP_PLAY_TONE, PLAYER_AUDIODSP_REPLAY, PLAYER_AUDIODSP_SET_CONFIG, PLAYER_AUDIODSP_STRING, PLAYER_AUDIOMIXER_CODE, PLAYER_AUDIOMIXER_GET_LEVELS, PLAYER_AUDIOMIXER_SET_IGAIN, PLAYER_AUDIOMIXER_SET_LINE, PLAYER_AUDIOMIXER_SET_MASTER, PLAYER_AUDIOMIXER_SET_MIC, PLAYER_AUDIOMIXER_SET_OGAIN, PLAYER_AUDIOMIXER_SET_PCM, PLAYER_AUDIOMIXER_STRING, PLAYER_BLINKENLIGHT_CMD_COLOR, PLAYER_BLINKENLIGHT_CMD_DUTYCYCLE, PLAYER_BLINKENLIGHT_CMD_PERIOD, PLAYER_BLINKENLIGHT_CMD_POWER, PLAYER_BLINKENLIGHT_CMD_STATE, PLAYER_BLINKENLIGHT_CODE, PLAYER_BLINKENLIGHT_DATA_STATE, PLAYER_BLINKENLIGHT_STRING, PLAYER_BLOBFINDER_CODE, PLAYER_BLOBFINDER_DATA_BLOBS, PLAYER_BLOBFINDER_MAX_BLOBS, PLAYER_BLOBFINDER_REQ_SET_COLOR, PLAYER_BLOBFINDER_REQ_SET_IMAGER_PARAMS, PLAYER_BLOBFINDER_STRING, PLAYER_BUMPER_CODE, PLAYER_BUMPER_DATA_GEOM, PLAYER_BUMPER_DATA_STATE, PLAYER_BUMPER_GET_GEOM, PLAYER_BUMPER_MAX_SAMPLES, PLAYER_BUMPER_STRING, PLAYER_CAMERA_CODE, PLAYER_CAMERA_COMPRESS_JPEG, PLAYER_CAMERA_COMPRESS_RAW, PLAYER_CAMERA_DATA_STATE, PLAYER_CAMERA_FORMAT_MONO16, PLAYER_CAMERA_FORMAT_MONO8, PLAYER_CAMERA_FORMAT_RGB565, PLAYER_CAMERA_FORMAT_RGB888, PLAYER_CAMERA_IMAGE_HEIGHT, PLAYER_CAMERA_IMAGE_SIZE, PLAYER_CAMERA_IMAGE_WIDTH, PLAYER_CAMERA_STRING, PLAYER_CLOSE_MODE, PLAYER_DATAMODE_PULL, PLAYER_DATAMODE_PUSH, PLAYER_DIO_CMD_VALUES, PLAYER_DIO_CODE, PLAYER_DIO_DATA_VALUES, PLAYER_DIO_STRING, PLAYER_ENERGY_CODE, PLAYER_ENERGY_DATA_STATE, PLAYER_ENERGY_SET_CHARGING_POLICY_REQ, PLAYER_ENERGY_STRING, PLAYER_ERROR_MODE, PLAYER_FIDUCIAL_CODE, PLAYER_FIDUCIAL_DATA_SCAN, PLAYER_FIDUCIAL_MAX_SAMPLES, PLAYER_FIDUCIAL_REQ_GET_FOV, PLAYER_FIDUCIAL_REQ_GET_GEOM, PLAYER_FIDUCIAL_REQ_GET_ID, PLAYER_FIDUCIAL_REQ_SET_FOV, PLAYER_FIDUCIAL_REQ_SET_ID, PLAYER_FIDUCIAL_STRING, PLAYER_GPS_CODE, PLAYER_GPS_DATA_STATE, PLAYER_GPS_STRING, PLAYER_GRAPHICS2D_CMD_CLEAR, PLAYER_GRAPHICS2D_CMD_DRAW, PLAYER_GRAPHICS2D_CMD_POINTS, PLAYER_GRAPHICS2D_CMD_POLYGON, PLAYER_GRAPHICS2D_CMD_POLYLINE, PLAYER_GRAPHICS2D_CODE, PLAYER_GRAPHICS2D_MAX_POINTS, PLAYER_GRAPHICS2D_STRING, PLAYER_GRAPHICS3D_CMD_CLEAR, PLAYER_GRAPHICS3D_CODE, PLAYER_GRAPHICS3D_MAX_POINTS, PLAYER_GRAPHICS3D_STRING, PLAYER_GRIPPER_CMD_STATE, PLAYER_GRIPPER_CODE, PLAYER_GRIPPER_DATA_STATE, PLAYER_GRIPPER_REQ_GET_GEOM, PLAYER_GRIPPER_STRING, PLAYER_HEALTH_CODE, PLAYER_HEALTH_DATA, PLAYER_HEALTH_STRING, PLAYER_IDENT_STRLEN, PLAYER_IMU_CODE, PLAYER_IMU_DATA_CALIB, PLAYER_IMU_DATA_EULER, PLAYER_IMU_DATA_QUAT, PLAYER_IMU_DATA_STATE, PLAYER_IMU_REQ_SET_DATATYPE, PLAYER_IMU_STRING, PLAYER_IR_CODE, PLAYER_IR_DATA_RANGES, PLAYER_IR_MAX_SAMPLES, PLAYER_IR_POSE, PLAYER_IR_POWER, PLAYER_IR_STRING, PLAYER_JOYSTICK_CODE, PLAYER_JOYSTICK_DATA_STATE, PLAYER_JOYSTICK_STRING, PLAYER_KEYLEN, PLAYER_LASER_CODE, PLAYER_LASER_DATA_SCAN, PLAYER_LASER_DATA_SCANPOSE, PLAYER_LASER_MAX_SAMPLES, PLAYER_LASER_REQ_GET_CONFIG, PLAYER_LASER_REQ_GET_GEOM, PLAYER_LASER_REQ_POWER, PLAYER_LASER_REQ_SET_CONFIG, PLAYER_LASER_STRING, PLAYER_LIMB_BRAKES_REQ, PLAYER_LIMB_CODE, PLAYER_LIMB_DATA, PLAYER_LIMB_GEOM_REQ, PLAYER_LIMB_HOME_CMD, PLAYER_LIMB_POWER_REQ, PLAYER_LIMB_SETPOSE_CMD, PLAYER_LIMB_SETPOSITION_CMD, PLAYER_LIMB_SPEED_REQ, PLAYER_LIMB_STATE_BRAKED, PLAYER_LIMB_STATE_COLL, PLAYER_LIMB_STATE_IDLE, PLAYER_LIMB_STATE_MOVING, PLAYER_LIMB_STATE_OOR, PLAYER_LIMB_STOP_CMD, PLAYER_LIMB_STRING, PLAYER_LIMB_VECMOVE_CMD, PLAYER_LOCALIZE_CODE, PLAYER_LOCALIZE_DATA_HYPOTHS, PLAYER_LOCALIZE_MAX_HYPOTHS, PLAYER_LOCALIZE_PARTICLES_MAX, PLAYER_LOCALIZE_REQ_GET_PARTICLES, PLAYER_LOCALIZE_REQ_SET_POSE, PLAYER_LOCALIZE_STRING, PLAYER_LOG_CODE, PLAYER_LOG_REQ_GET_STATE, PLAYER_LOG_REQ_SET_FILENAME, PLAYER_LOG_REQ_SET_READ_REWIND, PLAYER_LOG_REQ_SET_READ_STATE, PLAYER_LOG_REQ_SET_WRITE_STATE, PLAYER_LOG_STRING, PLAYER_LOG_TYPE_READ, PLAYER_LOG_TYPE_WRITE, PLAYER_MAP_CODE, PLAYER_MAP_DATA_INFO, PLAYER_MAP_MAX_SEGMENTS, PLAYER_MAP_MAX_TILE_SIZE, PLAYER_MAP_REQ_GET_DATA, PLAYER_MAP_REQ_GET_INFO, PLAYER_MAP_REQ_GET_VECTOR, PLAYER_MAP_STRING, PLAYER_MAX_DEVICES, PLAYER_MAX_DRIVER_STRING_LEN, PLAYER_MAX_MESSAGE_SIZE, PLAYER_MAX_REQREP_SIZE, PLAYER_MCOM_CLEAR, PLAYER_MCOM_CODE, PLAYER_MCOM_POP, PLAYER_MCOM_PUSH, PLAYER_MCOM_READ, PLAYER_MCOM_SET_CAPACITY, PLAYER_MCOM_STRING, PLAYER_MSGQUEUE_DEFAULT_MAXLEN, PLAYER_MSGTYPE_CMD, PLAYER_MSGTYPE_DATA, PLAYER_MSGTYPE_REQ, PLAYER_MSGTYPE_RESP_ACK, PLAYER_MSGTYPE_RESP_NACK, PLAYER_MSGTYPE_SYNCH, PLAYER_NOMAD_CODE, PLAYER_NOMAD_STRING, PLAYER_NULL_CODE, PLAYER_NULL_STRING, PLAYER_OPAQUE_CODE, PLAYER_OPAQUE_STRING, PLAYER_OPEN_MODE, PLAYER_PLANNER_CMD_GOAL, PLAYER_PLANNER_CODE, PLAYER_PLANNER_DATA_STATE, PLAYER_PLANNER_MAX_WAYPOINTS, PLAYER_PLANNER_REQ_ENABLE, PLAYER_PLANNER_REQ_GET_WAYPOINTS, PLAYER_PLANNER_STRING, PLAYER_PLAYER_CODE, PLAYER_PLAYER_REQ_ADD_REPLACE_RULE, PLAYER_PLAYER_REQ_AUTH, PLAYER_PLAYER_REQ_DATA, PLAYER_PLAYER_REQ_DATAFREQ, PLAYER_PLAYER_REQ_DATAMODE, PLAYER_PLAYER_REQ_DEV, PLAYER_PLAYER_REQ_DEVLIST, PLAYER_PLAYER_REQ_DRIVERINFO, PLAYER_PLAYER_REQ_IDENT, PLAYER_PLAYER_REQ_NAMESERVICE, PLAYER_PLAYER_STRING, PLAYER_POINTCLOUD3D_CODE, PLAYER_POINTCLOUD3D_DATA_STATE, PLAYER_POINTCLOUD3D_MAX_POINTS, PLAYER_POINTCLOUD3D_STRING, PLAYER_POSITION1D_CMD_POS, PLAYER_POSITION1D_CMD_VEL, PLAYER_POSITION1D_CODE, PLAYER_POSITION1D_DATA_GEOM, PLAYER_POSITION1D_DATA_STATE, PLAYER_POSITION1D_REQ_GET_GEOM, PLAYER_POSITION1D_REQ_MOTOR_POWER, PLAYER_POSITION1D_REQ_POSITION_MODE, PLAYER_POSITION1D_REQ_POSITION_PID, PLAYER_POSITION1D_REQ_RESET_ODOM, PLAYER_POSITION1D_REQ_SET_ODOM, PLAYER_POSITION1D_REQ_SPEED_PID, PLAYER_POSITION1D_REQ_SPEED_PROF, PLAYER_POSITION1D_REQ_VELOCITY_MODE, PLAYER_POSITION1D_STATUS_ENABLED, PLAYER_POSITION1D_STATUS_LIMIT_CEN, PLAYER_POSITION1D_STATUS_LIMIT_MAX, PLAYER_POSITION1D_STATUS_LIMIT_MIN, PLAYER_POSITION1D_STATUS_OC, PLAYER_POSITION1D_STATUS_TRAJ_COMPLETE, PLAYER_POSITION1D_STRING, PLAYER_POSITION2D_CMD_CAR, PLAYER_POSITION2D_CMD_POS, PLAYER_POSITION2D_CMD_VEL, PLAYER_POSITION2D_CODE, PLAYER_POSITION2D_DATA_GEOM, PLAYER_POSITION2D_DATA_STATE, PLAYER_POSITION2D_REQ_GET_GEOM, PLAYER_POSITION2D_REQ_MOTOR_POWER, PLAYER_POSITION2D_REQ_POSITION_MODE, PLAYER_POSITION2D_REQ_POSITION_PID, PLAYER_POSITION2D_REQ_RESET_ODOM, PLAYER_POSITION2D_REQ_SET_ODOM, PLAYER_POSITION2D_REQ_SPEED_PID, PLAYER_POSITION2D_REQ_SPEED_PROF, PLAYER_POSITION2D_REQ_VELOCITY_MODE, PLAYER_POSITION2D_STRING, PLAYER_POSITION3D_CMD_SET_POS, PLAYER_POSITION3D_CMD_SET_VEL, PLAYER_POSITION3D_CODE, PLAYER_POSITION3D_DATA_GEOMETRY, PLAYER_POSITION3D_DATA_STATE, PLAYER_POSITION3D_GET_GEOM, PLAYER_POSITION3D_MOTOR_POWER, PLAYER_POSITION3D_POSITION_MODE, PLAYER_POSITION3D_POSITION_PID, PLAYER_POSITION3D_RESET_ODOM, PLAYER_POSITION3D_SET_ODOM, PLAYER_POSITION3D_SPEED_PID, PLAYER_POSITION3D_SPEED_PROF, PLAYER_POSITION3D_STRING, PLAYER_POSITION3D_VELOCITY_MODE, PLAYER_POWER_CODE, PLAYER_POWER_DATA_STATE, PLAYER_POWER_MASK_CHARGING, PLAYER_POWER_MASK_JOULES, PLAYER_POWER_MASK_PERCENT, PLAYER_POWER_MASK_VOLTS, PLAYER_POWER_MASK_WATTS, PLAYER_POWER_SET_CHARGING_POLICY_REQ, PLAYER_POWER_STRING, PLAYER_PTZ_CMD_STATE, PLAYER_PTZ_CODE, PLAYER_PTZ_DATA_GEOM, PLAYER_PTZ_DATA_STATE, PLAYER_PTZ_MAX_CONFIG_LEN, PLAYER_PTZ_POSITION_CONTROL, PLAYER_PTZ_REQ_AUTOSERVO, PLAYER_PTZ_REQ_CONTROL_MODE, PLAYER_PTZ_REQ_GENERIC, PLAYER_PTZ_REQ_GEOM, PLAYER_PTZ_STRING, PLAYER_PTZ_VELOCITY_CONTROL, PLAYER_RFID_CODE, PLAYER_RFID_DATA, PLAYER_RFID_MAX_GUID, PLAYER_RFID_MAX_TAGS, PLAYER_RFID_REQ_LOCKTAG, PLAYER_RFID_REQ_POWER, PLAYER_RFID_REQ_READTAG, PLAYER_RFID_REQ_WRITETAG, PLAYER_RFID_STRING, PLAYER_SERVICE_ADV_CODE, PLAYER_SERVICE_ADV_STRING, PLAYER_SIMULATION_CODE, PLAYER_SIMULATION_IDENTIFIER_MAXLEN, PLAYER_SIMULATION_REQ_GET_POSE2D, PLAYER_SIMULATION_REQ_SET_POSE2D, PLAYER_SIMULATION_STRING, PLAYER_SONAR_CODE, PLAYER_SONAR_DATA_GEOM, PLAYER_SONAR_DATA_RANGES, PLAYER_SONAR_MAX_SAMPLES, PLAYER_SONAR_REQ_GET_GEOM, PLAYER_SONAR_REQ_POWER, PLAYER_SONAR_STRING, PLAYER_SOUND_CMD_IDX, PLAYER_SOUND_CODE, PLAYER_SOUND_STRING, PLAYER_SPEECH_CMD_SAY, PLAYER_SPEECH_CODE, PLAYER_SPEECH_MAX_STRING_LEN, PLAYER_SPEECH_RECOGNITION_CODE, PLAYER_SPEECH_RECOGNITION_STRING, PLAYER_SPEECH_STRING, PLAYER_TRUTH_CODE, PLAYER_TRUTH_DATA_FIDUCIAL_ID, PLAYER_TRUTH_DATA_POSE, PLAYER_TRUTH_REQ_GET_FIDUCIAL_ID, PLAYER_TRUTH_REQ_SET_FIDUCIAL_ID, PLAYER_TRUTH_REQ_SET_POSE, PLAYER_TRUTH_STRING, PLAYER_WAVEFORM_CODE, PLAYER_WAVEFORM_DATA_MAX, PLAYER_WAVEFORM_DATA_SAMPLE, PLAYER_WAVEFORM_STRING, PLAYER_WIFI_CODE, PLAYER_WIFI_DATA_STATE, PLAYER_WIFI_IWSPY_ADD, PLAYER_WIFI_IWSPY_DEL, PLAYER_WIFI_IWSPY_PING, PLAYER_WIFI_MAC, PLAYER_WIFI_MAX_LINKS, PLAYER_WIFI_MODE_ADHOC, PLAYER_WIFI_MODE_AUTO, PLAYER_WIFI_MODE_INFRA, PLAYER_WIFI_MODE_MASTER, PLAYER_WIFI_MODE_REPEAT, PLAYER_WIFI_MODE_SECOND, PLAYER_WIFI_MODE_UNKNOWN, PLAYER_WIFI_QUAL_DBM, PLAYER_WIFI_QUAL_REL, PLAYER_WIFI_QUAL_UNKNOWN, PLAYER_WIFI_STRING, PLAYER_WSN_CMD_DEVSTATE, PLAYER_WSN_CODE, PLAYER_WSN_DATA, PLAYER_WSN_MAX_NODES, PLAYER_WSN_REQ_DATAFREQ, PLAYER_WSN_REQ_DATATYPE, PLAYER_WSN_REQ_POWER, PLAYER_WSN_STRING, SPEECH_RECOGNITION_DATA_STRING, SPEECH_RECOGNITION_TEXT_LEN
 
Constructor Summary
protected Position2DInterface(PlayerClient pc)
          Constructor for Position2DInterface.
 
Method Summary
 PlayerPosition2dData getData()
          Get the Position2D data.
 PlayerPosition2dGeom getGeom()
          Get the geometry data.
 float getX()
           
 float getY()
           
 float getYaw()
           
protected  void handleResponse(PlayerMsgHdr header)
          Handle acknowledgement response messages.
 boolean isDataReady()
          Check if data is available.
 boolean isGeomReady()
          Check if geometry data is available.
 void queryGeometry()
          Request/reply: Query geometry.
 void readData(PlayerMsgHdr header)
          Read the position2d data values (state or geom).
 void resetOdometry()
          Configuration request: Reset odometry.
 void setCarCMD(double velocity, double angle)
          The position interface accepts new carlike velocity (speed and turning angle) for the robot's motors (only supported by some drivers).
 void setControlMode(int state)
          Configuration request: Change control mode.
 void setMotorPower(int state)
          Configuration request: Motor power.
 void setOdometry(PlayerPose pose)
          Configuration request: Set odometry.
 void setPosition(PlayerPose pos, PlayerPose vel, int state)
          The position interface accepts new positions for the robot's motors (drivers may support position control, speed control or both).
 void setPosition(PlayerPosition2dCmdPos pp2dcp)
          The position interface accepts new positions for the robot's motors (drivers may support position control, speed control or both).
 void setPositionPIDParams(float kp, float ki, float kd)
          Configuration request: Set position PID parameters.
 void setSpeed(float speed, float turnrate)
           
 void setSpeedProfileParams(float speed, float acc)
          Configuration request: Set speed profile parameters.
 void setVelocity(PlayerPose vel, int state)
          The position interface accepts new velocities for the robot's motors (drivers may support position control, speed control or both).
 void setVelocity(PlayerPosition2dCmdVel pp2dcv)
          The position interface accepts new velocities for the robot's motors (drivers may support position control, speed control or both).
 void setVelocityControl(int mode)
          Configuration request: Change velocity control.
 void setVelocityPIDParams(float kp, float ki, float kd)
          Configuration request: Set velocity PID parameters.
 
Methods inherited from class javaclient2.PlayerDevice
getDeviceAccess, getDeviceAddress, getDeviceDriverName, handleNARMessage, sendHeader, setDeviceAccess, setDeviceAddress, setDeviceDriverName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Position2DInterface

protected Position2DInterface(PlayerClient pc)
Constructor for Position2DInterface.

Parameters:
pc - a reference to the PlayerClient object
Method Detail

readData

public void readData(PlayerMsgHdr header)
Read the position2d data values (state or geom).

Overrides:
readData in class PlayerDevice

setPosition

public void setPosition(PlayerPose pos,
                        PlayerPose vel,
                        int state)
The position interface accepts new positions for the robot's motors (drivers may support position control, speed control or both).

See the player_position2d_cmd_pos structure from player.h

Parameters:
pos - a PlayerPose structure containing the position data (x, y, yaw) [m, m, rad]
vel - a PlayerPose structure containing the velocity data (velocity at which to move to the position [m/s] or [rad/s])
state - motor state (zero is either off or locked, depending on the driver)

setPosition

public void setPosition(PlayerPosition2dCmdPos pp2dcp)
The position interface accepts new positions for the robot's motors (drivers may support position control, speed control or both).

See the player_position2d_cmd_pos structure from player.h

Parameters:
pp2dcp - a PlayerPosition2dCmdPos structure holding the required data

setVelocity

public void setVelocity(PlayerPose vel,
                        int state)
The position interface accepts new velocities for the robot's motors (drivers may support position control, speed control or both).

See the player_position2d_cmd_vel structure from player.h

Parameters:
vel - a PlayerPose structure containing the translational velocities (x, y, yaw) [m/s, m/s, rad/s]
state - motor state (zero is either off or locked, depending on the driver)

setVelocity

public void setVelocity(PlayerPosition2dCmdVel pp2dcv)
The position interface accepts new velocities for the robot's motors (drivers may support position control, speed control or both).

See the player_position2d_cmd_vel structure from player.h

Parameters:
pp2dcv - a PlayerPosition2dCmdVel structure holding the required data

setCarCMD

public void setCarCMD(double velocity,
                      double angle)
The position interface accepts new carlike velocity (speed and turning angle) for the robot's motors (only supported by some drivers).

See the player_position2d_cmd_car structure from player.h

Parameters:
velocity - forward velocity (m/s)
angle - turning angle (rad)

queryGeometry

public void queryGeometry()
Request/reply: Query geometry.


setMotorPower

public void setMotorPower(int state)
Configuration request: Motor power.

On some robots, the motor power can be turned on and off from software.

Be VERY careful with this command! You are very likely to start the robot running across the room at high speed with the battery charger still attached.

Parameters:
state - 0 for off, 1 for on

setVelocityControl

public void setVelocityControl(int mode)
Configuration request: Change velocity control.

Some robots offer different velocity control modes.

The p2os driver offers two modes of velocity control: separate translational and rotational control and direct wheel control. When in the separate mode, the robot's microcontroller internally computes left and right wheel velocities based on the currently commanded translational and rotational velocities and then attenuates these values to match a nice predefined acceleration profile. When in the direct mode, the microcontroller simply passes on the current left and right wheel velocities. Essentially, the separate mode offers smoother but slower (lower acceleration) control, and the direct mode offers faster but jerkier (higher acceleration) control. Player's default is to use the direct mode. Set mode to zero for direct control and non-zero for separate control.

For the reb driver, 0 is direct velocity control, 1 is for velocity-based heading PD controller.

Parameters:
mode - driver-specific mode

resetOdometry

public void resetOdometry()
Configuration request: Reset odometry.

Resets the robot's odometry to (x,y,theta) = (0,0,0).


setControlMode

public void setControlMode(int state)
Configuration request: Change control mode.

Parameters:
state - 0 for velocity mode, 1 for position mode

setOdometry

public void setOdometry(PlayerPose pose)
Configuration request: Set odometry.

Parameters:
pose - (x, y, yaw) [m, m, rad]

setVelocityPIDParams

public void setVelocityPIDParams(float kp,
                                 float ki,
                                 float kd)
Configuration request: Set velocity PID parameters.

Parameters:
kp - P parameter
ki - I parameter
kd - D parameter

setPositionPIDParams

public void setPositionPIDParams(float kp,
                                 float ki,
                                 float kd)
Configuration request: Set position PID parameters.

Parameters:
kp - P parameter
ki - I parameter
kd - D parameter

setSpeedProfileParams

public void setSpeedProfileParams(float speed,
                                  float acc)
Configuration request: Set speed profile parameters.

Parameters:
speed - max speed [m/s]
acc - max acceleration [m/s^2]

handleResponse

protected void handleResponse(PlayerMsgHdr header)
Handle acknowledgement response messages.

Overrides:
handleResponse in class PlayerDevice
Parameters:
header - Player header

getData

public PlayerPosition2dData getData()
Get the Position2D data.

Returns:
an object of type PlayerPosition2DData containing the requested data

getGeom

public PlayerPosition2dGeom getGeom()
Get the geometry data.

Returns:
an object of type PlayerPosition2DGeom containing the requested data

isDataReady

public boolean isDataReady()
Check if data is available.

Returns:
true if ready, false if not ready

isGeomReady

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

Returns:
true if ready, false if not ready

getX

public float getX()
Specified by:
getX in class AbstractPositionDevice

getY

public float getY()
Specified by:
getY in class AbstractPositionDevice

getYaw

public float getYaw()
Specified by:
getYaw in class AbstractPositionDevice

setSpeed

public void setSpeed(float speed,
                     float turnrate)
Specified by:
setSpeed in class AbstractPositionDevice