1#ifndef BITSIM_SENSORS_BACKENDS_CHRONO_ULTRASOUND_BACKEND_H
2#define BITSIM_SENSORS_BACKENDS_CHRONO_ULTRASOUND_BACKEND_H
4#include "bitsim/bitsim_config.h"
10#include <chrono/physics/ChBody.h>
11#include <chrono/physics/ChSystem.h>
73 void load(
const nlohmann::json &j)
override;
79 void set_position(
const chrono::ChVector3d &pos) { position_ = pos; }
84 const chrono::ChVector3d &
position()
const {
return position_; }
119 real_t cast_(
const chrono::ChCollisionSystem &collision_sys,
const chrono::ChVector3d &start,
120 const chrono::ChVector3d &dir)
const;
125 chrono::ChSystem *sys_ptr_{
nullptr};
130 chrono::ChVector3d position_{0.0, 0.0, 0.0};
real_t yaw() const noexcept
Definition chrono_ultrasound_backend.h:112
void set_position(const chrono::ChVector3d &pos)
Set the position of the sensor on its body.
Definition chrono_ultrasound_backend.h:79
void set_yaw(real_t yaw) noexcept
Point the sensor yaw [rad] about the body's z axis from its x axis; 0, the default,...
Definition chrono_ultrasound_backend.h:107
CHRONO_UltrasonicBackend()
Constructor. Attach a body with set_chrono_body() before reading; the system is the one the body is i...
Definition chrono_ultrasound_backend.cpp:33
void set_beam(real_t beam_angle, uint_t n_rays)
Set the cone the sensor hears echoes from.
Definition chrono_ultrasound_backend.cpp:45
uint_t n_rays() const noexcept
Definition chrono_ultrasound_backend.h:101
real_t beam_angle() const noexcept
Definition chrono_ultrasound_backend.h:96
void load(const nlohmann::json &j) override
Read the settings, see RangeSensorBackendBase::load(). Also yaw, where the sensor points about the bo...
Definition chrono_ultrasound_backend.cpp:55
static const std::string BACKEND_TYPE
The type of the backend.
Definition chrono_ultrasound_backend.h:41
const chrono::ChVector3d & position() const
Definition chrono_ultrasound_backend.h:84
std::vector< real_t > read_values() override
Read the distance to the nearest obstacle.
Definition chrono_ultrasound_backend.cpp:107
RangeSensorBackendBase(const std::string &backend_type)
Constructor.
Definition range_sensor_backend_base.h:128
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