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 DeviceState &value);
59 void
60 Read(DeviceState &value);
61
62 void
63 Write(const t_blob &value);
64 void
65 Read(t_blob &value);
66
67 void
68 Write(const CameraSample &value);
69 void
70 Read(CameraSample &value);
71
72 void
73 Write(const t_camera_calibration &value);
74 void
75 Read(t_camera_calibration &value);
76
77 void
78 Write(t_constellation_tracker_led &value);
79 void
80 Read(t_constellation_tracker_led &value);
81
82 void
83 Write(const t_constellation_tracker_led_model &value);
84 void
85 Read(std::vector<t_constellation_tracker_led> &led_storage, t_constellation_tracker_led_model &value);
86
87 template <typename T>
88 void
89 Write(const std::optional<T> &opt_value)
90 {
91 this->Write(static_cast<uint8_t>(opt_value.has_value() ? 1 : 0));
92 if (opt_value.has_value()) {
93 this->Write(opt_value.value());
94 }
95 }
96
97 template <typename T>
98 void
99 Read(std::optional<T> &opt_value)
100 {
101 uint8_t has_value;
102 this->Read(has_value);
103 if (has_value) {
104 T value;
105 this->Read(value);
106 opt_value = value;
107 } else {
108 opt_value = std::nullopt;
109 }
110 }
111
112 void
113 Flush();
114};
115
117{
118private: // Fields
119 DataSerializer serializer;
120
121public: // Methods
122 DataRecorder(ConstellationTracker *tracker, std::string out_file);
123
124 ~DataRecorder() = default;
125
126 void
127 RecordSample(const CameraSample &sample);
128
129 void
130 RecordDeviceInfo(const Device &device);
131};
132
134{
135 std::vector<t_camera_calibration> camera_calibrations;
136};
137
139{
140 t_constellation_device_id_t id;
141
142 std::vector<t_constellation_tracker_led> leds;
144};
145
147{
148private: // Fields
149 DataSerializer serializer;
150
151public: // Fields
152 std::vector<DatasetMosaic> mosaics;
153 std::vector<DatasetDevice> devices;
154
155 std::vector<CameraSample> samples;
156
157public: // Methods
158 DatasetReader(std::string filename);
159};
160
161}; // 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:105
Definition t_constellation_tracker_internal.hpp:367
Definition t_constellation_tracker_dataset.hpp:117
Definition t_constellation_tracker_dataset.hpp:18
Definition t_constellation_tracker_dataset.hpp:139
Definition t_constellation_tracker_dataset.hpp:134
Definition t_constellation_tracker_dataset.hpp:147
Definition t_constellation_tracker_internal.hpp:318
Definition t_constellation_tracker_internal.hpp:90
A pose composed of a position and orientation.
Definition xrt_defines.h:492
Internal ures for the constellation tracker.