Class Robot

java.lang.Object
  |
  +--Robot

public class Robot
extends java.lang.Object

A class to encapsulate the information and operations required to represent and manipulate a model of a robot. The Robot class is an implementation of the Singleton Pattern, as shown in Gamma et al (p. 127), which ensures only one instance of the Robot class is created, and provides access to that instance.


Inner Class Summary
 class Robot.Interpolator
          A public class to handle moving the Robot between two positions.
 
Field Summary
static int X_UP
          Constant to define the X-axis as the "up" direction.
static int Y_UP
          Constant to define the Y-axis as the "up" direction.
static int Z_UP
          Constant to define the Z-axis as the "up" direction.
 
Method Summary
static Robot getInstance()
          A static accessor to provide access to the singleton instance of the Robot class.
 JointVariables getJointVariables()
          Returns the current JointVariables object.
 javax.media.j3d.BranchGroup getModels()
          Returns the robot BranchGroup, assembled using the DH parameters.
 RemoteObservable getObservable()
          Gets the RemoteObservable Object.
 double getRotation()
          Returns the angle of rotation around the "up" axis.
 double getSpeed()
          Returns the speed of the robot's motion.
 int getUpAxis()
          Returns the axis defined as the "up" direction.
 double getZoom()
          Returns the initial zoom factor.
 void home()
          Moves the Robot to its 'home' position.
 void loadRobotModel(java.lang.String robotparser, java.io.Reader r)
          Loads the simulation configuration file from the Reader using configured RobotParser to parse the stream to configure the Robot object for the simulation.
 void moveJoint(java.lang.String name, double variable)
          Moves a specific joint to a given joint position.
protected  void moveToDestination(JointVariables destination)
          Moves the Robot to the target set of JointVariables, using an abstract interpolation algorithm.
 void moveToXYZ(double x, double y, double z)
          Moves the end-effector to a specific x, y, z coordinate.
 void setInvKin(InvKin theInvKin)
          Sets the InvKin object for the Robot.
 void setJointVariables(JointVariables theJointVariables)
          Sets the JointVariables object to use for the Robot.
 void setObservable(RemoteObservable theObservable)
          Sets the RemoteObservable Object.
 void setRotation(double rotation)
          Sets the angle of rotation around the "up" axis.
 void setSpeed(double speed)
          Sets the speed of the robot's motion.
 void setUpAxis(int upAxis)
          Sets the axis defined as the "up" direction.
 void setZoom(double zoomFactor)
          Sets the initial zoom factor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

X_UP

public static final int X_UP
Constant to define the X-axis as the "up" direction.

Y_UP

public static final int Y_UP
Constant to define the Y-axis as the "up" direction.

Z_UP

public static final int Z_UP
Constant to define the Z-axis as the "up" direction.
Method Detail

getInstance

public static Robot getInstance()
A static accessor to provide access to the singleton instance of the Robot class.

loadRobotModel

public void loadRobotModel(java.lang.String robotparser,
                           java.io.Reader r)
                    throws RobotParserException
Loads the simulation configuration file from the Reader using configured RobotParser to parse the stream to configure the Robot object for the simulation.
Parameters:
r - the Reader stream for the robot configuration file.
Throws:
RobotParserException - indicates error parsing configuration.

setUpAxis

public void setUpAxis(int upAxis)
Sets the axis defined as the "up" direction.
Parameters:
upAxis - the "up" direction; either X_UP, Y_UP, or Z_UP.

getUpAxis

public int getUpAxis()
Returns the axis defined as the "up" direction.
Returns:
the "up" direction; either X_UP, Y_UP, or Z_UP.

setRotation

public void setRotation(double rotation)
Sets the angle of rotation around the "up" axis.
Parameters:
the - angle of rotation.

getRotation

public double getRotation()
Returns the angle of rotation around the "up" axis.
Returns:
the angle of rotation.

setZoom

public void setZoom(double zoomFactor)
Sets the initial zoom factor.
Parameters:
zoomFactor - the view zoom scaling factor.

getZoom

public double getZoom()
Returns the initial zoom factor.
Returns:
the view zoom factor.

setObservable

public void setObservable(RemoteObservable theObservable)
Sets the RemoteObservable Object.
Parameters:
theObservable - the Observable object supplying updates.

getObservable

public RemoteObservable getObservable()
Gets the RemoteObservable Object.
Returns:
the Observable object supplying updates.

setJointVariables

public void setJointVariables(JointVariables theJointVariables)
Sets the JointVariables object to use for the Robot.
Parameters:
theJointVariables - the Joint Variables object to use.

getJointVariables

public JointVariables getJointVariables()
Returns the current JointVariables object.
Returns:
the current JointVariable object.

setInvKin

public void setInvKin(InvKin theInvKin)
Sets the InvKin object for the Robot.
Parameters:
theInvKin - the InvKin object to use for the Robot.

moveToDestination

protected void moveToDestination(JointVariables destination)
Moves the Robot to the target set of JointVariables, using an abstract interpolation algorithm.
Parameters:
destination - the destination for the Robot JointVariables.

home

public void home()
Moves the Robot to its 'home' position.

moveJoint

public void moveJoint(java.lang.String name,
                      double variable)
               throws OutOfRangeException
Moves a specific joint to a given joint position.
Parameters:
name - the name of the joint to move.
variable - the destination joint variable.
Throws:
thrown - if position outside robot's jointspace.

moveToXYZ

public void moveToXYZ(double x,
                      double y,
                      double z)
               throws OutOfRangeException
Moves the end-effector to a specific x, y, z coordinate.
Parameters:
x - the destination x-coordinate.
y - the destination y-coordinate.
z - the destination z-coordinate.

setSpeed

public void setSpeed(double speed)
Sets the speed of the robot's motion.
Parameters:
speed - the new speed for the robot's motion.

getSpeed

public double getSpeed()
Returns the speed of the robot's motion.
Returns:
the current speed for the robot's motion.

getModels

public javax.media.j3d.BranchGroup getModels()
Returns the robot BranchGroup, assembled using the DH parameters.
Returns:
the BranchGroup which describe the Robot's physical appearance.