EduArt Sensor Ring Library 4.0.0
Loading...
Searching...
No Matches
DepthSensor.hpp
Go to the documentation of this file.
1// Copyright (c) 2026 EduArt Robotik GmbH
2
9
10#pragma once
11
12#include <functional>
13#include <vector>
14
19#include "sensorring/platform/SensorringExport.hpp"
22
23namespace eduart {
24
25namespace sensorring {
26
27namespace device {
28
38class SENSORRING_EXPORT DepthSensor : public Sensor {
39public:
42
50 DepthSensor(DeviceID id, com::ComInterface* interface, com::ComEndpoint target, DepthSensorConfig config);
51
56 virtual const DepthSensorParams& getParams() const = 0;
57
63
69 subscription::Subscription subscribe(std::function<void(const measurement::DepthMeasurement&)> callback) { return _depth_publisher.subscribe(std::move(callback)); }
70
76 virtual void publishMeasurement();
77
78protected:
86 void updateResolution(double fov_x_deg, double fov_y_deg, unsigned int res_x, unsigned int res_y);
87
95 virtual void createLookupTable(DepthSensorConfig config, std::vector<double>& lut_x, std::vector<double>& lut_y, std::vector<double>& lut_z);
96
105
106 DepthSensorConfig _config;
107 std::vector<double> _lut_x;
108 std::vector<double> _lut_y;
109 std::vector<double> _lut_z;
110
111 measurement::DepthMeasurement _latest_measurement;
113};
114
115} // namespace device
116
117} // namespace sensorring
118
119} // namespace eduart
Pure data structure for depth sensor measurements.
Configuration options for depth-sensing devices (ToF, structured light, etc.).
Parameter structure for the DepthSensor.
Thread-safe, deadlock-free publish/subscribe template.
Base class for all sensor devices, adding measurement synchronisation to Device.
RAII wrapper pairing a SubscriberToken with its cancel function.
void updateResolution(double fov_x_deg, double fov_y_deg, unsigned int res_x, unsigned int res_y)
Update the sensor's FOV and resolution, and recalculate the lookup tables.
virtual void publishMeasurement()
Build a DepthMeasurement from internal state and publish to all subscribers.
const measurement::DepthMeasurement & getLatestMeasurement() const
Get the most recent measurement.
virtual void createLookupTable(DepthSensorConfig config, std::vector< double > &lut_x, std::vector< double > &lut_y, std::vector< double > &lut_z)
Create lookup tables for x and y angles based on FOV and resolution.
virtual const DepthSensorParams & getParams() const =0
Get the current DepthSensor parameters.
measurement::DepthMeasurement MeasurementType
Measurement type produced by this sensor category.
Definition DepthSensor.hpp:41
DepthSensor(DeviceID id, com::ComInterface *interface, com::ComEndpoint target, DepthSensorConfig config)
Construct a DepthSensor with Device params, field-of-view and pixel resolution.
void processRawMeasurement(measurement::PointCloud &pcl)
Calculate the x,y,z coordinates from the raw distance measurements.
subscription::Subscription subscribe(std::function< void(const measurement::DepthMeasurement &)> callback)
Subscribe to depth measurements from this sensor.
Definition DepthSensor.hpp:69
Sensor(DeviceID id, com::ComInterface *interface, com::ComEndpoint target)
Construct the sensor with identity and communication link.
Generic thread-safe publisher that manages callback subscriptions.
Definition Publisher.hpp:37
Move-only RAII wrapper that pairs a SubscriberToken with an unsubscribe callable. Destroying a Subscr...
Definition Subscription.hpp:32
Uniquely identifies a communication endpoint as a (Direction, BoardAddress, DeviceId) tuple.
Definition ComEndpoint.hpp:37
Configuration structure for 3D depth sensors.
Definition DepthSensorConfig.hpp:24
Parameter structure of the DepthSensor.
Definition DepthSensorParams.hpp:25
Identifier for a device: type, human-readable name, and index.
Definition DeviceID.hpp:27
Pure data structure holding a measurement from a depth sensor.
Definition DepthMeasurement.hpp:32
Stores a vector of points in 3D space.
Definition PointCloud.hpp:45