1#ifndef BITSIM_SENSORS_BACKENDS_RANGE_SENSOR_BACKEND_BASE_H
2#define BITSIM_SENSORS_BACKENDS_RANGE_SENSOR_BACKEND_BASE_H
4#include "bitsim/bitsim_config.h"
6#include "bitsim/extern/nlohmann/json/json.hpp"
13#include <unordered_map>
39 static std::shared_ptr<RangeSensorBackendBase>
create(
const std::string &backend_type);
85 virtual void load(
const nlohmann::json &j);
99 add_visual_shape(
const std::unordered_map<std::string, std::any> &shape_properties)
override;
115 std::string sensor_units_{
"METERS"};
120 real_t max_distance_{0.0};
125 real_t min_distance_{0.0};
The basic types of bitsim. Code outside this file names Eigen's matrix and vector types only through ...
virtual void load(const nlohmann::json &j)
Read the settings of the sensor from its section of a robot or sensor file. Every key is optional:
Definition range_sensor_backend_base.cpp:43
RangeSensorBackendBase(const std::string &backend_type)
Constructor.
Definition range_sensor_backend_base.h:128
real_t min_distance() const noexcept
Definition range_sensor_backend_base.h:55
real_t clamp_distance(real_t distance) const noexcept
Definition range_sensor_backend_base.cpp:73
virtual std::string sensor_units() const
Definition range_sensor_backend_base.h:67
real_t max_distance() const noexcept
Definition range_sensor_backend_base.h:44
virtual void add_visual_shape(const std::unordered_map< std::string, std::any > &shape_properties) override
Add a visual shape for the sensor in order to be visualized with Irrlicht. Concrete classes may choos...
Definition range_sensor_backend_base.cpp:79
void set_min_distance(real_t min_distance) noexcept
Set the minimum distance the range sensor can read.
Definition range_sensor_backend_base.h:61
void load_from_json(const std::string &filename) override
Read the settings from a JSON file, see load().
Definition range_sensor_backend_base.cpp:63
void set_sensor_units(const std::string &units)
Set the sensor units.
Definition range_sensor_backend_base.h:73
void set_max_distance(real_t max_distance) noexcept
Set the maximum distance the range sensor can read.
Definition range_sensor_backend_base.h:50
static std::shared_ptr< RangeSensorBackendBase > create(const std::string &backend_type)
Create a backend by the name a robot file gives it.
Definition range_sensor_backend_base.cpp:19
SensorBackendBase(const std::string &backend_type)
Constructor.
Definition sensor_backend_base.h:140
Definition camera_backend_base.h:19
Definition dc_motor_backend_base.h:9
double real_t
real_t
Definition bitsim_types.h:20