From 07254fd3ac2469559b29ce8d66cfeedd20d30a93 Mon Sep 17 00:00:00 2001 From: Pascal Serrarens Date: Thu, 23 Nov 2023 15:55:55 +0100 Subject: [PATCH] Updated documentation --- DistanceSensor.h | 39 +++++++++++++++------------------------ 1 file changed, 15 insertions(+), 24 deletions(-) diff --git a/DistanceSensor.h b/DistanceSensor.h index 8b363a9..87b3e26 100644 --- a/DistanceSensor.h +++ b/DistanceSensor.h @@ -2,32 +2,23 @@ #include "Sensor.h" -/// @brief A sensor which can measure the distance the the nearest object -class DistanceSensor : public Sensor -{ -public: - DistanceSensor(); // { isDistanceSensor = true; } - DistanceSensor(float triggerDistance); // { isDistanceSensor = true; this->triggerDistance = triggerDistance; } - /// @brief Determine the distance to the nearest object - /// @return the measured distance in meters to the nearest object - virtual float GetDistance(); // { return distance; }; - void SetDistance(float distance); // { this->distance = distance; }; // for simulation purposes +/// @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; + /// @brief The distance at which ObjectNearby triggers + float triggerDistance = 1; - bool IsOn(); - // { - // bool isOn = GetDistance() <= triggerDistance; - // return isOn; - // } + bool IsOn(); - bool isOff(); - // { - // bool isOff = GetDistance() > triggerDistance; - // return isOff; - // } + bool isOff(); -protected: - float distance = 0; + protected: + float distance = 0; };