VRS
A file format for sensor data.
Loading...
Searching...
No Matches
TagConventions.h
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#pragma once
18
19// clang-format off
20
21/*
22 These tag names are pure conventions VRS users may want to follow when creating their VRS files.
23*/
24
25#include <vrs/RecordFileWriter.h>
26#include <vrs/VrsExport.h>
27
28namespace vrs {
29
31namespace tag_conventions {
32
33// Overall identification, HW & SW independent
34
35 // Project name: overarching project name.
36 constexpr const char* kProjectName = "project_name";
37 // EPOCH time in seconds since Jan 1, 1970, when the capture started. Uses C's 'time(NULL)'
38 constexpr const char* kCaptureTimeEpoch = "capture_time_epoch";
39 // Session ID: unique identifier which can be used to recognize the session
40 constexpr const char* kSessionId = "session_id";
41 // Capture type: description of the recording session context
42 // Ex: "calibration", "data_collection", "test"
43 constexpr const char* kCaptureType = "capture_type";
44 // A set of tags.
45 constexpr const char* kTagSet = "tag_set";
46
50 VRS_API string addUniqueSessionId(RecordFileWriter& writer);
53 VRS_API void addCaptureTime(RecordFileWriter& writer);
57 VRS_API void addTagSet(RecordFileWriter& writer, const vector<string>& tags);
58
59// Hardware components
60// For dependent devices with their own id/serial (controllers?), tag at the stream level
61
62 // Device Type: device type, maybe the code name of the device/prototype
63 constexpr const char* kDeviceType = "device_type";
64 // Device version: device version name. Ex: "proto0", "EVT2"
65 constexpr const char* kDeviceVersion = "device_version";
66 // Device Serial: serial number of the main HW (in case of multi part HW)
67 constexpr const char* kDeviceSerial = "device_serial";
68 // Device ID: user code identification of the device
69 constexpr const char* kDeviceId = "device_id";
70 // Hardware configuration: description of the hardware setup
71 constexpr const char* kHardwareConfiguration = "hardware_configuration";
72
78 template <class T> inline // vrs::RecordFileWriter or vrs::Recordable
79 void addDevice(T& writer, const string& type, const string& serialNumber, const string& version) {
80 writer.setTag(kDeviceType, type);
81 writer.setTag(kDeviceSerial, serialNumber);
82 writer.setTag(kDeviceVersion, version);
83 }
87 template <class T> inline // vrs::RecordFileWriter or vrs::Recordable
88 void addDeviceId(T& writer, const string& id) {
89 writer.setTag(kDeviceId, id);
90 }
91
92// Software components
93// For dependent devices with their own SW/FW (controllers?), tag at the stream level
94
95 // OS fingerprint: Operating system build signature
96 constexpr const char* kOsFingerprint = "os_fingerprint";
97 // OS version: Operating system version
98 constexpr const char* kOsBuildVersion = "os_build_version";
99 // OS build number: Operating system build number
100 constexpr const char* kOsBranch = "os_branch";
101 // SW compile time: when the recording software was compiled
102 constexpr const char* kSoftwareCompileDate = "software_compile_date";
103 // SW revision: source control revision of the software
104 constexpr const char* kSoftwareRevision = "software_revision";
105 // FW compile time: when the recording firmware was compiled
106 constexpr const char* kFirmwareCompileDate = "firmware_compile_date";
107 // FW revision: source control revision of the firmware
108 constexpr const char* kFirmwareRevision = "firmware_revision";
109
112 VRS_API void addOsFingerprint(RecordFileWriter& writer);
117 inline
118 void addSoftwareDetails(RecordFileWriter& writer, const string& compileDate, const string& rev) {
119 writer.setTag(kSoftwareCompileDate, compileDate);
120 writer.setTag(kSoftwareRevision, rev);
121 }
126 template <class T> // vrs::RecordFileWriter or vrs::Recordable
127 inline void addFirmwareDetails(T& writer, const string& fwCompileDate, const string& fwRevision) {
128 writer.setTag(kFirmwareCompileDate, fwCompileDate);
129 writer.setTag(kFirmwareRevision, fwRevision);
130 }
131
132// For streams which may have multiple instances in the same recording
133
134 // Device role: which "role" has this device in the system.
135 // Ex: "top-right camera", "left controller"
136 constexpr const char* kDeviceRole = "device_role"; // When relevant
137
138// Key configuration/settings (when relevant, never required)
139
140 // Intensity target used by dynamic exposure control. How to fill it:
141 // * Do not fill it or fill it with -1 when unknown.
142 // * Fill it with 0 when using fixed exposure settings.
143 // * Fill it with the right intensity target when using dynamic exposure
144 constexpr const char* kDynamicExposureTarget = "iot_dynamic_exposure_target";
145
146// Stream semantic conventions
147
149 constexpr const char* kImageSemantic = "image_semantic";
150
152 constexpr const char* kImageSemanticCamera = "image_semantic_camera";
153 constexpr const char* kImageSemanticDepth = "image_semantic_depth";
155 "image_semantic_object_class_segmentation";
157 "image_semantic_object_id_segmentation";
158
162 constexpr const char* kRenderDepthImagesRangeMin = "render_depth_images_range_min";
163 constexpr const char* kRenderDepthImagesRangeMax = "render_depth_images_range_max";
164
165// Helper functions
169 VRS_API string makeTagSet(const vector<string>& tags);
174 VRS_API bool parseTagSet(const string& jsonTagSet, vector<string>& outVectorTagSet);
175
176/*
177 * Sample: Santa Cruz + controllers
178 *
179 * File tags:
180 * kProjectName = "Santa Cruz"
181 * kCaptureTimeEpoch = "1520364293"
182 * kSessionId = "5584bdc43"
183 * kCaptureType = "calibration" <- other use case: "INSIDE_OUT_TRACKER_RECORDING"...
184 *
185 * kDeviceType = "Santa Cruz"
186 * kDeviceVersion = "EVT3" <- main device (HMD for Santa Cruz)
187 * kDeviceSerial = "0ba3602ffbee80b9" <- of HMD
188 * kHardwareConfiguration = "hmd + 2 hand controllers"
189 *
190 * kOsFingerprint = "oculus/vr_santa_cruz_proto1/proto1:7.1.1/N9F27L/863:userdev/dev-keys"
191 * kSoftwareCompileDate = "Sep 26 2017 19:06:45"
192 * kSoftwareRevision = "185ea53a5584bdc43640ba3602ccbee80b91d33e"
193 * kFirmwareCompileDate = "Sep 20 2017 15:26:25"
194 * kFirmwareRevision = "265ea53b5584bdc43640ba3602ffbee80b91d43a"
195 *
196 * Controller stream tags (for each stream)
197 * kDeviceType = "Santa Cruz Controller"
198 * kDeviceVersion = "EVT0"
199 * kDeviceSerial = "bee80b91d3"
200 * kDeviceId = "left controller"
201 * kFirmwareCompileDate = "Sep 20 2017 15:26:25"
202 * kFirmwareRevision = "265ea53b5584bdc43640ba3602ffbee80b91d43a"
203 */
204
205} // namespace tag_conventions
206} // namespace vrs
The class to create VRS files.
Definition RecordFileWriter.h:91
void setTag(const string &tagName, const string &tagValue)
Definition RecordFileWriter.cpp:666
VRS_API string makeTagSet(const vector< string > &tags)
Definition TagConventions.cpp:42
constexpr const char * kImageSemantic
Tag name to hint how to normalize a stream's images.
Definition TagConventions.h:149
VRS_API void addOsFingerprint(RecordFileWriter &writer)
Definition TagConventions.cpp:30
VRS_API string addUniqueSessionId(RecordFileWriter &writer)
Definition TagConventions.cpp:62
VRS_API void addTagSet(RecordFileWriter &writer, const vector< string > &tags)
Definition TagConventions.cpp:34
void addSoftwareDetails(RecordFileWriter &writer, const string &compileDate, const string &rev)
Definition TagConventions.h:118
VRS_API bool parseTagSet(const string &jsonTagSet, vector< string > &outVectorTagSet)
Definition TagConventions.cpp:50
constexpr const char * kRenderDepthImagesRangeMin
Definition TagConventions.h:162
constexpr const char * kImageSemanticObjectClassSegmentation
Object class segmentation.
Definition TagConventions.h:154
constexpr const char * kImageSemanticDepth
Depth camera.
Definition TagConventions.h:153
VRS_API void addCaptureTime(RecordFileWriter &writer)
Definition TagConventions.cpp:26
void addDevice(T &writer, const string &type, const string &serialNumber, const string &version)
Definition TagConventions.h:79
void addFirmwareDetails(T &writer, const string &fwCompileDate, const string &fwRevision)
Definition TagConventions.h:127
constexpr const char * kImageSemanticObjectIdSegmentation
Object ID segmentation.
Definition TagConventions.h:156
void addDeviceId(T &writer, const string &id)
Definition TagConventions.h:88
constexpr const char * kImageSemanticCamera
Possible values for kImageSemantic.
Definition TagConventions.h:152
Definition Compressor.cpp:113