Changed SwitchOn to ObjectNearby
This commit is contained in:
parent
da29673459
commit
7e7db715b8
@ -12,7 +12,7 @@ float DistanceSensor::GetDistance() {
|
|||||||
return distance;
|
return distance;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool DistanceSensor::IsOn() {
|
bool DistanceSensor::ObjectNearby() {
|
||||||
bool isOn = GetDistance() <= triggerDistance;
|
bool isOn = GetDistance() <= triggerDistance;
|
||||||
return isOn;
|
return isOn;
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ class DistanceSensor : public Sensor {
|
|||||||
|
|
||||||
/// @brief Indicate that an object is nearby
|
/// @brief Indicate that an object is nearby
|
||||||
/// @return True when an object is nearby
|
/// @return True when an object is nearby
|
||||||
bool IsOn();
|
bool ObjectNearby();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// @brief Distance to the closest object
|
/// @brief Distance to the closest object
|
||||||
|
@ -112,7 +112,7 @@ float Perception::DistanceDown(float angle) {
|
|||||||
return minDistance;
|
return minDistance;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Perception::SwitchOn(float fromAngle, float toAngle) {
|
bool Perception::ObjectNearby(float fromAngle, float toAngle) {
|
||||||
if (toAngle < fromAngle)
|
if (toAngle < fromAngle)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ bool Perception::SwitchOn(float fromAngle, float toAngle) {
|
|||||||
|
|
||||||
if (thing->type == Thing::DistanceSensorType) {
|
if (thing->type == Thing::DistanceSensorType) {
|
||||||
DistanceSensor* distanceSensor = (DistanceSensor*)thing;
|
DistanceSensor* distanceSensor = (DistanceSensor*)thing;
|
||||||
if (distanceSensor != nullptr && distanceSensor->IsOn())
|
if (distanceSensor != nullptr && distanceSensor->ObjectNearby())
|
||||||
return true;
|
return true;
|
||||||
} else if (thing->type == Thing::SwitchType) {
|
} else if (thing->type == Thing::SwitchType) {
|
||||||
Switch* switchSensor = (Switch*)thing;
|
Switch* switchSensor = (Switch*)thing;
|
||||||
|
@ -101,7 +101,7 @@ class Perception {
|
|||||||
/// @return True is an object is closeby
|
/// @return True is an object is closeby
|
||||||
/// @note Whether an object is closeby depends on the Distance Sensor
|
/// @note Whether an object is closeby depends on the Distance Sensor
|
||||||
/// @remark This function is likely to change in the near future
|
/// @remark This function is likely to change in the near future
|
||||||
bool SwitchOn(float fromAngle, float toAngle);
|
bool ObjectNearby(float fromAngle, float toAngle);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// @brief The Placement of the Sensors used for Perception
|
/// @brief The Placement of the Sensors used for Perception
|
||||||
|
Loading…
x
Reference in New Issue
Block a user