interfaces
Interface AbstractRobot

All Known Implementing Classes:
RealRCX, SimRCX

public interface AbstractRobot

Interface class for both real and simulated robots. Defines all the input and output methods a controller can call.

Author:
Graham Ritchie && MODIFIED BY: Simon Zienkiewicz

Field Summary
static int BACKWARD
          constant for single motor to move backwards
static int FORWARD
          constant for single motor to move forwards
static int MOTOR_A
          constant for MOTOR A
static int MOTOR_C
          constant for MOTOR C
static int S1
          constant for sensor 1
static int S2
          constant for sensor 2
static int S3
          sconstant for sensor 3
 
Method Summary
 void activate()
          Activates the light and touch sensors Created by: Simon Zienkiewicz
 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 clearLCD()
          Clears the display on the LCD Modified by: Simon Zienkiewicz
 int createTimer(int time)
          Creates a timer Created by: Simon Zienkiewicz
 void displayNumberLCD(int num)
          Display numbers on the LCD Created by: Simon Zienkiewicz
 void displayTextLCD(java.lang.String word)
          Display text on the LCD Created by: Simon Zienkiewicz
 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 getDelay(int num)
          Gets the delay from the requested timer Created by: Simon Zienkiewicz
 int getMotorPower()
          Gets the power of the motors for the robot Created by: Simon Zienkiewicz
 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
 boolean[] getTouchSensorStatus()
          Gets an array of boolean values for the touch sensors Created by: Simon Zienkiewicz
 int getVoltage()
          Gets the voltage of the RCX battery in MilliVolts Created by: Simon Zienkiewicz
 void left()
          Sets the robot spinning left on a dime, this will continue until some other method is called to stop it.
 void left(int time)
          Spins the robot left on a dime for the given amount of time
 void pause(int num)
          Pauses the simulation Created by: Simon Zienkiewicz
 void playTune(int frequency, int duration)
          Plays a sound Created by: Simon Zienkiewicz
 void right()
          Sets the robot spinning right on a dime, this will continue until some other method is called to stop it.
 void right(int time)
          Spins the robot right on a dime for the given amount of time
 void setDelay(int num, int time)
          Sets the delay for the requested timer Created by: Simon Zienkiewicz
 void setMotorPower(int power)
          Sets the power of the motors for the robot Created by: Simon Zienkiewicz
 void singleMotor(int motor, int direction)
          Sets a single Motor moving, this will continue until some other method is called to stop it Created by: Simon Zienkiewicz
 void singleMotor(int motor, int direction, int time)
          Sets a single Motor moving for the given amount of time Created by: Simon Zienkiewicz
 void startTimer(int num)
          Starts the requested timer Created by: Simon Zienkiewicz
 void stopAllTimers()
          Stops all timers Created by: Simon Zienkiewicz
 void stopMoving()
          Stops all motors immediately
 void stopTimer(int num)
          Stops the requested timer Created by: Simon Zienkiewicz
 

Field Detail

BACKWARD

public static final int BACKWARD
constant for single motor to move backwards

See Also:
Constant Field Values

FORWARD

public static final int FORWARD
constant for single motor to move forwards

See Also:
Constant Field Values

MOTOR_A

public static final int MOTOR_A
constant for MOTOR A

See Also:
Constant Field Values

MOTOR_C

public static final int MOTOR_C
constant for MOTOR C

See Also:
Constant Field Values

S1

public static final int S1
constant for sensor 1

See Also:
Constant Field Values

S2

public static final int S2
constant for sensor 2

See Also:
Constant Field Values

S3

public static final int S3
sconstant for sensor 3

See Also:
Constant Field Values
Method Detail

forward

public void forward()
Sets the robot moving forwards, this will continue until some other method is called to stop it


forward

public void forward(int time)
Makes the robot move forwards for the given amount of time

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


backward

public void backward(int time)
Makes the robot move backwards for the given amount of time

Parameters:
time - the time in milliseconds

right

public void right()
Sets the robot spinning right on a dime, this will continue until some other method is called to stop it.


right

public void right(int time)
Spins the robot right on a dime for the given amount of time

Parameters:
time - the time in milliseconds

left

public void left()
Sets the robot spinning left on a dime, this will continue until some other method is called to stop it.


left

public void left(int time)
Spins the robot left on a dime for the given amount of time

Parameters:
time - the time in milliseconds

singleMotor

public void singleMotor(int motor,
                        int direction)
Sets a single Motor moving, this will continue until some other method is called to stop it Created by: Simon Zienkiewicz

Parameters:
direction - the direction number (AbstractRobot.BACKWARDS or AbstractRobot.FORWARDS
motor - the motor number (AbstractRobot.MOTOR_A or AbstractRobot.MOTOR_C);

singleMotor

public void singleMotor(int motor,
                        int direction,
                        int time)
Sets a single Motor moving for the given amount of time Created by: Simon Zienkiewicz

Parameters:
motor - the motor number (AbstractRobot.MOTOR_A or AbstractRobot.MOTOR_C);
direction - the direction number (AbstractRobot.BACKWARDS or AbstractRobot.FORWARDS
time - the time in milliseconds

stopMoving

public void stopMoving()
Stops all motors immediately


getSensor1

public int getSensor1()
Get the current reading of this sensor

Returns:
the current value

getSensor2

public int getSensor2()
Get the current reading of this sensor

Returns:
the current value

getSensor3

public int getSensor3()
Get the current reading of this sensor

Returns:
the current value

getTouchSensorStatus

public boolean[] getTouchSensorStatus()
Gets an array of boolean values for the touch sensors Created by: Simon Zienkiewicz

Returns:
boolean values of the status of the sensors

displayNumberLCD

public void displayNumberLCD(int num)
Display numbers on the LCD Created by: Simon Zienkiewicz

Parameters:
num - the number to display

clearLCD

public void clearLCD()
Clears the display on the LCD Modified by: Simon Zienkiewicz


displayTextLCD

public void displayTextLCD(java.lang.String word)
Display text on the LCD Created by: Simon Zienkiewicz

Parameters:
word - string to display

setMotorPower

public void setMotorPower(int power)
Sets the power of the motors for the robot Created by: Simon Zienkiewicz

Parameters:
power - the desired power

getMotorPower

public int getMotorPower()
Gets the power of the motors for the robot Created by: Simon Zienkiewicz

Returns:
the power of the motor 0-7

getVoltage

public int getVoltage()
Gets the voltage of the RCX battery in MilliVolts Created by: Simon Zienkiewicz

Returns:
int voltage in the battery of the RCX

activate

public void activate()
Activates the light and touch sensors Created by: Simon Zienkiewicz


playTune

public void playTune(int frequency,
                     int duration)
Plays a sound Created by: Simon Zienkiewicz

Parameters:
frequency - the sound frequency
duration - the duration of the sound in milliseconds

beep

public void beep()
Makes the robot beep


createTimer

public int createTimer(int time)
Creates a timer Created by: Simon Zienkiewicz

Parameters:
time - the delay for the timer
Returns:
int the timer number

startTimer

public void startTimer(int num)
Starts the requested timer Created by: Simon Zienkiewicz

Parameters:
num - the timer number

stopTimer

public void stopTimer(int num)
Stops the requested timer Created by: Simon Zienkiewicz

Parameters:
num - the timer number

stopAllTimers

public void stopAllTimers()
Stops all timers Created by: Simon Zienkiewicz


getDelay

public int getDelay(int num)
Gets the delay from the requested timer Created by: Simon Zienkiewicz

Parameters:
num - the timer number
Returns:
int the timer delay

setDelay

public void setDelay(int num,
                     int time)
Sets the delay for the requested timer Created by: Simon Zienkiewicz

Parameters:
num - the timer number
time - the new delay time

pause

public void pause(int num)
Pauses the simulation Created by: Simon Zienkiewicz

Parameters:
num - the number of milliseconds