Monado OpenXR Runtime
Loading...
Searching...
No Matches
t_constellation_tracker_dataset.hpp
Go to the documentation of this file.
1// Copyright 2026, Beyley Cardellio
2// SPDX-License-Identifier: BSL-1.0
3/*!
4 * @file
5 * @brief Implementation of the data recorder logic for the constellation tracker.
6 * @author Beyley Cardellio <ep1cm1n10n123@gmail.com>
7 * @ingroup tracking
8 */
9
10#pragma once
11
13
14
15namespace xrt::tracking::constellation {
16
18{
19private: // Fields
20 std::fstream file;
21
22public: // Methods
23 DataSerializer(std::string file, bool write);
24
26
27 void
28 Write(uint8_t value);
29 void
30 Read(uint8_t &value);
31
32 void
33 Write(uint32_t value);
34 void
35 Read(uint32_t &value);
36
37 void
38 Write(float value);
39 void
40 Read(float &value);
41
42 void
43 Write(uint64_t value);
44 void
45 Read(uint64_t &value);
46
47 void
48 Write(double value);
49 void
50 Read(double &value);
51
52 void
53 Write(const xrt_pose &value);
54 void
55 Read(xrt_pose &value);
56
57 void
58 Write(const FoundDevicePose &value);
59 void
60 Read(FoundDevicePose &value);
61
62 void
63 Write(const DeviceState &value);
64 void
65 Read(DeviceState &value);
66
67 void
68 Write(const t_blob &value);
69 void
70 Read(t_blob &value);
71
72 void
73 Write(const CameraSample &value);
74 void
75 Read(CameraSample &value);
76
77 void
78 Write(const t_camera_calibration &value);
79 void
80 Read(t_camera_calibration &value);
81
82 void
83 Write(t_constellation_tracker_led &value);
84 void
85 Read(t_constellation_tracker_led &value);
86
87 void
88 Write(const t_constellation_tracker_led_model &value);
89 void
90 Read(std::vector<t_constellation_tracker_led> &led_storage, t_constellation_tracker_led_model &value);
91
92 template <typename T>
93 void
94 Write(const std::optional<T> &opt_value)
95 {
96 this->Write(static_cast<uint8_t>(opt_value.has_value() ? 1 : 0));
97 if (opt_value.has_value()) {
98 this->Write(opt_value.value());
99 }
100 }
101
102 template <typename T>
103 void
104 Read(std::optional<T> &opt_value)
105 {
106 uint8_t has_value;
107 this->Read(has_value);
108 if (has_value) {
109 T value;
110 this->Read(value);
111 opt_value = value;
112 } else {
113 opt_value = std::nullopt;
114 }
115 }
116
117 void
118 Flush();
119};
120
122{
123private: // Fields
124 DataSerializer serializer;
125
126public: // Methods
127 DataRecorder(ConstellationTracker *tracker, std::string out_file);
128
129 ~DataRecorder() = default;
130
131 void
132 RecordSample(const CameraSample &sample);
133
134 void
135 RecordDeviceInfo(const Device &device);
136};
137
139{
140 std::vector<t_camera_calibration> camera_calibrations;
141};
142
144{
145 t_constellation_device_id_t id;
146
147 std::vector<t_constellation_tracker_led> leds;
149};
150
152{
153private: // Fields
154 DataSerializer serializer;
155
156public: // Fields
157 std::vector<DatasetMosaic> mosaics;
158 std::vector<DatasetDevice> devices;
159
160 std::vector<CameraSample> samples;
161
162public: // Methods
163 DatasetReader(std::string filename);
164};
165
166}; // namespace xrt::tracking::constellation
A blob is a 2d position in a camera sensor's view that is being tracked.
Definition t_constellation.h:37
Essential calibration data for a single camera, or single lens/sensor of a stereo camera.
Definition t_tracking.h:236
The LED model is a series of points which define the real-world positions of all LEDs.
Definition t_constellation.h:266
Definition t_constellation.h:245
Definition t_constellation_tracker_internal.hpp:112
Definition t_constellation_tracker_internal.hpp:388
Definition t_constellation_tracker_dataset.hpp:122
Definition t_constellation_tracker_dataset.hpp:18
Definition t_constellation_tracker_dataset.hpp:144
Definition t_constellation_tracker_dataset.hpp:139
Definition t_constellation_tracker_dataset.hpp:152
Definition t_constellation_tracker_internal.hpp:339
Definition t_constellation_tracker_internal.hpp:97
Definition t_constellation_tracker_internal.hpp:91
A pose composed of a position and orientation.
Definition xrt_defines.h:492
Internal ures for the constellation tracker.