1#ifndef BITSIM_SENSORS_BACKENDS_MQTT_ULTRASOUND_BACKEND_H
2#define BITSIM_SENSORS_BACKENDS_MQTT_ULTRASOUND_BACKEND_H
4#include "bitsim/bitsim_config.h"
67 void load(
const nlohmann::json &j)
override;
74 channel_.set_config(config);
94 bool receive(
const std::string &text);
99 bool is_alive()
const {
return channel_.is_alive(); }
124 bool accept_(
const std::string &text);
137 bool has_message_{
false};
The basic types of bitsim. Code outside this file names Eigen's matrix and vector types only through ...
Definition mqtt_subscriber.h:24
The topic a sensor on a board publishes its readings to.
Definition mqtt_sensor_channel.h:34
const RealColVec3d & position() const
Definition mqtt_ultrasound_backend.h:116
MQTT_UltrasonicBackend()
A backend that subscribes on its own, see connect(). Give it a topic with set_channel_config() or loa...
Definition mqtt_ultrasound_backend.cpp:16
const UltrasoundMessage & last_value_read() const
Definition mqtt_ultrasound_backend.h:121
bool is_alive() const
Definition mqtt_ultrasound_backend.h:99
void load(const nlohmann::json &j) override
Read the settings, see RangeSensorBackendBase::load(). Also reads broker, topic and timeout [s],...
Definition mqtt_ultrasound_backend.cpp:32
void connect()
Connect to the broker, unless the subscriber already is.
Definition mqtt_ultrasound_backend.h:80
std::vector< real_t > read_values() override
Take the readings that have arrived.
Definition mqtt_ultrasound_backend.cpp:70
static const std::string BACKEND_TYPE
The type of the backend.
Definition mqtt_ultrasound_backend.h:43
const MQTT_SensorChannel & channel() const noexcept
Definition mqtt_ultrasound_backend.h:104
void set_channel_config(const MQTT_SensorChannel::Config &config)
Set where the readings come from. Call it before connect().
Definition mqtt_ultrasound_backend.h:72
void set_position(const RealColVec3d &pos)
Set the position of the sensor on the robot. The backend does not use it.
Definition mqtt_ultrasound_backend.h:111
bool receive(const std::string &text)
Take one message, as read_values() does for each message that arrives. Use it to feed the backend wit...
Definition mqtt_ultrasound_backend.cpp:45
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
Eigen::Vector3d RealColVec3d
3D column vector
Definition bitsim_types.h:137
Models a message from an ultrasound sensor:
Definition ultrasound.h:29
Definition mqtt_sensor_channel.h:39