Changed SwitchOn to ObjectNearby
This commit is contained in:
parent
da29673459
commit
7e7db715b8
@ -12,7 +12,7 @@ float DistanceSensor::GetDistance() {
|
||||
return distance;
|
||||
};
|
||||
|
||||
bool DistanceSensor::IsOn() {
|
||||
bool DistanceSensor::ObjectNearby() {
|
||||
bool isOn = GetDistance() <= triggerDistance;
|
||||
return isOn;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user