org.robokind.api.motion.sync
Class SynchronizedRobot

java.lang.Object
  extended by org.robokind.api.common.property.PropertyChangeNotifier
      extended by org.robokind.api.motion.AbstractRobot<org.robokind.api.motion.sync.SynchronizedJoint>
          extended by org.robokind.api.motion.sync.SynchronizedRobot
All Implemented Interfaces:
org.robokind.api.common.property.PropertyChangeSource, Robot<org.robokind.api.motion.sync.SynchronizedJoint>

public class SynchronizedRobot
extends AbstractRobot<org.robokind.api.motion.sync.SynchronizedJoint>

Holds multiple Robots and synchronizes their movements for the given JointIds. Events and JointProperties from the primary Robot are forwarded.

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
static String PROP_ADD_ROBOT
          Property change event name for adding a Robot.
static String PROP_REMOVE_ROBOT
          Property change event name for removing a Robot.
static org.robokind.api.common.config.VersionProperty VERSION
          Robot type VersionProperty.
static String VERSION_NAME
          Robot type version name.
static String VERSION_NUMBER
          Robot type version number.
 
Fields inherited from class org.robokind.api.motion.AbstractRobot
myJointList, myJointMap
 
Fields inherited from interface org.robokind.api.motion.Robot
PROP_CONNECTED, PROP_ENABLED, PROP_ID
 
Constructor Summary
SynchronizedRobot(Robot.Id robotId, Set<Joint.Id> jointIds)
          Creates a new SynchronizedRobot from the given values
SynchronizedRobot(SynchronizedRobotConfig config)
          Creates a new SynchronizedRobot from the given configuration.
 
Method Summary
 void addRobot(Robot robot)
          Adds a Robot to be Synchronized.
 boolean connect()
          The Robot will accept commands only after it is successfully connected.
 void disconnect()
          Disconnect the Robot.
 Robot getPrimaryRobot()
          Returns the primary Robot being synchronized.
 List<Robot> getRobots()
          Returns a List of all Robots being Synchronized.
 boolean isConnected()
          Returns true if the Robot is connected.
 void move(Robot.RobotPositionMap positions, long lenMillisec)
          Move the Joints with the given ids to the corresponding positions.
 void removeRobot(Robot.Id robotId)
          Removes a Robot from being Synchronized.
 void setPrimaryRobot(Robot.Id robotId)
          Sets the primary Robot.
 
Methods inherited from class org.robokind.api.motion.AbstractRobot
addJoint, clearJoints, getCurrentPositions, getDefaultPositions, getGoalPositions, getJoint, getJointIds, getJointList, getJointName, getRobotId, isEnabled, removeJoint, setEnabled
 
Methods inherited from class org.robokind.api.common.property.PropertyChangeNotifier
addPropertyChangeListener, addPropertyChangeListener, clearAllListeners, clearListeners, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, hasListeners, removePropertyChangeListener, removePropertyChangeListener
 
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.common.property.PropertyChangeSource
addPropertyChangeListener, addPropertyChangeListener, removePropertyChangeListener, removePropertyChangeListener
 

Field Detail

VERSION_NAME

public static final String VERSION_NAME
Robot type version name.

See Also:
Constant Field Values

VERSION_NUMBER

public static final String VERSION_NUMBER
Robot type version number.

See Also:
Constant Field Values

VERSION

public static final org.robokind.api.common.config.VersionProperty VERSION
Robot type VersionProperty.


PROP_ADD_ROBOT

public static final String PROP_ADD_ROBOT
Property change event name for adding a Robot.

See Also:
Constant Field Values

PROP_REMOVE_ROBOT

public static final String PROP_REMOVE_ROBOT
Property change event name for removing a Robot.

See Also:
Constant Field Values
Constructor Detail

SynchronizedRobot

public SynchronizedRobot(SynchronizedRobotConfig config)
Creates a new SynchronizedRobot from the given configuration.

Parameters:
config - configuration for initializing the SynchronizedRobot

SynchronizedRobot

public SynchronizedRobot(Robot.Id robotId,
                         Set<Joint.Id> jointIds)
Creates a new SynchronizedRobot from the given values

Parameters:
robotId - unique Robot.Id for the SynchronizedRobot to use
jointIds - local ids of the joints to synchronize
Method Detail

connect

public boolean connect()
Description copied from interface: Robot
The Robot will accept commands only after it is successfully connected.

Returns:
true is successful

disconnect

public void disconnect()
Description copied from interface: Robot
Disconnect the Robot.


isConnected

public boolean isConnected()
Description copied from interface: Robot
Returns true if the Robot is connected.

Returns:
true if the Robot is connected

move

public void move(Robot.RobotPositionMap positions,
                 long lenMillisec)
Description copied from interface: Robot
Move the Joints with the given ids to the corresponding positions.

Parameters:
positions - map of Joint logical ids and positions
lenMillisec - duration of the movement in milliseconds

getPrimaryRobot

public Robot getPrimaryRobot()
Returns the primary Robot being synchronized. PropertyChangeEvents from the primary Robot are forwarded as PropertyChangeEvents from this Robot.

Returns:
primary Robot being synchronized

getRobots

public List<Robot> getRobots()
Returns a List of all Robots being Synchronized.

Returns:
List of all Robots being Synchronized

addRobot

public void addRobot(Robot robot)
Adds a Robot to be Synchronized.

Parameters:
robot - Robot to add

removeRobot

public void removeRobot(Robot.Id robotId)
Removes a Robot from being Synchronized.

Parameters:
robotId - robot to remove

setPrimaryRobot

public void setPrimaryRobot(Robot.Id robotId)
Sets the primary Robot. The PropertyChangeEvents from the primary robot are forwarded as PropertyChangeEvents from this Robot.

Parameters:
robotId -


Copyright © 2011-2013. All Rights Reserved.