Monado OpenXR Runtime
u_hand_tracking.h
Go to the documentation of this file.
1 // Copyright 2019-2020, Collabora, Ltd.
2 // SPDX-License-Identifier: BSL-1.0
3 /*!
4  * @file
5  * @brief Hand Tracking API interface.
6  * @author Christoph Haag <christoph.haag@collabora.com>
7  * @ingroup aux_util
8  */
9 
10 #pragma once
11 
12 #include "xrt/xrt_defines.h"
13 #include "util/u_misc.h"
14 
15 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19 
20 
22 {
23  float splay;
24 
25  float joint_curls[4];
26  int joint_count;
27 };
28 
30 {
31  struct u_hand_tracking_finger_value little;
32  struct u_hand_tracking_finger_value ring;
33  struct u_hand_tracking_finger_value middle;
34  struct u_hand_tracking_finger_value index;
35  struct u_hand_tracking_finger_value thumb;
36 };
37 
38 /*!
39  * Values used for the XRT_HAND_TRACKING_MODEL_FINGERL_CURL model.
40  *
41  * @ingroup aux_util
42  */
44 {
45  float little;
46  float ring;
47  float middle;
48  float index;
49  float thumb;
50 };
51 
52 /*!
53  * A space relation of a single joint.
54  *
55  * @ingroup aux_util
56  */
58 {
59  enum xrt_hand_joint joint_id;
60  struct xrt_space_relation relation;
61 };
62 
63 /*!
64  * A set of joints in a single finger.
65  *
66  * @ingroup aux_util
67  */
69 {
70  struct u_joint_space_relation joints[5];
71  int joint_count;
72 };
73 
74 /*!
75  * The set of joints in the XR_HAND_JOINT_SET_DEFAULT_EXT.
76  *
77  * @ingroup aux_util
78  */
80 {
81  struct u_joint_space_relation palm;
82  struct u_joint_space_relation wrist;
83 
84  struct u_finger_joint_set fingers[XRT_FINGER_COUNT];
85 };
86 
87 /*!
88  * Main struct drivers can use to implement hand and finger tracking.
89  *
90  * @ingroup aux_util
91  */
93 {
94  // scales dimensions like bone lengths
95  float scale;
96 
97  union {
98  struct u_hand_tracking_values finger_values;
99  } model_data;
100 
101  struct u_hand_joint_default_set joints;
102 
103  uint64_t timestamp_ns;
104 };
105 
106 /*!
107  * Applies joint width to set.
108  * @ingroup aux_util
109  */
110 void
112 
113 /*!
114  * @ingroup aux_util
115  */
116 bool
117 u_hand_joint_is_tip(enum xrt_hand_joint joint);
118 
119 /*!
120  * @ingroup aux_util
121  */
122 bool
123 u_hand_joint_is_metacarpal(enum xrt_hand_joint joint);
124 
125 /*!
126  * @ingroup aux_util
127  */
128 bool
129 u_hand_joint_is_proximal(enum xrt_hand_joint joint);
130 
131 /*!
132  * @ingroup aux_util
133  */
134 bool
135 u_hand_joint_is_intermediate(enum xrt_hand_joint joint);
136 
137 /*!
138  * @ingroup aux_util
139  */
140 bool
141 u_hand_joint_is_distal(enum xrt_hand_joint joint);
142 
143 /*!
144  * @ingroup aux_util
145  */
146 bool
147 u_hand_joint_is_thumb(enum xrt_hand_joint joint);
148 
149 #ifdef __cplusplus
150 }
151 #endif
void u_hand_joints_apply_joint_width(struct xrt_hand_joint_set *set)
Applies joint width to set.
Definition: u_hand_tracking.c:72
#define XRT_FINGER_COUNT
Number of fingers on a hand.
Definition: xrt_defines.h:1211
xrt_hand_joint
Number of joints in a hand.
Definition: xrt_defines.h:1154
A set of joints in a single finger.
Definition: u_hand_tracking.h:69
The set of joints in the XR_HAND_JOINT_SET_DEFAULT_EXT.
Definition: u_hand_tracking.h:80
Values used for the XRT_HAND_TRACKING_MODEL_FINGERL_CURL model.
Definition: u_hand_tracking.h:44
Definition: u_hand_tracking.h:22
Definition: u_hand_tracking.h:30
Main struct drivers can use to implement hand and finger tracking.
Definition: u_hand_tracking.h:93
A space relation of a single joint.
Definition: u_hand_tracking.h:58
Joint set type used for hand tracking.
Definition: xrt_defines.h:1233
A relation with two spaces, includes velocity and acceleration.
Definition: xrt_defines.h:657
Very small misc utils.
Common defines and enums for XRT.