7 #ifndef IFM3D_DESERIALIZE_STRUCT_TOF_INFO_V3_HPP
8 #define IFM3D_DESERIALIZE_STRUCT_TOF_INFO_V3_HPP
12 #include <ifm3d/device/device.h>
13 #include <ifm3d/device/err.h>
14 #include <ifm3d/fg/organizer_utils.h>
15 #include <ifm3d/fg/buffer.h>
16 #include <ifm3d/deserialize/deserialize_utils.hpp>
17 #include <ifm3d/deserialize/struct_calibration.hpp>
23 constexpr
auto TOF_INFO_VERSION_INDEX = 0x0000;
24 constexpr
auto TOF_INFO_DISTANCE_RESOLUTION_INDEX = 0x0004;
25 constexpr
auto TOF_INFO_AMPLITUDE_RESOLUTION_INDEX = 0x0008;
26 constexpr
auto TOF_INFO_AMPLITUDE_NORM_FACTOR_INDEX = 0x000C;
27 constexpr
auto TOF_INFO_EXTRINSIC_OPTICAL_TO_USER_INDEX = 0x0018;
28 constexpr
auto TOF_INFO_INTRINSIC_CALIBRATION_INDEX = 0x0030;
29 constexpr
auto TOF_INFO_INVERSE_INTRINSIC_CALIBRATION_INDEX = 0x00B4;
30 constexpr
auto TOF_INFO_EXPOSURE_TIMESTAMPS_INDEX = 0x0138;
31 constexpr
auto TOF_INFO_EXPOSURE_TIMES_INDEX = 0x0150;
32 constexpr
auto TOF_INFO_ILLUTEMPERATURE_INDEX = 0x015C;
33 constexpr
auto TOF_INFO_MODE_INDEX = 0x0160;
34 constexpr
auto TOF_INFO_IMAGER_INDEX = 0x0180;
42 using Ptr = std::shared_ptr<TOFInfoV3>;
45 Read(
const uint8_t* data,
size_t size)
47 if (size < tof_info_v3_size)
51 const uint8_t* start_ptr = data;
52 version = mkval<std::uint32_t>(start_ptr + TOF_INFO_VERSION_INDEX);
54 mkval<float>(start_ptr + TOF_INFO_DISTANCE_RESOLUTION_INDEX);
55 amplitude_resolution =
56 mkval<float>(start_ptr + TOF_INFO_AMPLITUDE_RESOLUTION_INDEX);
57 mkarray<float, 3>(start_ptr + TOF_INFO_AMPLITUDE_NORM_FACTOR_INDEX,
58 amp_normalization_factors);
59 extrinsic_optic_to_user.Read(start_ptr +
60 TOF_INFO_EXTRINSIC_OPTICAL_TO_USER_INDEX);
61 intrinsic_calibration.Read(start_ptr +
62 TOF_INFO_INTRINSIC_CALIBRATION_INDEX);
63 inverse_intrinsic_calibration.Read(
64 start_ptr + TOF_INFO_INVERSE_INTRINSIC_CALIBRATION_INDEX);
65 mkarray<uint64_t, 3>(start_ptr + TOF_INFO_EXPOSURE_TIMESTAMPS_INDEX,
66 exposure_timestamps_ns);
67 mkarray<uint32_t, 3>(start_ptr + TOF_INFO_EXPOSURE_TIMES_INDEX,
70 mkval<float>(start_ptr + TOF_INFO_ILLUTEMPERATURE_INDEX);
71 mkarray<char, 32>(start_ptr + TOF_INFO_MODE_INDEX, mode);
72 mkarray<char, 32>(start_ptr + TOF_INFO_IMAGER_INDEX, imager);
77 float distance_resolution;
79 float amplitude_resolution;
82 std::array<float, 3> amp_normalization_factors;
90 std::array<uint64_t, 3> exposure_timestamps_ns;
92 std::array<uint32_t, 3> exposure_times_s;
94 float illu_temperature;
96 std::array<char, 32> mode;
98 std::array<char, 32> imager;
100 const size_t tof_info_v3_size = 416;
103 Deserialize(
const Buffer& tof_info_buffer)
107 tof_info_v3.Read(tof_info_buffer.
ptr<uint8_t>(0),
108 tof_info_buffer.
size());
114 #endif // IFM3D_DESERIALIZE_STRUCT_TOF_INFO_V3_HPP