EduArt Sensor Ring Library 4.0.0
Loading...
Searching...
No Matches
LightParams.hpp
Go to the documentation of this file.
1// Copyright (c) 2026 EduArt Robotik GmbH
2
9
10#pragma once
11
12#include <cmath>
13#include <cstdint>
14#include <limits>
15#include <stdexcept>
16
18#include "sensorring/platform/SensorringExport.hpp"
19
20namespace eduart {
21
22namespace sensorring {
23
24namespace device {
25
30struct SENSORRING_EXPORT LightParams : public DeviceParams {
33
36
38 std::int64_t max_brightness = 50;
39
42 if (max_brightness < 0 || max_brightness > 255) {
43 throw std::invalid_argument("LED max_brightness must be an integer in [0, 255].");
44 }
45 }
46
49 if (!std::isfinite(distance_map_lower_m) || !std::isfinite(distance_map_upper_m) || distance_map_lower_m < 0.0 || distance_map_upper_m <= distance_map_lower_m || distance_map_upper_m > std::numeric_limits<float>::max()
50 || static_cast<float>(distance_map_lower_m) >= static_cast<float>(distance_map_upper_m)) {
51 throw std::invalid_argument("LED distance_map_lower_m and distance_map_upper_m must be finite meters with 0 <= lower < upper, distinct and representable as float32.");
52 }
53 }
54
56 virtual ~LightParams() = default;
57};
58
59} // namespace device
60
61} // namespace sensorring
62
63} // namespace eduart
Parameter structure for a device.
Base parameter structure of a device. A device is one sensor or actuator on a sensor board.
Definition DeviceParams.hpp:28
Parameter structure of the Light.
Definition LightParams.hpp:30
double distance_map_lower_m
Lower DistanceMap saturation threshold in meters. Lights are red below this distance.
Definition LightParams.hpp:32
std::int64_t max_brightness
DistanceMap peak channel brightness on the LED's 0-255 scale (0 disables it).
Definition LightParams.hpp:38
virtual ~LightParams()=default
Destructor.
double distance_map_upper_m
Upper DistanceMap saturation threshold in meters. Lights are green above this distance.
Definition LightParams.hpp:35
void validateDistanceMapRange() const
Throws if the range cannot be represented by the firmware's float32 parameters.
Definition LightParams.hpp:48
void validateDistanceMapBrightness() const
Validates the distance map parameters.
Definition LightParams.hpp:41