Monado OpenXR Runtime
Loading...
Searching...
No Matches
b_hand_tracker.hpp
Go to the documentation of this file.
1// Copyright 2026, NVIDIA CORPORATION.
2// SPDX-License-Identifier: BSL-1.0
3/*!
4 * @file
5 * @brief C++ base implementation of @ref xrt_hand_tracker.
6 * @ingroup base
7 */
8
9#pragma once
10
11#include "b_hand_tracker.h"
12
14
15#include <array>
16
17
18/*!
19 * How the base hand tracker selects backing hand-tracking devices.
20 *
21 * System mode follows the static hand-tracking roles on @ref xrt_system_devices.
22 * Device-locked mode ignores those roles and only considers the
23 * @ref xrt_hand_tracker_create_info::locked_xdev supplied at creation.
24 * Callback mode asks a caller-provided callback for the ordered devices to use.
25 */
27{
28 System,
29 DeviceLocked,
30 Callback,
31};
32
33class HandTracker : public xrt::util::HandTrackerBase<HandTracker>
34{
35public: // Methods
39 void *callbackData);
40
42 init();
43
45 locate(xrt_space_overseer *xso,
46 xrt_space *base_space,
47 const xrt_pose *base_offset,
48 int64_t at_timestamp_ns,
49 xrt_hand_tracker_location *out_location);
50
52 setOutput(xrt_output_name name, const xrt_output_value *value);
53
54 void
55 destroyHandTracker();
56
57
58private: // Types
59 struct Source
60 {
61 xrt_device *xdev{nullptr};
63 };
64
65
66private: // Members
67 struct xrt_system_devices *mSystemDevices{nullptr};
69 HandTrackerMode mMode{HandTrackerMode::System};
70 b_hand_tracker_get_devices_func_t mGetDevices{nullptr};
71 void *mCallbackData{nullptr};
72
73 std::array<Source, 6> mInputs{};
74 uint32_t mInputCount{0};
75
76 //! Callback mode is intentionally ignored here: output goes only to static/locked devices.
77 std::array<struct xrt_device *, 2> mOutputs{};
78 uint32_t mOutputCount{0};
79
80
81private: // Methods
83 resolveSource(enum xrt_input_name input_name, Source &out_source);
84
86 addCallbackInputs(xrt_input_name input_name);
87
89 addInput(const Source &source);
90
91 void
92 addOutput(struct xrt_device *xdev);
93};
Base implementation factory for xrt_hand_tracker.
HandTrackerMode
How the base hand tracker selects backing hand-tracking devices.
Definition b_hand_tracker.hpp:27
Definition b_hand_tracker.hpp:34
Helper wrapper for xrt_hand_tracker.
Definition g_hand_tracker.hpp:21
Header for glue classes to wrap xrt hand tracker interfaces.
xrt_result_t(* b_hand_tracker_get_devices_func_t)(enum xrt_input_name input_name, struct xrt_system_devices *xsysd, void *data, uint32_t in_xdev_count, struct xrt_device **out_xdevs, uint32_t *out_xdev_count)
Callback used by b_hand_tracker_create_with_cb to provide an ordered list of devices to try for input...
Definition b_hand_tracker.h:32
xrt_input_name
Every internal input source known to monado with a baked in type.
Definition xrt_defines.h:930
enum xrt_result xrt_result_t
Result type used across Monado.
xrt_output_name
Name of a output with a baked in type.
Definition xrt_defines.h:1612
@ XRT_INPUT_GENERIC_HEAD_POSE
Standard pose used for rendering.
Definition xrt_defines.h:933
A single HMD or input device.
Definition xrt_device.h:311
Creation parameters for xrt_hand_tracker.
Definition xrt_hand_tracker.h:35
Result of locating a hand tracker.
Definition xrt_hand_tracker.h:59
A union of all output types.
Definition xrt_defines.h:2386
A pose composed of a position and orientation.
Definition xrt_defines.h:492
Object that oversees and manages spaces, one created for each XR system.
Definition xrt_space.h:97
A space very similar to a OpenXR XrSpace but not a full one-to-one mapping, but used to power XrSpace...
Definition xrt_space.h:32
A collection of xrt_device, and an interface for identifying the roles they have been assigned.
Definition xrt_system.h:215