Monado OpenXR Runtime
kine_common.hpp
Go to the documentation of this file.
1// Copyright 2022, Collabora, Ltd.
2// SPDX-License-Identifier: BSL-1.0
3/*!
4 * @file
5 * @brief Random common stuff for Mercury kinematic optimizers
6 * @author Moses Turner <moses@collabora.com>
7 * @ingroup tracking
8 */
9
10#pragma once
11#include <array>
12#include "xrt/xrt_defines.h"
13namespace xrt::tracking::hand::mercury {
14
15// Changing this to double should work but you might need to fix some things.
16// Float is faster, and nothing (should) be too big or too small to require double.
17
18// Different from `Scalar` in lm_* templates - those can be `Ceres::Jet`s too.
19typedef float HandScalar;
20
21// Used for "2.5D" joint locations, with a 2D ray direction in stereographic-space and a 1D depth relative to the
22// middle-proximal joint.
23struct vec2_5
24{
25 xrt_vec2 pos_2d;
26 float depth_relative_to_midpxm;
27
28 float confidence_xy;
29 float confidence_depth;
30};
31
32// Using the compiler to stop me from getting 2D space mixed up with 3D space.
33using MLOutput2D = std::array<vec2_5, 21>;
34
36{
37 float value;
38 float variance;
39};
40
41// Inputs to kinematic optimizers
42//!@todo Ask Rylie if adding `= {}` only does something if we do one_frame_one_view bla = {}.
44{
45 bool active = true;
46 xrt_quat look_dir;
47 float stereographic_radius;
48 MLOutput2D keypoints_in_scaled_stereographic;
49 one_curl curls[5];
50};
51
53{
54 one_frame_one_view views[2] = {};
55};
56
57namespace Joint21 {
58 enum Joint21
59 {
60 WRIST = 0,
61
62 THMB_MCP = 1,
63 THMB_PXM = 2,
64 THMB_DST = 3,
65 THMB_TIP = 4,
66
67 INDX_PXM = 5,
68 INDX_INT = 6,
69 INDX_DST = 7,
70 INDX_TIP = 8,
71
72 MIDL_PXM = 9,
73 MIDL_INT = 10,
74 MIDL_DST = 11,
75 MIDL_TIP = 12,
76
77 RING_PXM = 13,
78 RING_INT = 14,
79 RING_DST = 15,
80 RING_TIP = 16,
81
82 LITL_PXM = 17,
83 LITL_INT = 18,
84 LITL_DST = 19,
85 LITL_TIP = 20
86 };
87}
88
89//!@todo These are not backed up by real anthropometry data; they are just guesstimates. Patches welcome!
90constexpr HandScalar MIN_HAND_SIZE = 0.06;
91constexpr HandScalar STANDARD_HAND_SIZE = 0.09;
92constexpr HandScalar MAX_HAND_SIZE = 0.12;
93
94} // namespace xrt::tracking::hand::mercury
constexpr HandScalar MIN_HAND_SIZE
Definition: kine_common.hpp:90
Definition: kine_common.hpp:36
Definition: kine_common.hpp:53
Definition: kine_common.hpp:24
A quaternion with single floats.
Definition: xrt_defines.h:216
A 2 element vector with single floats.
Definition: xrt_defines.h:250
Common defines and enums for XRT.