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
27namespace vrs {
28
30namespace tag_conventions {
31
32// Overall identification, HW & SW independent
33
34 // Project name: overarching project name.
35 constexpr const char* kProjectName = "project_name";
36 // EPOCH time in seconds since Jan 1, 1970, when the capture started. Uses C's 'time(NULL)'
37 constexpr const char* kCaptureTimeEpoch = "capture_time_epoch";
38 // Session ID: unique identifier which can be used to recognize the session
39 constexpr const char* kSessionId = "session_id";
40 // Capture type: description of the recording session context
41 // Ex: "calibration", "data_collection", "test"
42 constexpr const char* kCaptureType = "capture_type";
43 // A set of tags.
44 constexpr const char* kTagSet = "tag_set";
45
49 std::string addUniqueSessionId(RecordFileWriter& writer);
52 void addCaptureTime(RecordFileWriter& writer);
56 void addTagSet(RecordFileWriter& writer, const vector<string>& tags);
57
58// Hardware components
59// For dependent devices with their own id/serial (controllers?), tag at the stream level
60
61 // Device Type: device type, maybe the code name of the device/prototype
62 constexpr const char* kDeviceType = "device_type";
63 // Device version: device version name. Ex: "proto0", "EVT2"
64 constexpr const char* kDeviceVersion = "device_version";
65 // Device Serial: serial number of the main HW (in case of multi part HW)
66 constexpr const char* kDeviceSerial = "device_serial";
67 // Device ID: user code identification of the device
68 constexpr const char* kDeviceId = "device_id";
69 // Hardware configuration: description of the hardware setup
70 constexpr const char* kHardwareConfiguration = "hardware_configuration";
71
77 template <class T> inline // vrs::RecordFileWriter or vrs::Recordable
78 void addDevice(T& writer, const string& type, const string& serialNumber, const string& version) {
79 writer.setTag(kDeviceType, type);
80 writer.setTag(kDeviceSerial, serialNumber);
81 writer.setTag(kDeviceVersion, version);
82 }
86 template <class T> inline // vrs::RecordFileWriter or vrs::Recordable
87 void addDeviceId(T& writer, const string& id) {
88 writer.setTag(kDeviceId, id);
89 }
90
91// Software components
92// For dependent devices with their own SW/FW (controllers?), tag at the stream level
93
94 // OS fingerprint: Operating system build signature
95 constexpr const char* kOsFingerprint = "os_fingerprint";
96 // OS version: Operating system version
97 constexpr const char* kOsBuildVersion = "os_build_version";
98 // OS build number: Operating system build number
99 constexpr const char* kOsBranch = "os_branch";
100 // SW compile time: when the recording software was compiled
101 constexpr const char* kSoftwareCompileDate = "software_compile_date";
102 // SW revision: source control revision of the software
103 constexpr const char* kSoftwareRevision = "software_revision";
104 // FW compile time: when the recording firmware was compiled
105 constexpr const char* kFirmwareCompileDate = "firmware_compile_date";
106 // FW revision: source control revision of the firmware
107 constexpr const char* kFirmwareRevision = "firmware_revision";
108
116 inline
117 void addSoftwareDetails(RecordFileWriter& writer, const string& compileDate, const string& rev) {
118 writer.setTag(kSoftwareCompileDate, compileDate);
119 writer.setTag(kSoftwareRevision, rev);
120 }
125 template <class T> // vrs::RecordFileWriter or vrs::Recordable
126 inline void addFirmwareDetails(T& writer, const string& fwCompileDate, const string& fwRevision) {
127 writer.setTag(kFirmwareCompileDate, fwCompileDate);
128 writer.setTag(kFirmwareRevision, fwRevision);
129 }
130
131// For streams which may have multiple instances in the same recording
132
133 // Device role: which "role" has this device in the system.
134 // Ex: "top-right camera", "left controller"
135 constexpr const char* kDeviceRole = "device_role"; // When relevant
136
137// Key configuration/settings (when relevant, never required)
138
139 // Intensity target used by dynamic exposure control. How to fill it:
140 // * Do not fill it or fill it with -1 when unknown.
141 // * Fill it with 0 when using fixed exposure settings.
142 // * Fill it with the right intensity target when using dynamic exposure
143 constexpr const char* kDynamicExposureTarget = "iot_dynamic_exposure_target";
144
145// Stream semantic conventions
146
148 constexpr const char* kImageSemantic = "image_semantic";
149
151 constexpr const char* kImageSemanticCamera = "image_semantic_camera";
152 constexpr const char* kImageSemanticDepth = "image_semantic_depth";
154 "image_semantic_object_class_segmentation";
156 "image_semantic_object_id_segmentation";
157
161 constexpr const char* kRenderDepthImagesRangeMin = "render_depth_images_range_min";
162 constexpr const char* kRenderDepthImagesRangeMax = "render_depth_images_range_max";
163
164// Helper functions
168 string makeTagSet(const vector<string>& tags);
173 bool parseTagSet(const string& jsonTagSet, vector<string>& outVectorTagSet);
174
175/*
176 * Sample: Santa Cruz + controllers
177 *
178 * File tags:
179 * kProjectName = "Santa Cruz"
180 * kCaptureTimeEpoch = "1520364293"
181 * kSessionId = "5584bdc43"
182 * kCaptureType = "calibration" <- other use case: "INSIDE_OUT_TRACKER_RECORDING"...
183 *
184 * kDeviceType = "Santa Cruz"
185 * kDeviceVersion = "EVT3" <- main device (HMD for Santa Cruz)
186 * kDeviceSerial = "0ba3602ffbee80b9" <- of HMD
187 * kHardwareConfiguration = "hmd + 2 hand controllers"
188 *
189 * kOsFingerprint = "oculus/vr_santa_cruz_proto1/proto1:7.1.1/N9F27L/863:userdev/dev-keys"
190 * kSoftwareCompileDate = "Sep 26 2017 19:06:45"
191 * kSoftwareRevision = "185ea53a5584bdc43640ba3602ccbee80b91d33e"
192 * kFirmwareCompileDate = "Sep 20 2017 15:26:25"
193 * kFirmwareRevision = "265ea53b5584bdc43640ba3602ffbee80b91d43a"
194 *
195 * Controller stream tags (for each stream)
196 * kDeviceType = "Santa Cruz Controller"
197 * kDeviceVersion = "EVT0"
198 * kDeviceSerial = "bee80b91d3"
199 * kDeviceId = "left controller"
200 * kFirmwareCompileDate = "Sep 20 2017 15:26:25"
201 * kFirmwareRevision = "265ea53b5584bdc43640ba3602ffbee80b91d43a"
202 */
203
204} // namespace tag_conventions
205} // namespace vrs
The class to create VRS files.
Definition RecordFileWriter.h:91
void setTag(const string &tagName, const string &tagValue)
Definition RecordFileWriter.cpp:636
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:148
void addOsFingerprint(RecordFileWriter &writer)
Definition TagConventions.cpp:30
std::string addUniqueSessionId(RecordFileWriter &writer)
Definition TagConventions.cpp:62
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:117
bool parseTagSet(const string &jsonTagSet, vector< string > &outVectorTagSet)
Definition TagConventions.cpp:50
constexpr const char * kRenderDepthImagesRangeMin
Definition TagConventions.h:161
constexpr const char * kImageSemanticObjectClassSegmentation
Object class segmentation.
Definition TagConventions.h:153
constexpr const char * kImageSemanticDepth
Depth camera.
Definition TagConventions.h:152
void addCaptureTime(RecordFileWriter &writer)
Definition TagConventions.cpp:26
void addDevice(T &writer, const string &type, const string &serialNumber, const string &version)
Definition TagConventions.h:78
void addFirmwareDetails(T &writer, const string &fwCompileDate, const string &fwRevision)
Definition TagConventions.h:126
constexpr const char * kImageSemanticObjectIdSegmentation
Object ID segmentation.
Definition TagConventions.h:155
void addDeviceId(T &writer, const string &id)
Definition TagConventions.h:87
constexpr const char * kImageSemanticCamera
Possible values for kImageSemantic.
Definition TagConventions.h:151
Definition AsyncDiskFileChunk.hpp:49