|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsimworldobjects.BasicSimObject
simworldobjects.SimRCX
Simulates an RCX for use in SimWorld
Field Summary | |
static int |
STATE_BACKWARD
|
static int |
STATE_FORWARD
|
static int |
STATE_LEFT
|
static int |
STATE_RIGHT
|
static int |
STATE_STOPPED
|
Fields inherited from interface interfaces.AbstractRobot |
BACKWARD, FORWARD, MOTOR_A, MOTOR_C |
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,
int battery)
Constructor: sets up the robot according to the parameters |
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 Modified by: Simon Zienkiewicz |
void |
displayTextLCD(java.lang.String word)
Display text on the LCD Modified 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 |
java.lang.String |
getLCDOutput()
|
int |
getMotorPower()
Gets the power of the motors for the robot Modified by: Simon Zienkiewicz |
boolean |
getSelected()
|
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 Modified by: Simon Zienkiewicz |
int |
getVoltage()
Gets the voltage of the RCX battery in MilliVolts Modified by: Simon Zienkiewicz |
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 |
lightEvent(int index)
|
void |
pause(int num)
Pauses the simulation Created by: Simon Zienkiewicz |
void |
pivotRotation()
|
void |
playTune(int frequency,
int duration)
Plays a sound Created by: Simon Zienkiewicz |
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 |
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 Modified by: Simon Zienkiewicz |
void |
setSelected(boolean selected)
|
void |
singleMotor(int motor,
int direction)
Sets a single Motor moving, this will continue until some other method is called to stop it |
void |
singleMotor(int motor,
int direction,
int time)
Sets a single Motor moving for the given amount of time |
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 |
void |
touchEvent(int index)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int STATE_STOPPED
public static final int STATE_FORWARD
public static final int STATE_BACKWARD
public static final int STATE_RIGHT
public static final int STATE_LEFT
Constructor Detail |
public SimRCX(SimWorld w, Controller c)
w
- the SimWorld where this SimRCX residesc
- the Controller of this SimRCXpublic 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, int battery)
Method Detail |
public boolean getSelected()
public void setSelected(boolean selected)
public SimWorld getWorld()
public void forward()
forward
in interface AbstractRobot
public void forward(int time)
forward
in interface AbstractRobot
time
- the time in millisecondspublic void backward()
backward
in interface AbstractRobot
public void backward(int time)
backward
in interface AbstractRobot
time
- the time in millisecondspublic void right()
right
in interface AbstractRobot
public void right(int time)
right
in interface AbstractRobot
time
- the time in millisecondspublic void left()
left
in interface AbstractRobot
public void left(int time)
left
in interface AbstractRobot
time
- the time in millisecondspublic void singleMotor(int motor, int direction)
singleMotor
in interface AbstractRobot
motor
- the motor number (AbstractRobot.MOTOR_A or AbstractRobot.MOTOR_C);direction
- the direction number (AbstractRobot.BACKWARDS or AbstractRobot.FORWARDSpublic void singleMotor(int motor, int direction, int time)
singleMotor
in interface AbstractRobot
motor
- the motor number (AbstractRobot.MOTOR_A or AbstractRobot.MOTOR_C);time
- the time in millisecondsdirection
- the direction number (AbstractRobot.BACKWARDS or AbstractRobot.FORWARDSpublic void pivotRotation()
public void stopMoving()
stopMoving
in interface AbstractRobot
public void beep()
beep
in interface AbstractRobot
public int getSensor1()
getSensor1
in interface AbstractRobot
public int getSensor2()
getSensor2
in interface AbstractRobot
public int getSensor3()
getSensor3
in interface AbstractRobot
public void clearLCD()
clearLCD
in interface AbstractRobot
public void displayNumberLCD(int num)
displayNumberLCD
in interface AbstractRobot
num
- the number to displaypublic void displayTextLCD(java.lang.String word)
displayTextLCD
in interface AbstractRobot
word
- string to displaypublic java.lang.String getLCDOutput()
public void setMotorPower(int power)
setMotorPower
in interface AbstractRobot
power
- the desired powerpublic int getMotorPower()
getMotorPower
in interface AbstractRobot
public boolean[] getTouchSensorStatus()
getTouchSensorStatus
in interface AbstractRobot
public int getVoltage()
getVoltage
in interface AbstractRobot
public int createTimer(int time)
AbstractRobot
createTimer
in interface AbstractRobot
time
- the delay for the timer
public void startTimer(int num)
AbstractRobot
startTimer
in interface AbstractRobot
num
- the timer numberpublic void stopTimer(int num)
AbstractRobot
stopTimer
in interface AbstractRobot
num
- the timer numberpublic void stopAllTimers()
AbstractRobot
stopAllTimers
in interface AbstractRobot
public int getDelay(int num)
AbstractRobot
getDelay
in interface AbstractRobot
num
- the timer number
public void setDelay(int num, int time)
AbstractRobot
setDelay
in interface AbstractRobot
num
- the timer numbertime
- the new delay timepublic void pause(int num)
AbstractRobot
pause
in interface AbstractRobot
num
- the number of millisecondspublic void activate()
AbstractRobot
activate
in interface AbstractRobot
public void lightEvent(int index)
public void touchEvent(int index)
public void playTune(int frequency, int duration)
AbstractRobot
playTune
in interface AbstractRobot
frequency
- the sound frequencyduration
- the duration of the sound in milliseconds
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |