kaos.robots.core.test
Class RobotClient

java.lang.Object
  extended by kaos.robots.core.test.RobotClient
All Implemented Interfaces:
java.awt.event.KeyListener, java.awt.event.MouseListener, java.util.EventListener, FeedbackReceiver, ActionStatusCallback, InfoStatusCallback, UserInput

public class RobotClient
extends java.lang.Object
implements FeedbackReceiver, UserInput, ActionStatusCallback, java.awt.event.KeyListener, java.awt.event.MouseListener


Nested Class Summary
 class RobotClient.StreamGobbler
          This class is used to handle the output from spawned processes *
 
Field Summary
protected  javax.swing.JTextField _attachment
           
protected  java.lang.String _basePath
           
 ActionStatusCallbackImpl _cbl
           
protected  RobotClient _client
           
protected  javax.swing.JCheckBox _connectCB
           
protected  boolean _connectedToRobot
           
protected  double _currentHdg
           
protected  javax.swing.JTextField _destination
           
protected  javax.swing.JTextField _domainTF
           
protected  javax.swing.JTextField _fileNameTF
           
protected  double _goalDist
           
protected  double _goalHdg
           
protected  javax.swing.JTextField _gpsCommPort
           
protected  javax.swing.JTextField _gpsOriginTF
           
protected  javax.swing.JCheckBox _guiCB
           
protected  javax.swing.JTextField _hostTF
           
protected  Logger _logger
           
protected  javax.swing.JTextField _lrbX
           
protected  javax.swing.JTextField _lrbY
           
protected  javax.swing.JTextField _mapTF
           
protected  javax.swing.JTextField _maxSpeedTF
           
protected  javax.swing.JTextField _moveRelX
           
protected  javax.swing.JTextField _moveRelY
           
protected  javax.swing.JTextField _moveToName
           
protected  javax.swing.JTextField _moveToPose
           
protected  javax.swing.JTextField _msg
           
protected  javax.swing.JTextField _nameTF
           
protected  javax.swing.JCheckBox _newJVMCB
           
protected  javax.swing.JTextField _originTF
           
protected  javax.swing.JTextField _phraseTF
           
protected  javax.swing.JTextField _pictureParameters
           
protected  Plotter _plotter
           
protected  KAoSPlotterPanel _plotterPanel
           
protected  javax.swing.JTextField _portTF
           
protected  javax.swing.JCheckBox _registerCB
           
protected  ExecutionManager _selectedRobot
           
protected  javax.swing.JTextField _setPose
           
protected  javax.swing.JTextField _sonarRangeTF
           
protected  javax.swing.JTextField _sonarTurnRateTF
           
protected  javax.swing.JCheckBox _spatialReasoningCB
           
protected  javax.swing.JTextField _subject
           
protected  javax.swing.JTabbedPane _tabPane
           
protected  javax.swing.JCheckBox _targetCB
           
protected  double _testX
           
protected  double _testY
           
protected  javax.swing.JTextField _timeoutTF
           
protected  double _turnHdg
           
protected  javax.swing.JTextField _ulbX
           
protected  javax.swing.JTextField _ulbY
           
protected  javax.swing.JCheckBox _useGPSHeadingCB
           
protected  java.lang.String recvMsg
           
 
Constructor Summary
RobotClient()
           
RobotClient(java.lang.String[] args)
           
 
Method Summary
 void clearPolygon()
           
 void createRobot(java.lang.String robotClass, java.lang.String[] args)
           
 void doubleClicked()
           
 Viewer getImageViewer()
           
 ExecutionManager getLocalRobotExecMgr(java.lang.String robotName)
           
 Plotter getPlotter()
           
 java.util.Vector<Point2d> getPolygon()
           
 java.lang.Object getReceiver(java.lang.String id)
           
 Area getSelectedArea()
           
 Coordinate getSelectedCoordinate()
           
 java.util.HashMap getSelectedRecievers()
           
 java.util.Vector getSelectedRobots()
           
 void hidePath()
           
 void init()
           
 void keyPressed(java.awt.event.KeyEvent evt)
           
 void keyReleased(java.awt.event.KeyEvent evt)
           
 void keyTyped(java.awt.event.KeyEvent evt)
           
static void main(java.lang.String[] args)
           
 void mouseClicked(java.awt.event.MouseEvent e)
           
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
           
 void mouseReleased(java.awt.event.MouseEvent e)
           
 void onAborted(java.util.Calendar time, java.lang.Object reason)
          This method is invoked when the requested action is aborted.
 void onAborted(java.util.Calendar time, java.lang.Object reason, java.lang.String actionID, java.lang.String robotID)
          This method is invoked when the requested action is aborted.
 void onAccepted(java.util.Calendar time, java.lang.Object acceptInfo)
          This method is invoked when the request is accepted by the receiver.
 void onAccepted(java.util.Calendar time, java.lang.Object acceptInfo, java.lang.String actionID, java.lang.String robotID)
          This method is invoked when the request is accepted by the robot.
 void onCompleted(java.util.Calendar time, java.lang.Object result)
          This method is invoked upon completion of the request.
 void onCompleted(java.util.Calendar time, java.lang.Object result, java.lang.String actionID, java.lang.String robotID)
          This method is invoked upon completion of the request byt the requested robot.
 void onRefused(java.util.Calendar time, java.lang.Object reason)
          This method is invoked when the request is refused by the receiver.
 void onRefused(java.util.Calendar time, java.lang.Object reason, java.lang.String actionID, java.lang.String robotID)
          This method is invoked when the request is refused by the robot.
 void onStarted(java.util.Calendar time, java.lang.Object startedInfo)
          This method is invoked when the requested action starts.
 void onStarted(java.util.Calendar time, java.lang.Object startedInfo, java.lang.String actionID, java.lang.String robotID)
          This method is invoked when the robot starts the requested action.
protected  void printDebugString(java.lang.String msg, int loggerDisplayLevel)
           
 void receiveKAoSStatus(java.lang.String statusMsg, java.lang.String actionID, java.lang.String robotID)
          Receive a status message describing the execution of the requested action.
 void reset()
          Reset callback settings.
 void sendCommand(java.lang.String actionName, java.util.HashMap properties)
           
 void setDatum(java.lang.String gpsString)
           
 void showPath(java.util.Vector path)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_client

protected RobotClient _client

_selectedRobot

protected ExecutionManager _selectedRobot

_logger

protected Logger _logger

_moveToName

protected javax.swing.JTextField _moveToName

_moveToPose

protected javax.swing.JTextField _moveToPose

_moveRelX

protected javax.swing.JTextField _moveRelX

_moveRelY

protected javax.swing.JTextField _moveRelY

_setPose

protected javax.swing.JTextField _setPose

_pictureParameters

protected javax.swing.JTextField _pictureParameters

_destination

protected javax.swing.JTextField _destination

_subject

protected javax.swing.JTextField _subject

_msg

protected javax.swing.JTextField _msg

_attachment

protected javax.swing.JTextField _attachment

_fileNameTF

protected javax.swing.JTextField _fileNameTF

_phraseTF

protected javax.swing.JTextField _phraseTF

_ulbX

protected javax.swing.JTextField _ulbX

_ulbY

protected javax.swing.JTextField _ulbY

_lrbX

protected javax.swing.JTextField _lrbX

_lrbY

protected javax.swing.JTextField _lrbY

_originTF

protected javax.swing.JTextField _originTF

_sonarRangeTF

protected javax.swing.JTextField _sonarRangeTF

_mapTF

protected javax.swing.JTextField _mapTF

recvMsg

protected java.lang.String recvMsg

_goalHdg

protected double _goalHdg

_turnHdg

protected double _turnHdg

_goalDist

protected double _goalDist

_connectedToRobot

protected boolean _connectedToRobot

_testX

protected double _testX

_testY

protected double _testY

_currentHdg

protected double _currentHdg

_basePath

protected java.lang.String _basePath

_cbl

public ActionStatusCallbackImpl _cbl

_plotter

protected Plotter _plotter

_targetCB

protected javax.swing.JCheckBox _targetCB

_newJVMCB

protected javax.swing.JCheckBox _newJVMCB

_guiCB

protected javax.swing.JCheckBox _guiCB

_connectCB

protected javax.swing.JCheckBox _connectCB

_registerCB

protected javax.swing.JCheckBox _registerCB

_useGPSHeadingCB

protected javax.swing.JCheckBox _useGPSHeadingCB

_spatialReasoningCB

protected javax.swing.JCheckBox _spatialReasoningCB

_tabPane

protected javax.swing.JTabbedPane _tabPane

_plotterPanel

protected KAoSPlotterPanel _plotterPanel

_hostTF

protected javax.swing.JTextField _hostTF

_portTF

protected javax.swing.JTextField _portTF

_nameTF

protected javax.swing.JTextField _nameTF

_domainTF

protected javax.swing.JTextField _domainTF

_gpsCommPort

protected javax.swing.JTextField _gpsCommPort

_maxSpeedTF

protected javax.swing.JTextField _maxSpeedTF

_timeoutTF

protected javax.swing.JTextField _timeoutTF

_gpsOriginTF

protected javax.swing.JTextField _gpsOriginTF

_sonarTurnRateTF

protected javax.swing.JTextField _sonarTurnRateTF
Constructor Detail

RobotClient

public RobotClient()

RobotClient

public RobotClient(java.lang.String[] args)
Method Detail

init

public void init()

sendCommand

public void sendCommand(java.lang.String actionName,
                        java.util.HashMap properties)

keyPressed

public void keyPressed(java.awt.event.KeyEvent evt)
Specified by:
keyPressed in interface java.awt.event.KeyListener

keyReleased

public void keyReleased(java.awt.event.KeyEvent evt)
Specified by:
keyReleased in interface java.awt.event.KeyListener

keyTyped

public void keyTyped(java.awt.event.KeyEvent evt)
Specified by:
keyTyped in interface java.awt.event.KeyListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Specified by:
mouseExited in interface java.awt.event.MouseListener

createRobot

public void createRobot(java.lang.String robotClass,
                        java.lang.String[] args)

setDatum

public void setDatum(java.lang.String gpsString)

onAccepted

public void onAccepted(java.util.Calendar time,
                       java.lang.Object acceptInfo,
                       java.lang.String actionID,
                       java.lang.String robotID)
This method is invoked when the request is accepted by the robot.

Specified by:
onAccepted in interface FeedbackReceiver
Parameters:
time - Calendar time of acceptance.
acceptInfo - Object containing additional (optional) info about the acceptance.
actionID - String containing the id of the requested action/information.
robotID - String containing the name of the robot performing the action.

onRefused

public void onRefused(java.util.Calendar time,
                      java.lang.Object reason,
                      java.lang.String actionID,
                      java.lang.String robotID)
This method is invoked when the request is refused by the robot.

Specified by:
onRefused in interface FeedbackReceiver
Parameters:
time - Calendar time of refusal.
reason - Object containing the reason for refusing the request.
actionID - String containing the id of the requested action/information.
robotID - String containing the name of the robot performing the action.

onCompleted

public void onCompleted(java.util.Calendar time,
                        java.lang.Object result,
                        java.lang.String actionID,
                        java.lang.String robotID)
This method is invoked upon completion of the request byt the requested robot.

Specified by:
onCompleted in interface FeedbackReceiver
Parameters:
time - Calendar time of information/action completion.
result - Object containing the result of the requested action.
actionID - String containing the id of the requested action/information.
robotID - String containing the name of the robot performing the action.

onStarted

public void onStarted(java.util.Calendar time,
                      java.lang.Object startedInfo,
                      java.lang.String actionID,
                      java.lang.String robotID)
This method is invoked when the robot starts the requested action.

Specified by:
onStarted in interface FeedbackReceiver
Parameters:
time - Calendar time of starting an action.
startedInfo - Object containing additional (optional) info about the start of the action.
actionID - String containing the id of the requested action/information.
robotID - String containing the name of the robot performing the action.

onAborted

public void onAborted(java.util.Calendar time,
                      java.lang.Object reason,
                      java.lang.String actionID,
                      java.lang.String robotID)
This method is invoked when the requested action is aborted.

Specified by:
onAborted in interface FeedbackReceiver
Parameters:
time - Calendar time of aborting an action.
reason - Object containing the reason for aborting an action.
actionID - String containing the id of the requested action/information.
robotID - String containing the name of the robot performing the action.

onAccepted

public void onAccepted(java.util.Calendar time,
                       java.lang.Object acceptInfo)
Description copied from interface: InfoStatusCallback
This method is invoked when the request is accepted by the receiver.

Specified by:
onAccepted in interface InfoStatusCallback
Parameters:
time - Calendar time of acceptance.
acceptInfo - Object containing additional (optional) info about the acceptance.

onRefused

public void onRefused(java.util.Calendar time,
                      java.lang.Object reason)
Description copied from interface: InfoStatusCallback
This method is invoked when the request is refused by the receiver.

Specified by:
onRefused in interface InfoStatusCallback
Parameters:
time - Calendar time of refusal.
reason - Object containing the reason for refusing the request.

onCompleted

public void onCompleted(java.util.Calendar time,
                        java.lang.Object result)
Description copied from interface: InfoStatusCallback
This method is invoked upon completion of the request.

Specified by:
onCompleted in interface InfoStatusCallback
Parameters:
time - Calendar time of information/action completion.
result - Object containing the result of the requested action.

onStarted

public void onStarted(java.util.Calendar time,
                      java.lang.Object startedInfo)
Description copied from interface: ActionStatusCallback
This method is invoked when the requested action starts.

Specified by:
onStarted in interface ActionStatusCallback
Parameters:
time - Calendar time of starting an action.
startedInfo - Object containing additional (optional) info about the start of the action.

onAborted

public void onAborted(java.util.Calendar time,
                      java.lang.Object reason)
Description copied from interface: ActionStatusCallback
This method is invoked when the requested action is aborted.

Specified by:
onAborted in interface ActionStatusCallback
Parameters:
time - Calendar time of aborting an action.
reason - Object containing the reason for aborting an action.

reset

public void reset()
Description copied from interface: InfoStatusCallback
Reset callback settings.

Specified by:
reset in interface InfoStatusCallback

receiveKAoSStatus

public void receiveKAoSStatus(java.lang.String statusMsg,
                              java.lang.String actionID,
                              java.lang.String robotID)
Receive a status message describing the execution of the requested action. There maybe several status messages sent during action execution.

Specified by:
receiveKAoSStatus in interface FeedbackReceiver
Parameters:
statusMsg - Object containing the result of the requested action/information.
actionID - String containing the id of the requested action/information.
robotID - String containing the name of the robot performing the action.

getSelectedCoordinate

public Coordinate getSelectedCoordinate()
Specified by:
getSelectedCoordinate in interface UserInput

getSelectedArea

public Area getSelectedArea()
Specified by:
getSelectedArea in interface UserInput

getPolygon

public java.util.Vector<Point2d> getPolygon()
Specified by:
getPolygon in interface UserInput

clearPolygon

public void clearPolygon()
Specified by:
clearPolygon in interface UserInput

getSelectedRecievers

public java.util.HashMap getSelectedRecievers()
Specified by:
getSelectedRecievers in interface UserInput

getReceiver

public java.lang.Object getReceiver(java.lang.String id)
Specified by:
getReceiver in interface UserInput

getSelectedRobots

public java.util.Vector getSelectedRobots()

getLocalRobotExecMgr

public ExecutionManager getLocalRobotExecMgr(java.lang.String robotName)

getImageViewer

public Viewer getImageViewer()
Specified by:
getImageViewer in interface UserInput

showPath

public void showPath(java.util.Vector path)
Specified by:
showPath in interface UserInput

hidePath

public void hidePath()
Specified by:
hidePath in interface UserInput

getPlotter

public Plotter getPlotter()
Specified by:
getPlotter in interface UserInput

doubleClicked

public void doubleClicked()

printDebugString

protected void printDebugString(java.lang.String msg,
                                int loggerDisplayLevel)

main

public static void main(java.lang.String[] args)