5#include "../bitrl_consts.h"
67 void enable()noexcept{is_enabled_=
true;}
72 void disable()noexcept{is_enabled_=
false;}
112 const std::string sensor_type_;
122 bool is_enabled_{
false};
128sensor_type_(sensor_type),
129sensor_name_(sensor_name)
Class for modelling sensors. The interface follows closely the interface exposed by Webots see: https...
Definition sensor_base.h:28
void set_sensor_name(const std::string &sensor_name) noexcept
Set the sensor name.
Definition sensor_base.h:88
std::string sensor_type() const noexcept
Definition sensor_base.h:93
std::vector< real_t > values_
The values last read by the sensor.
Definition sensor_base.h:105
virtual ~SensorBase()=default
Destructor.
virtual std::string backend_type_str() const =0
Definition sensor_base.cpp:10
virtual std::string sensor_units() const =0
Definition sensor_base.cpp:11
void disable() noexcept
Disable the sensor.
Definition sensor_base.h:72
const std::vector< real_t > & last_read_values() const noexcept
Definition sensor_base.h:77
SensorBase(const std::string &sensor_type, const std::string &sensor_name=bitrl::consts::INVALID_STR)
Definition sensor_base.h:125
virtual const std::vector< real_t > & read_values()=0
bool is_enabled() const noexcept
Returns true if the sensor is enabled.
Definition sensor_base.h:62
void enable() noexcept
Set the is_enabled_ flag to true.
Definition sensor_base.h:67
std::string sensor_name() const noexcept
Definition sensor_base.h:82
virtual void init()=0
Initialize the sensor. Set the is is_enabled_ flag to true. and performs any other initializations re...
const std::string INVALID_STR
Invalid string.
Definition bitrl_consts.h:26
Definition bitrl_consts.h:14