diff --git a/Peripherals/Inc/peripherals_ir_sensors.hpp b/Peripherals/Inc/peripherals_ir_sensors.hpp index 46399f6..e6c135d 100644 --- a/Peripherals/Inc/peripherals_ir_sensors.hpp +++ b/Peripherals/Inc/peripherals_ir_sensors.hpp @@ -17,6 +17,15 @@ namespace Peripherals { +struct IrSensorsReading +{ + /// Distance as read by the sensor. + float distance; + + /// @c true if the @c distance is < the wall threshold. + bool sees_object; +}; + template class IrSensors { @@ -61,16 +70,16 @@ public: } } - std::array, N> getDistanceData() + std::array getDistanceData() { - std::array, N> data; + std::array data; for (std::size_t i = 0; i < N; i++) { const float interim = averages_[i] - offsets_[i]; - data[i].first = multipliers_[i] * std::pow(interim, exponents_[i]); - data[i].second = data[i].first < wall_thresholds_[i]; + data[i].distance = multipliers_[i] * std::pow(interim, exponents_[i]); + data[i].sees_object = data[i].distance < wall_thresholds_[i]; } return data;