public abstract class Robot extends java.lang.Object implements java.lang.Runnable, IRobotState
IRobotState.robotState
Modifier and Type | Field and Description |
---|---|
ColorSensor |
colorSensor |
Coordinate |
coordinates |
DirectedCommunication |
directedComm |
DistanceSensor |
distSensor |
protected int |
id |
MotionController |
motion |
NeoPixel |
neoPixel |
ProximitySensor |
proximitySensor |
protected char |
reality |
RobotMQTT |
robotMQTT |
RobotMqttClient |
robotMqttClient |
SimpleCommunication |
simpleComm |
protected IRobotState.robotState |
state |
Constructor and Description |
---|
Robot(int id,
double x,
double y,
double heading,
char reality)
Abstract Robot class
|
Modifier and Type | Method and Description |
---|---|
void |
delay(int milliseconds)
Delay the robot functionality for a given time
|
int |
getId()
Get robot Id
|
void |
handleSubscribeQueue()
Handle MQTT subscriptions
|
void |
reset()
Method which handles RESET command
|
void |
run()
Robot's main event loop
|
void |
setup()
Setup the modules, emulators and indicators
|
void |
start()
Method which handles START command
|
void |
stop()
Method which handles STOP command
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
communicationInterrupt, loop, sensorInterrupt
public DistanceSensor distSensor
public ProximitySensor proximitySensor
public ColorSensor colorSensor
public SimpleCommunication simpleComm
public DirectedCommunication directedComm
public NeoPixel neoPixel
public MotionController motion
public RobotMQTT robotMQTT
public Coordinate coordinates
public RobotMqttClient robotMqttClient
protected int id
protected char reality
protected IRobotState.robotState state
public Robot(int id, double x, double y, double heading, char reality)
id
- robot Idx
- X coordinate as doubley
- Y coordinate as doubleheading
- Heading direction in degrees, as doublereality
- Reality of the robot, currently only support 'V'public void setup()
public int getId()
public final void run()
run
in interface java.lang.Runnable
public final void handleSubscribeQueue() throws org.json.simple.parser.ParseException
org.json.simple.parser.ParseException
public void start()
start
in interface IRobotState
public void stop()
stop
in interface IRobotState
public void reset()
reset
in interface IRobotState
public void delay(int milliseconds)
delay,
- delay in milliseconds