simworldobjects
Class SimRCX

java.lang.Object
  |
  +--simworldobjects.BasicSimObject
        |
        +--simworldobjects.SimRCX
All Implemented Interfaces:
AbstractRobot, SimObject

public class SimRCX
extends BasicSimObject
implements AbstractRobot

Simulates an RCX for use in SimWorld

Author:
Graham Ritchie

Field Summary
static int STATE_BACKWARD
           
static int STATE_FORWARD
           
static int STATE_LEFT
           
static int STATE_RIGHT
           
static int STATE_STOPPED
           
 
Constructor Summary
SimRCX(SimWorld w, Controller c)
          Constructor: sets up the robot with some predefined parameters
SimRCX(SimWorld w, Controller c, double height, double width, double length, java.lang.String type, double x, double y, double z, double bearingXY, double bearingXZ)
          Constructor: sets up the robot according to the parameters
 
Method Summary
 void backward()
          Sets the robot moving backwards, this will continue until some other method is called to stop it.
 void backward(int time)
          Makes the robot move backwards for the given amount of time
 void beep()
          Makes the robot beep
 void forward()
          Sets the robot moving forwards, this will continue until some other method is called to stop it.
 void forward(int time)
          Makes the robot move forwards for the given amount of time
 int getSensor1()
          Get the current reading of this sensor
 int getSensor2()
          Get the current reading of this sensor
 int getSensor3()
          Get the current reading of this sensor
 SimWorld getWorld()
           
 void left()
          Sets the robot spinning left, this will continue until some other method is called to stop it.
 void left(int time)
          Spins the robot left for the given amount of time
 void right()
          Sets the robot spinning right, this will continue until some other method is called to stop it.
 void right(int time)
          Spins the robot right for the given amount of time
 void stopMoving()
          Stops all motors immediately
 
Methods inherited from class simworldobjects.BasicSimObject
getActualBearingVelocityXY, getActualBearingVelocityXZ, getActualBearingXY, getActualBearingXZ, getActualVelocity, getDesiredBearingVelocityXY, getDesiredBearingVelocityXZ, getDesiredVelocity, getHeight, getLength, getType, getWidth, getXCoord, getYCoord, getZCoord, setActualBearingVelocityXY, setActualBearingVelocityXZ, setActualBearingXY, setActualBearingXZ, setActualVelocity, setDesiredBearingVelocityXY, setDesiredBearingVelocityXZ, setDesiredVelocity, setXCoord, setYCoord, setZCoord
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATE_STOPPED

public static final int STATE_STOPPED

STATE_FORWARD

public static final int STATE_FORWARD

STATE_BACKWARD

public static final int STATE_BACKWARD

STATE_RIGHT

public static final int STATE_RIGHT

STATE_LEFT

public static final int STATE_LEFT
Constructor Detail

SimRCX

public SimRCX(SimWorld w,
              Controller c)
Constructor: sets up the robot with some predefined parameters
Parameters:
w - the SimWorld where this SimRCX resides
c - the Controller of this SimRCX

SimRCX

public SimRCX(SimWorld w,
              Controller c,
              double height,
              double width,
              double length,
              java.lang.String type,
              double x,
              double y,
              double z,
              double bearingXY,
              double bearingXZ)
Constructor: sets up the robot according to the parameters
Method Detail

getWorld

public SimWorld getWorld()

forward

public void forward()
Sets the robot moving forwards, this will continue until some other method is called to stop it.
Specified by:
forward in interface AbstractRobot

forward

public void forward(int time)
Makes the robot move forwards for the given amount of time
Specified by:
forward in interface AbstractRobot
Parameters:
time - the time in milliseconds

backward

public void backward()
Sets the robot moving backwards, this will continue until some other method is called to stop it.
Specified by:
backward in interface AbstractRobot

backward

public void backward(int time)
Makes the robot move backwards for the given amount of time
Specified by:
backward in interface AbstractRobot
Parameters:
time - the time in milliseconds

right

public void right()
Sets the robot spinning right, this will continue until some other method is called to stop it.
Specified by:
right in interface AbstractRobot

right

public void right(int time)
Spins the robot right for the given amount of time
Specified by:
right in interface AbstractRobot
Parameters:
time - the time in milliseconds

left

public void left()
Sets the robot spinning left, this will continue until some other method is called to stop it.
Specified by:
left in interface AbstractRobot

left

public void left(int time)
Spins the robot left for the given amount of time
Specified by:
left in interface AbstractRobot
Parameters:
time - the time in milliseconds

stopMoving

public void stopMoving()
Stops all motors immediately
Specified by:
stopMoving in interface AbstractRobot

beep

public void beep()
Makes the robot beep
Specified by:
beep in interface AbstractRobot

getSensor1

public int getSensor1()
Get the current reading of this sensor
Specified by:
getSensor1 in interface AbstractRobot
Returns:
the current value

getSensor2

public int getSensor2()
Get the current reading of this sensor
Specified by:
getSensor2 in interface AbstractRobot
Returns:
the current value

getSensor3

public int getSensor3()
Get the current reading of this sensor
Specified by:
getSensor3 in interface AbstractRobot
Returns:
the current value