javaclient
Class PlannerInterface

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

public class PlannerInterface
extends PlayerDevice

The planner interface provides control of a 2-D motion planner.

Version:
Author:
Radu Bogdan Rusu

Field Summary
protected static short PLAYER_PLANNER_ENABLE_REQ
           
protected static short PLAYER_PLANNER_GET_WAYPOINTS_REQ
           
static short PLAYER_PLANNER_MAX_WAYPOINTS
          the maximum number of waypoints in a single plan
 
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
PlannerInterface(PlayerClient pc, short indexOfDevice)
          Constructor for PlannerInterface.
 
Method Summary
 PlayerPlannerWaypointT[] getAllPPWT()
          Get the waypoints.
 short getCurWaypoint()
          Get the current waypoint index
 short getDone()
          Have we arrived at the goal?
 int getGa()
          Get the goal location (A - deg)
 int getGx()
          Get the goal location (X - mm)
 int getGy()
          Get the goal location (Y - mm)
 int getPa()
          Get the current location (A - deg)
 PlayerPlannerWaypointT getPPWT(int i)
          Get a specified waypoint from an array of waypoints.
 int getPx()
          Get the current location (X - mm)
 int getPy()
          Get the current location (Y - mm)
 short getValid()
          Did the planner find a valid path?
 int getWa()
          Get the current waypoint location (A - deg)
 int getWaypointCount()
          Get the number of waypoints to follow
 int getWaypointPlanCount()
          Get the number of waypoints in the plan
 void getWaypoints()
          Configuration request: Get waypoints.
 int getWx()
          Get the current waypoint location (X - mm)
 int getWy()
          Get the waypoint current location (Y - mm)
 void handleResponse(int size)
          Handle acknowledgement response messages (threaded mode).
 boolean isReadyPPWT()
          Check if waypoint data is available.
 void readData()
          Read the planner data.
 void setGoal(int newgx, int newgy, int newga)
          Sends a new goal to the planner interface.
 void setRobotMotion(byte state)
          Configuration request: Enable/disable robot motion.
 
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_PLANNER_GET_WAYPOINTS_REQ

protected static final short PLAYER_PLANNER_GET_WAYPOINTS_REQ
See Also:
Constant Field Values

PLAYER_PLANNER_ENABLE_REQ

protected static final short PLAYER_PLANNER_ENABLE_REQ
See Also:
Constant Field Values

PLAYER_PLANNER_MAX_WAYPOINTS

public static final short PLAYER_PLANNER_MAX_WAYPOINTS
the maximum number of waypoints in a single plan

See Also:
Constant Field Values
Constructor Detail

PlannerInterface

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

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

readData

public void readData()
Read the planner data.

Overrides:
readData in class PlayerDevice

getValid

public short getValid()
Did the planner find a valid path?

Returns:
1 if the planner found a valid path, 0 otherwise

getDone

public short getDone()
Have we arrived at the goal?

Returns:
1 if the goal was reached, 0 otherwise

getPx

public int getPx()
Get the current location (X - mm)

Returns:
the current X location in mm

getPy

public int getPy()
Get the current location (Y - mm)

Returns:
the current Y location in mm

getPa

public int getPa()
Get the current location (A - deg)

Returns:
the current A location in deg

getGx

public int getGx()
Get the goal location (X - mm)

Returns:
the goal X location in mm

getGy

public int getGy()
Get the goal location (Y - mm)

Returns:
the goal Y location in mm

getGa

public int getGa()
Get the goal location (A - deg)

Returns:
the goal A location in deg

getWx

public int getWx()
Get the current waypoint location (X - mm)

Returns:
the current waypoint X location in mm

getWy

public int getWy()
Get the waypoint current location (Y - mm)

Returns:
the current waypoint Y location in mm

getWa

public int getWa()
Get the current waypoint location (A - deg)

Returns:
the current waypoint A location in deg

getCurWaypoint

public short getCurWaypoint()
Get the current waypoint index

Returns:
the current waypoint index as a short

getWaypointPlanCount

public int getWaypointPlanCount()
Get the number of waypoints in the plan

Returns:
the number of waypoints in the plan as an int

setGoal

public void setGoal(int newgx,
                    int newgy,
                    int newga)
Sends a new goal to the planner interface.

Parameters:
newgx - goal location (X - mm)
newgy - goal location (Y - mm)
newga - goal location (A - deg)

getWaypoints

public void getWaypoints()
Configuration request: Get waypoints.

See the player_planner_waypoints_req structure from player.h


setRobotMotion

public void setRobotMotion(byte state)
Configuration request: Enable/disable robot motion.

See the player_planner_enable_req structure from player.h

Parameters:
state - 1 to enable, 0 to disable

handleResponse

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

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

getWaypointCount

public int getWaypointCount()
Get the number of waypoints to follow

Returns:
number of waypoints to follow as an int

getPPWT

public PlayerPlannerWaypointT getPPWT(int i)
Get a specified waypoint from an array of waypoints.

Returns:
an object of type PlayerPlannerWaypointT containing the requested data

getAllPPWT

public PlayerPlannerWaypointT[] getAllPPWT()
Get the waypoints.

Returns:
an array of objects of type PlayerPlannerWaypointT containing the requested data

isReadyPPWT

public boolean isReadyPPWT()
Check if waypoint data is available.

Returns:
true if ready, false if not ready