org.robokind.api.motion.messaging
Class RemoteRobotClient

java.lang.Object
  extended by org.robokind.api.motion.messaging.RemoteRobotClient

public class RemoteRobotClient
extends Object

Client for messaging with a RemoteRobotHost. Used by RemoteRobot to control a Robot through a messaging channel.

Author:
Matthew Stevenson

Field Summary
static int DEFAULT_TIMEOUT_LENGTH
          Default number of milliseconds before a request times out.
 
Constructor Summary
RemoteRobotClient(Robot.Id robotId, String sourceId, String destId, RobotRequestFactory reqFact, MotionFrameEvent.MotionFrameEventFactory motionFrameEventFactory)
          Creates a new RemoteRobotClient.
 
Method Summary
 boolean getConnected()
          Requests the remote Robot's connection status.
 String getDestinationId()
          Returns the String identifying the host, currently unused.
 boolean getEnabled()
          Requests the remote Robot's enabled status.
 boolean getJointEnabled(Robot.JointId jointId)
          Requests the remote Joint's enabled status.
 Robot.Id getRobotId()
          Returns the id of the remote Robot
 String getSourceId()
          Returns the String identifying this client, currently unused.
 Robot.RobotPositionMap requestCurrentPositions()
          Requests the remote Robot's current positions.
 Robot.RobotPositionMap requestDefaultPositions()
          Requests the remote Robot's default joint positions.
 Robot.RobotPositionMap requestGoalPositions()
          Requests the remote Robot's goal positions.
 RobotDefinitionResponse requestRobotDefinition()
          Requests a RobotDefinition from the host.
 boolean sendConnect()
          Sends a connect command to the remote Robot.
 boolean sendDisable()
          Sends an disable command to the remote Robot.
 boolean sendDisconnect()
          Sends a disconnect command to the remote Robot.
 boolean sendEnable()
          Sends an enable command to the remote Robot.
 boolean sendJointDisable(Robot.JointId jointId)
          Sends an disable command to a remote Joint.
 boolean sendJointEnable(Robot.JointId jointId)
          Sends an disable command to a remote Joint.
 void sendMovement(MotionFrame frame)
          Sends a MotionFrame to move a RemoteRobot.
 void setMotionFrameSender(org.robokind.api.messaging.MessageSender<MotionFrameEvent> frameSender)
          Sets the MotionFrameSender to use for sending MotionFrames to the host.
 void setRequestSender(org.robokind.api.messaging.MessageSender<RobotRequest> reqSender)
          Sets the MessageSender to send RobotRequests.
 void setResponseReceiver(org.robokind.api.messaging.MessageBlockingReceiver<RobotResponse> respRec)
          Sets the MessageReceiver to receive RobotResponses.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_TIMEOUT_LENGTH

public static final int DEFAULT_TIMEOUT_LENGTH
Default number of milliseconds before a request times out.

See Also:
Constant Field Values
Constructor Detail

RemoteRobotClient

public RemoteRobotClient(Robot.Id robotId,
                         String sourceId,
                         String destId,
                         RobotRequestFactory reqFact,
                         MotionFrameEvent.MotionFrameEventFactory motionFrameEventFactory)
Creates a new RemoteRobotClient.

Parameters:
robotId - id of the remote robot
sourceId - arbitrary String to identify this client
destId - arbitrary String to identify the host
reqFact - factory used for creating new RobotRequests
Method Detail

setRequestSender

public void setRequestSender(org.robokind.api.messaging.MessageSender<RobotRequest> reqSender)
Sets the MessageSender to send RobotRequests.

Parameters:
reqSender - MessageSender to use

setResponseReceiver

public void setResponseReceiver(org.robokind.api.messaging.MessageBlockingReceiver<RobotResponse> respRec)
Sets the MessageReceiver to receive RobotResponses.

Parameters:
respRec - MessageReceiver to use

setMotionFrameSender

public void setMotionFrameSender(org.robokind.api.messaging.MessageSender<MotionFrameEvent> frameSender)
Sets the MotionFrameSender to use for sending MotionFrames to the host.

Parameters:
frameSender - MotionFrameSender to use

getRobotId

public Robot.Id getRobotId()
Returns the id of the remote Robot

Returns:

getSourceId

public String getSourceId()
Returns the String identifying this client, currently unused.

Returns:
String identifying this client

getDestinationId

public String getDestinationId()
Returns the String identifying the host, currently unused.

Returns:
String identifying the host

requestRobotDefinition

public RobotDefinitionResponse requestRobotDefinition()
Requests a RobotDefinition from the host.

Returns:
RobotDefinition defining the remote robot

sendConnect

public boolean sendConnect()
Sends a connect command to the remote Robot.

Returns:
true if successful

sendDisconnect

public boolean sendDisconnect()
Sends a disconnect command to the remote Robot.

Returns:
true if successful

getConnected

public boolean getConnected()
Requests the remote Robot's connection status.

Returns:
remote Robot's connection status

sendEnable

public boolean sendEnable()
Sends an enable command to the remote Robot.

Returns:
true if successful

sendDisable

public boolean sendDisable()
Sends an disable command to the remote Robot.

Returns:
true if successful

getEnabled

public boolean getEnabled()
Requests the remote Robot's enabled status.

Returns:
remote Robot's enabled status

sendJointEnable

public boolean sendJointEnable(Robot.JointId jointId)
Sends an disable command to a remote Joint.

Parameters:
jointId - id of the remote Joint
Returns:
true if successful

sendJointDisable

public boolean sendJointDisable(Robot.JointId jointId)
Sends an disable command to a remote Joint.

Parameters:
jointId - id of the remote Joint
Returns:
true if successful

getJointEnabled

public boolean getJointEnabled(Robot.JointId jointId)
Requests the remote Joint's enabled status.

Parameters:
jointId - id of the remote Joint
Returns:
remote Robot's enabled status

requestDefaultPositions

public Robot.RobotPositionMap requestDefaultPositions()
Requests the remote Robot's default joint positions.

Returns:
remote Robot's default joint positions

requestGoalPositions

public Robot.RobotPositionMap requestGoalPositions()
Requests the remote Robot's goal positions.

Returns:
remote Robot's goal positions

requestCurrentPositions

public Robot.RobotPositionMap requestCurrentPositions()
Requests the remote Robot's current positions.

Returns:
remote Robot's current positions

sendMovement

public void sendMovement(MotionFrame frame)
Sends a MotionFrame to move a RemoteRobot.

Parameters:
frame - MotionFrame to send


Copyright © 2011-2013. All Rights Reserved.