From 7e7db715b80021e0ea55490f0cfff5fe7281cfb1 Mon Sep 17 00:00:00 2001 From: Pascal Serrarens Date: Tue, 5 Dec 2023 12:39:12 +0100 Subject: [PATCH] Changed SwitchOn to ObjectNearby --- DistanceSensor.cpp | 2 +- DistanceSensor.h | 2 +- Perception.cpp | 4 ++-- Perception.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/DistanceSensor.cpp b/DistanceSensor.cpp index be6f62d..5502abe 100644 --- a/DistanceSensor.cpp +++ b/DistanceSensor.cpp @@ -12,7 +12,7 @@ float DistanceSensor::GetDistance() { return distance; }; -bool DistanceSensor::IsOn() { +bool DistanceSensor::ObjectNearby() { bool isOn = GetDistance() <= triggerDistance; return isOn; } diff --git a/DistanceSensor.h b/DistanceSensor.h index c46f2ad..1b8a1ca 100644 --- a/DistanceSensor.h +++ b/DistanceSensor.h @@ -24,7 +24,7 @@ class DistanceSensor : public Sensor { /// @brief Indicate that an object is nearby /// @return True when an object is nearby - bool IsOn(); + bool ObjectNearby(); protected: /// @brief Distance to the closest object diff --git a/Perception.cpp b/Perception.cpp index 78f9971..3f9f889 100644 --- a/Perception.cpp +++ b/Perception.cpp @@ -112,7 +112,7 @@ float Perception::DistanceDown(float angle) { return minDistance; } -bool Perception::SwitchOn(float fromAngle, float toAngle) { +bool Perception::ObjectNearby(float fromAngle, float toAngle) { if (toAngle < fromAngle) return false; @@ -126,7 +126,7 @@ bool Perception::SwitchOn(float fromAngle, float toAngle) { if (thing->type == Thing::DistanceSensorType) { DistanceSensor* distanceSensor = (DistanceSensor*)thing; - if (distanceSensor != nullptr && distanceSensor->IsOn()) + if (distanceSensor != nullptr && distanceSensor->ObjectNearby()) return true; } else if (thing->type == Thing::SwitchType) { Switch* switchSensor = (Switch*)thing; diff --git a/Perception.h b/Perception.h index 7e22154..41ad782 100644 --- a/Perception.h +++ b/Perception.h @@ -101,7 +101,7 @@ class Perception { /// @return True is an object is closeby /// @note Whether an object is closeby depends on the Distance Sensor /// @remark This function is likely to change in the near future - bool SwitchOn(float fromAngle, float toAngle); + bool ObjectNearby(float fromAngle, float toAngle); protected: /// @brief The Placement of the Sensors used for Perception