public class DistanceSensor extends AbstractSensor
robot, robotId, robotMqttClient
Constructor and Description |
---|
DistanceSensor(Robot robot,
RobotMqttClient m)
DistanceSensor class
|
Modifier and Type | Method and Description |
---|---|
double |
getDistance()
Get the emulated distance sensor reading from the simulator
|
void |
handleSubscription(Robot robot,
MqttMsg m)
Handle distanceSensor related MQTT subscriptions
|
void |
sendDistance(double dist)
Send the current distance information on MQTT requests, Only for test,
virtual robots will not invoke this.
|
public DistanceSensor(Robot robot, RobotMqttClient m)
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 double getDistance() throws java.lang.Exception
SensorException
java.lang.Exception
public void sendDistance(double dist)
dist
- distanceReading