1#ifndef BITSIM_SENSORS_INFRARED_SENSOR_H
2#define BITSIM_SENSORS_INFRARED_SENSOR_H
44 static std::shared_ptr<InfraredSensor>
create(
const std::string &backend_type,
45 const std::string &name);
47 explicit InfraredSensor(std::shared_ptr<backends::InfraredBackendBase> backend,
64 std::string
sensor_units()
const override {
return backend_->sensor_units(); }
66 std::shared_ptr<backends::SensorBackendBase>
backend_ptr()
const override {
return backend_; }
105 std::shared_ptr<backends::InfraredBackendBase> backend_;
The basic types of bitsim. Code outside this file names Eigen's matrix and vector types only through ...
std::string backend_type_str() const override
Definition infrared_sensor.h:62
void set_threshold(real_t threshold)
Definition infrared_sensor.cpp:53
const std::vector< real_t > & read_values() override
Read the backend, if the sensor is enabled.
Definition infrared_sensor.cpp:35
std::shared_ptr< backends::InfraredBackendBase > infrared_backend() const noexcept
Definition infrared_sensor.h:71
void init() override
Enable the sensor, with every element reading white until the first read.
Definition infrared_sensor.cpp:29
uint_t n_elements() const noexcept
Definition infrared_sensor.h:79
real_t threshold() const noexcept
Reflectances below this are dark.
Definition infrared_sensor.h:96
static std::shared_ptr< InfraredSensor > create(const std::string &backend_type, const std::string &name)
A sensor with a new backend of the given type, see backends::InfraredBackendBase::create.
Definition infrared_sensor.cpp:12
InfraredSensor(std::shared_ptr< backends::InfraredBackendBase > backend, const std::string &name=consts::INVALID_STR)
Definition infrared_sensor.cpp:19
std::string pattern() const
Definition infrared_sensor.cpp:86
static const std::string SENSOR_TYPE
The type of the sensor.
Definition infrared_sensor.h:38
std::string sensor_units() const override
Definition infrared_sensor.h:64
std::optional< std::array< real_t, 2 > > line_position() const
Definition infrared_sensor.cpp:64
std::shared_ptr< backends::SensorBackendBase > backend_ptr() const override
Definition infrared_sensor.h:66
bool is_dark(uint_t i) const
Definition infrared_sensor.cpp:62
SensorBase(const std::string &sensor_type, const std::string &sensor_name=bitsim::consts::INVALID_STR)
Definition sensor_base.h:134
const std::string INVALID_STR
Invalid string.
Definition bitsim_consts.h:21
Definition infrared_line_follower.h:9
Definition dc_motor_backend_base.h:9
std::size_t uint_t
uint_t
Definition bitsim_types.h:40
double real_t
real_t
Definition bitsim_types.h:20