public class RobotMonitor
extends java.lang.Thread
Modifier and Type | Field and Description |
---|---|
comp329robosim.SimulatedRobot |
robot |
Constructor and Description |
---|
RobotMonitor(comp329robosim.SimulatedRobot r,
int d) |
Modifier and Type | Method and Description |
---|---|
java.awt.Color |
getCSenseColor()
Check the colour of the cell beneath the center of the robot.
|
int |
getDirection()
Get the current direction (as an offset to the robot heading) of
the sensor.
|
int |
getHeading()
Obtains the current position of the robot
The heading is in the nearest degree, such that
0 is along the y axis, and increasing
values rotate in a clockwise direction
|
int |
getUSenseRange()
Get the range of the nearest object in the direction of the sensor.
|
int |
getX()
Obtains the current position of the robot in the x axis (in mm)
|
int |
getY()
Obtains the current position of the robot in the y axis (in mm)
|
java.lang.Boolean |
isBumperPressed()
Check if the bumper is pressed.
|
void |
monitorRobotStatus(boolean verbose)
Turn on verbose diagnostics to check status of the robot.
|
void |
rotate(int degrees)
Travel a defined distance then stop
|
void |
run()
The monitor writes various bits of robot state to the screen, then sleeps.
|
void |
setDirection(int degrees)
Set the desired direction of the sensor, as an offset of the heading
of the robot.
|
java.lang.Boolean |
setTravelSpeed(int travelSpeed)
Locomotion: sets the current speed of the robot and
(implicitly) the rotation speed.
|
void |
travel(int distance)
Travel a defined distance then stop
|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
public java.lang.Boolean setTravelSpeed(int travelSpeed)
travelSpeed
- the travelSpeed to setpublic void travel(int distance)
distance
- the distance to travel in mmpublic void rotate(int degrees)
distance
- the distance to travel in mmpublic int getX()
public int getY()
public int getHeading()
public java.lang.Boolean isBumperPressed()
public java.awt.Color getCSenseColor()
public int getUSenseRange()
public void setDirection(int degrees)
angle
- (in degrees) from the heading of the robotpublic int getDirection()
public void monitorRobotStatus(boolean verbose)
verbose
- is either true (enable diagnostics) or false (disable diagnostics)public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread