7 #ifndef IFM3D_DESERIALIZE_STRUCT_TOF_INFO_V3_HPP
8 #define IFM3D_DESERIALIZE_STRUCT_TOF_INFO_V3_HPP
13 #include <ifm3d/device/device.h>
14 #include <ifm3d/device/err.h>
15 #include <ifm3d/fg/organizer_utils.h>
16 #include <ifm3d/fg/buffer.h>
17 #include <ifm3d/deserialize/deserialize_utils.hpp>
18 #include <ifm3d/deserialize/struct_calibration.hpp>
24 constexpr
auto TOF_INFO_VERSION_INDEX = 0x0000;
25 constexpr
auto TOF_INFO_DISTANCE_RESOLUTION_INDEX = 0x0004;
26 constexpr
auto TOF_INFO_AMPLITUDE_RESOLUTION_INDEX = 0x0008;
27 constexpr
auto TOF_INFO_AMPLITUDE_NORM_FACTOR_INDEX = 0x000C;
28 constexpr
auto TOF_INFO_EXTRINSIC_OPTICAL_TO_USER_INDEX = 0x0018;
29 constexpr
auto TOF_INFO_INTRINSIC_CALIBRATION_INDEX = 0x0030;
30 constexpr
auto TOF_INFO_INVERSE_INTRINSIC_CALIBRATION_INDEX = 0x00B4;
31 constexpr
auto TOF_INFO_EXPOSURE_TIMESTAMPS_INDEX = 0x0138;
32 constexpr
auto TOF_INFO_EXPOSURE_TIMES_INDEX = 0x0150;
33 constexpr
auto TOF_INFO_ILLUTEMPERATURE_INDEX = 0x015C;
34 constexpr
auto TOF_INFO_MODE_INDEX = 0x0160;
35 constexpr
auto TOF_INFO_IMAGER_INDEX = 0x0180;
43 using Ptr = std::shared_ptr<TOFInfoV3>;
46 Read(
const uint8_t* data,
size_t size)
48 if (size < tof_info_v3_size)
52 const uint8_t* start_ptr = data;
53 std::array<char, 32> buff;
54 version = mkval<std::uint32_t>(start_ptr + TOF_INFO_VERSION_INDEX);
56 mkval<float>(start_ptr + TOF_INFO_DISTANCE_RESOLUTION_INDEX);
57 amplitude_resolution =
58 mkval<float>(start_ptr + TOF_INFO_AMPLITUDE_RESOLUTION_INDEX);
59 mkarray<float, 3>(start_ptr + TOF_INFO_AMPLITUDE_NORM_FACTOR_INDEX,
60 amp_normalization_factors);
61 extrinsic_optic_to_user.Read(start_ptr +
62 TOF_INFO_EXTRINSIC_OPTICAL_TO_USER_INDEX);
63 intrinsic_calibration.Read(start_ptr +
64 TOF_INFO_INTRINSIC_CALIBRATION_INDEX);
65 inverse_intrinsic_calibration.Read(
66 start_ptr + TOF_INFO_INVERSE_INTRINSIC_CALIBRATION_INDEX);
67 mkarray<uint64_t, 3>(start_ptr + TOF_INFO_EXPOSURE_TIMESTAMPS_INDEX,
68 exposure_timestamps_ns);
69 mkarray<float, 3>(start_ptr + TOF_INFO_EXPOSURE_TIMES_INDEX,
72 mkval<float>(start_ptr + TOF_INFO_ILLUTEMPERATURE_INDEX);
73 mkarray<char, 32>(start_ptr + TOF_INFO_MODE_INDEX, buff);
74 mode = std::string(buff.begin(), buff.end());
76 mkarray<char, 32>(start_ptr + TOF_INFO_IMAGER_INDEX, buff);
77 imager = std::string(buff.begin(), buff.end());
83 float distance_resolution;
85 float amplitude_resolution;
88 std::array<float, 3> amp_normalization_factors;
96 std::array<uint64_t, 3> exposure_timestamps_ns;
98 std::array<float, 3> exposure_times_s;
100 float illu_temperature;
106 const size_t tof_info_v3_size = 416;
109 Deserialize(
const Buffer& tof_info_buffer)
113 tof_info_v3.Read(tof_info_buffer.
ptr<uint8_t>(0),
114 tof_info_buffer.
size());
120 #endif // IFM3D_DESERIALIZE_STRUCT_TOF_INFO_V3_HPP