org.robokind.api.motion
Class AbstractRobot<J extends Joint>

java.lang.Object
  extended by org.robokind.api.motion.AbstractRobot<J>
Type Parameters:
J - Type of Joint used by this Robot
All Implemented Interfaces:
Robot
Direct Known Subclasses:
ServoRobot

public abstract class AbstractRobot<J extends Joint>
extends Object
implements Robot

Provides common functionality for Robot implementations

Author:
Matthew Stevenson

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.robokind.api.motion.Robot
Robot.Id, Robot.JointId, Robot.RobotPositionHashMap, Robot.RobotPositionMap
 
Field Summary
protected  Map<Robot.JointId,J> myJointMap
          Map of the Robot's JointIds and Joints.
 
Fields inherited from interface org.robokind.api.motion.Robot
PROP_ID
 
Constructor Summary
AbstractRobot(Robot.Id robotId)
          Creates an empty Robot with the given RobotId
 
Method Summary
 Robot.RobotPositionMap getCurrentPositions()
          Returns a map of the Robot's Joint's ids and their current positions.
 Robot.RobotPositionMap getDefaultPositions()
          Returns a map of the Robot's Joint's ids and their default positions.
 Robot.RobotPositionMap getGoalPositions()
          Returns a map of the Robot's Joint's ids and their goal positions.
 Joint getJoint(Robot.JointId id)
          Return the Joint with the given id.
 Set<Robot.JointId> getJointIds()
          Returns a set of the Robot's Joint ids.
 String getJointName(Robot.JointId id)
          The Robot's name for the Joint with the given logical id.
 Map<Robot.JointId,String> getJointNames()
          Returns a map of the Robot's Joint's ids and their names.
 Map<Robot.JointId,J> getJoints()
          Returns a map of the Robot's Joints and their ids.
 Robot.Id getRobotId()
          Returns a String uniquely identifying this Robot.
 boolean isEnabled()
          Returns true if the Robot is enabled and accepting commands.
 void setEnabled(boolean val)
          Sets the enabled status of the Robot.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.robokind.api.motion.Robot
connect, disconnect, isConnected, move
 

Field Detail

myJointMap

protected Map<Robot.JointId,J extends Joint> myJointMap
Map of the Robot's JointIds and Joints.

Constructor Detail

AbstractRobot

public AbstractRobot(Robot.Id robotId)
Creates an empty Robot with the given RobotId

Parameters:
robotId - unique RobotId
Method Detail

getRobotId

public Robot.Id getRobotId()
Description copied from interface: Robot
Returns a String uniquely identifying this Robot.

Specified by:
getRobotId in interface Robot
Returns:
unique identifier for this Robot

getJoint

public Joint getJoint(Robot.JointId id)
Description copied from interface: Robot
Return the Joint with the given id.

Specified by:
getJoint in interface Robot
Parameters:
id - Joint's logical id
Returns:
Joint with the given logical id, null if no Joint is found

getJointIds

public Set<Robot.JointId> getJointIds()
Description copied from interface: Robot
Returns a set of the Robot's Joint ids.

Specified by:
getJointIds in interface Robot
Returns:
set of the Robot's Joint ids

getJoints

public Map<Robot.JointId,J> getJoints()
Description copied from interface: Robot
Returns a map of the Robot's Joints and their ids.

Specified by:
getJoints in interface Robot
Returns:
map of the Robot's Joints and their ids

getJointName

public String getJointName(Robot.JointId id)
Description copied from interface: Robot
The Robot's name for the Joint with the given logical id.

Specified by:
getJointName in interface Robot
Parameters:
id - Joint's logical id
Returns:
Robot's name for the Joint with the given logical id

isEnabled

public boolean isEnabled()
Returns true if the Robot is enabled and accepting commands.

Specified by:
isEnabled in interface Robot
Returns:
true if the Robot is enabled and accepting commands

setEnabled

public void setEnabled(boolean val)
Sets the enabled status of the Robot. The Robot only accepts new movements when Enabled is set to true.

Specified by:
setEnabled in interface Robot
Parameters:
val - enabled value

getJointNames

public Map<Robot.JointId,String> getJointNames()
Description copied from interface: Robot
Returns a map of the Robot's Joint's ids and their names.

Specified by:
getJointNames in interface Robot
Returns:
map of the Robot's Joint's ids and their names

getDefaultPositions

public Robot.RobotPositionMap getDefaultPositions()
Description copied from interface: Robot
Returns a map of the Robot's Joint's ids and their default positions.

Specified by:
getDefaultPositions in interface Robot
Returns:
map of the Robot's Joint's ids and their default positions

getCurrentPositions

public Robot.RobotPositionMap getCurrentPositions()
Description copied from interface: Robot
Returns a map of the Robot's Joint's ids and their current positions.

Specified by:
getCurrentPositions in interface Robot
Returns:
map of the Robot's Joint's ids and their current positions

getGoalPositions

public Robot.RobotPositionMap getGoalPositions()
Description copied from interface: Robot
Returns a map of the Robot's Joint's ids and their goal positions.

Specified by:
getGoalPositions in interface Robot
Returns:
map of the Robot's Joint's ids and their goal positions


Copyright © 2011. All Rights Reserved.