1#ifndef BITSIM_SENSORS_BACKENDS_SENSOR_BACKEND_BASE_H
2#define BITSIM_SENSORS_BACKENDS_SENSOR_BACKEND_BASE_H
4#include "bitsim/bitsim_config.h"
10#include <chrono/physics/ChBody.h>
11#include <unordered_map>
97 add_visual_shape(
const std::unordered_map<std::string, std::any> &shape_properties) = 0;
120 std::shared_ptr<chrono::ChBody>
body_{
nullptr};
127 const std::string backend_type_;
132 real_t sampling_period_{0.0};
141 : backend_type_(backend_type)
The basic types of bitsim. Code outside this file names Eigen's matrix and vector types only through ...
SensorBackendBase(const std::string &backend_type)
Constructor.
Definition sensor_backend_base.h:140
real_t sampling_period() const noexcept
Returns the sampling period of the sensor.
Definition sensor_backend_base.h:40
virtual ~SensorBackendBase()=default
Destructor.
std::shared_ptr< chrono::ChBody > body_
The body on which the sensor sits.
Definition sensor_backend_base.h:120
void set_chrono_body(std::shared_ptr< chrono::ChBody > body)
Set the pointer to the body that this sensor is attached.
Definition sensor_backend_base.h:101
uint_t n_read_values() const noexcept
Definition sensor_backend_base.h:82
std::string backend_type_str() const noexcept
Return a string that specifies the type of the backend.
Definition sensor_backend_base.h:88
virtual std::string sensor_units() const
Definition sensor_backend_base.h:58
virtual std::vector< real_t > read_values()=0
Read the sensor value.
virtual void add_visual_shape(const std::unordered_map< std::string, std::any > &shape_properties)=0
Add a visual shape for the sensor in order to be visualized with Irrlicht. Concrete classes may choos...
void set_sampling_period(real_t period)
Set the sampling period of the backend.
Definition sensor_backend_base.h:46
virtual void load_from_json(const std::string &filename)=0
Load robot and simulation parameters from a JSON file.
void set_n_read_values(uint_t n) noexcept
Set how many values the implementation returns.
Definition sensor_backend_base.h:114
const std::string INVALID_STR
Invalid string.
Definition bitsim_consts.h:21
Definition camera_backend_base.h:19
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