Monado OpenXR Runtime
u_hand_simulation.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 Wrapper around Mercury's parametric hand code, used by Index and OpenGloves to simulate hand tracking.
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 
14 #include "util/u_misc.h"
15 #include "util/u_hand_tracking.h"
16 
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
23 {
24  struct xrt_vec2 swing;
25  float twist;
26 };
27 
29 {
30  struct u_hand_sim_metacarpal metacarpal;
31  struct xrt_vec2 proximal_swing;
32  // rotation at intermediate joint, then rotation at distal joint
33  float rotations[2];
34 };
35 
37 {
38  struct u_hand_sim_metacarpal metacarpal;
39  float rotations[2];
40 };
41 
43 {
44  // Distance from wrist to middle-proximal.
45  bool is_right;
46  float hand_size;
47  struct xrt_space_relation wrist_pose;
48  struct xrt_space_relation hand_pose;
49 
50  struct u_hand_sim_thumb thumb;
51  struct u_hand_sim_finger finger[4];
52 };
53 
54 
55 void
56 u_hand_sim_simulate(struct u_hand_sim_hand *hand, struct xrt_hand_joint_set *out_set);
57 
58 void
59 u_hand_sim_simulate_for_valve_index_knuckles(const struct u_hand_tracking_curl_values *values,
60  enum xrt_hand xhand,
61  const struct xrt_space_relation *root_pose,
62  struct xrt_hand_joint_set *out_set);
63 
64 void
65 u_hand_sim_simulate_generic(const struct u_hand_tracking_values *values,
66  enum xrt_hand xhand,
67  const struct xrt_space_relation *root_pose,
68  struct xrt_hand_joint_set *out_set);
69 
70 #ifdef __cplusplus
71 }
72 #endif
xrt_hand
Enumeration for left and right hand.
Definition: xrt_defines.h:1190
Definition: u_hand_simulation.h:29
Definition: u_hand_simulation.h:43
Definition: u_hand_simulation.h:23
Definition: u_hand_simulation.h:37
Values used for the XRT_HAND_TRACKING_MODEL_FINGERL_CURL model.
Definition: u_hand_tracking.h:44
Definition: u_hand_tracking.h:30
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
A 2 element vector with single floats.
Definition: xrt_defines.h:250
Hand Tracking API interface.
Very small misc utils.
Common defines and enums for XRT.