1#ifndef BITSIM_SENSORS_SENSOR_BASE_H
2#define BITSIM_SENSORS_SENSOR_BASE_H
66 void enable() noexcept { is_enabled_ =
true; }
71 void disable() noexcept { is_enabled_ =
false; }
81 std::string
sensor_name() const noexcept {
return sensor_name_; }
92 std::string
sensor_type() const noexcept {
return sensor_type_; }
94 virtual std::shared_ptr<backends::SensorBackendBase>
backend_ptr()
const
121 const std::string sensor_type_;
131 bool is_enabled_{
false};
The basic types of bitsim. Code outside this file names Eigen's matrix and vector types only through ...
virtual ~SensorBase()=default
Destructor.
virtual std::string backend_type_str() const =0
Definition sensor_base.cpp:10
virtual std::shared_ptr< backends::SensorBackendBase > backend_ptr() const
Definition sensor_base.h:94
std::vector< real_t > values_
The values last read by the sensor.
Definition sensor_base.h:110
std::string sensor_type() const noexcept
Definition sensor_base.h:92
std::shared_ptr< backends::SensorBackendBase > backend_ptr_
Pointer to backend tha actually handles the sensor.
Definition sensor_base.h:115
virtual std::string sensor_units() const =0
Definition sensor_base.cpp:11
virtual void init()=0
Initialize the sensor. Set the is is_enabled_ flag to true. and performs any other initializations re...
void set_sensor_name(const std::string &sensor_name) noexcept
Set the sensor name.
Definition sensor_base.h:87
const std::vector< real_t > & last_read_values() const noexcept
Definition sensor_base.h:76
void disable() noexcept
Disable the sensor.
Definition sensor_base.h:71
bool is_enabled() const noexcept
Returns true if the sensor is enabled.
Definition sensor_base.h:61
std::string sensor_name() const noexcept
Definition sensor_base.h:81
virtual const std::vector< real_t > & read_values()=0
SensorBase(const std::string &sensor_type, const std::string &sensor_name=bitsim::consts::INVALID_STR)
Definition sensor_base.h:134
void enable() noexcept
Set the is_enabled_ flag to true.
Definition sensor_base.h:66
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