RoboidControl-cpp/DistanceSensor.h
2023-11-28 12:53:07 +01:00

31 lines
706 B
C++

#pragma once
#include "Sensor.h"
namespace Passer {
namespace RoboidControl {
/// @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;
};
} // namespace RoboidControl
} // namespace Passer
using namespace Passer::RoboidControl;