public class ColorSensor extends AbstractSensor
robot, robotId, robotMqttClient
Constructor and Description |
---|
ColorSensor(Robot robot,
RobotMqttClient mqttClient)
ColorSensor class
|
Modifier and Type | Method and Description |
---|---|
RGBColorType |
getColor()
Get the emulated color sensor reading from the simulator
|
void |
handleSubscription(Robot robot,
MqttMsg m)
Handle colorSensor related MQTT subscriptions
|
void |
sendColor(int red,
int green,
int blue,
int ambient)
Send the current color information on MQTT requests, Only for test, virtual
robots will not invoke this.
|
public ColorSensor(Robot robot, RobotMqttClient mqttClient)
robot
- robot objectmqttClient
- mqttClient objectpublic void handleSubscription(Robot robot, MqttMsg m)
handleSubscription
in interface IMqttHandler
handleSubscription
in class AbstractSensor
robot
- Robot objectm
- Subscription topic received objectpublic RGBColorType getColor() throws SensorException
SensorException
public void sendColor(int red, int green, int blue, int ambient)
red
- Red intensity, [0,255]green
- Green intensity, [0,255]blue
- Blue intensity, [0,255]ambient
- Ambient status, [0,255]