RoboidControl-cpp/DistanceSensor.h
2023-11-23 15:55:55 +01:00

25 lines
568 B
C++

#pragma once
#include "Sensor.h"
/// @brief A Sensor which can measure the distance to the nearest object
class DistanceSensor : public Sensor {
public:
DistanceSensor();
DistanceSensor(float triggerDistance);
/// @brief Determine the distance to the nearest object
/// @return the measured distance in meters to the nearest object
virtual float GetDistance();
void SetDistance(float distance);
/// @brief The distance at which ObjectNearby triggers
float triggerDistance = 1;
bool IsOn();
bool isOff();
protected:
float distance = 0;
};