Changed SwitchOn to ObjectNearby

This commit is contained in:
Pascal Serrarens 2023-12-05 12:39:12 +01:00
parent da29673459
commit 7e7db715b8
4 changed files with 5 additions and 5 deletions

View File

@ -12,7 +12,7 @@ float DistanceSensor::GetDistance() {
return distance;
};
bool DistanceSensor::IsOn() {
bool DistanceSensor::ObjectNearby() {
bool isOn = GetDistance() <= triggerDistance;
return isOn;
}

View File

@ -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

View File

@ -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;

View File

@ -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