|
bitsim
Model, simulate, estimate and control robots in C++
|
Base class for modelling sensors with different implementations. More...
#include <sensor_backend_base.h>

Public Member Functions | |
| virtual | ~SensorBackendBase ()=default |
| Destructor. | |
| real_t | sampling_period () const noexcept |
| Returns the sampling period of the sensor. | |
| void | set_sampling_period (real_t period) |
| Set the sampling period of the backend. | |
| virtual std::vector< real_t > | read_values ()=0 |
| Read the sensor value. | |
| virtual std::string | sensor_units () const |
| virtual void | load_from_json (const std::string &filename)=0 |
| Load robot and simulation parameters from a JSON file. | |
| uint_t | n_read_values () const noexcept |
| std::string | backend_type_str () const noexcept |
| Return a string that specifies the type of the backend. | |
| 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 choose not to implement this. In this case the sensor will not be visible. | |
| void | set_chrono_body (std::shared_ptr< chrono::ChBody > body) |
| Set the pointer to the body that this sensor is attached. | |
Protected Member Functions | |
| SensorBackendBase (const std::string &backend_type) | |
| Constructor. | |
| void | set_n_read_values (uint_t n) noexcept |
| Set how many values the implementation returns. | |
Protected Attributes | |
| std::shared_ptr< chrono::ChBody > | body_ {nullptr} |
| The body on which the sensor sits. | |
Base class for modelling sensors with different implementations.
|
virtualdefault |
Destructor.
|
inlineprotected |
Constructor.
| backend_type |
|
pure virtual |
Add a visual shape for the sensor in order to be visualized with Irrlicht. Concrete classes may choose not to implement this. In this case the sensor will not be visible.
Implemented in bitsim::sensors::backends::IMUBackendBase, bitsim::sensors::backends::InfraredBackendBase, and bitsim::sensors::backends::RangeSensorBackendBase.
|
inlinenoexcept |
Return a string that specifies the type of the backend.
|
pure virtual |
Load robot and simulation parameters from a JSON file.
This function initializes the robot and its associated Chrono simulation objects based on the contents of the provided JSON configuration file.
Typical parameters may include:
| filename | Path to the JSON configuration file. |
| std::runtime_error | If the file cannot be read or parsed. |
Implemented in bitsim::sensors::backends::IMUBackendBase, bitsim::sensors::backends::InfraredBackendBase, and bitsim::sensors::backends::RangeSensorBackendBase.
|
inlinenoexcept |
|
pure virtual |
Read the sensor value.
Implemented in bitsim::sensors::backends::CHRONO_IMUBackend, bitsim::sensors::backends::CHRONO_InfraredBackend, bitsim::sensors::backends::CHRONO_UltrasonicBackend, bitsim::sensors::backends::MQTT_IMUBackend, bitsim::sensors::backends::MQTT_InfraredBackend, and bitsim::sensors::backends::MQTT_UltrasonicBackend.
|
inlinenoexcept |
Returns the sampling period of the sensor.
|
inlinevirtual |
Reimplemented in bitsim::sensors::backends::IMUBackendBase, bitsim::sensors::backends::InfraredBackendBase, and bitsim::sensors::backends::RangeSensorBackendBase.
|
inline |
Set the pointer to the body that this sensor is attached.
| body |
|
inlineprotectednoexcept |
Set how many values the implementation returns.
|
inline |
Set the sampling period of the backend.
| period |
|
protected |
The body on which the sensor sits.