RflySimSDK v3.08
RflySimSDK说明文档
载入中...
搜索中...
未找到
vrpn_Tracker_OSVRHackerDevKit.h
浏览该文件的文档.
1/** @file vrpn_Tracker_OSVRHackerDevKit.h
2 @brief header for OSVR Hacker Dev Kit
3
4 @date 2014
5
6 @author
7 Kevin M. Godby
8 <kevin@godby.org>
9*/
10
11#ifndef VRPN_TRACKER_OSVR_HACKER_DEV_KIT_H_
12#define VRPN_TRACKER_OSVR_HACKER_DEV_KIT_H_
13
14#include <cstddef> // for size_t
15#include <string> // for string
16
17#include "vrpn_Tracker.h" // for vrpn_Tracker
18#include "vrpn_Analog.h" // for vrpn_Analog
19#include "vrpn_Configure.h" // for VRPN_API, VRPN_USE_HID
20#include "vrpn_Connection.h" // for vrpn_Connection (ptr only), etc
21#include "vrpn_HumanInterface.h" // for vrpn_HIDDEVINFO, etc
22#include "vrpn_Shared.h" // for timeval
23#include "vrpn_Types.h" // for vrpn_uint16, vrpn_uint32, etc
24
25#if defined(VRPN_USE_HID)
26
27/** @brief OSVR Hacker Dev Kit HMD
28 * The official name of the Razer/Sensics HMD (until they change it again...) is
29 * “OSVR Hacker Dev Kit.”
30 *
31 * The devkit will have a built-in head tracker.
32 *
33 * VID 0x1532
34 * PID 0x0B00
35 *
36 * The head tracker shows as a generic HID device
37 *
38 * Protocol for it is as follows (in byte offsets):
39 *
40 * 0:
41 * Bits 0-3: Version number, currently 1, 2, or 3
42 * Upper nibble holds additional data for v3+:
43 * Bit 4: 1 if video detected, 0 if not.
44 * Bit 5: 1 if portrait, 0 if landscape
45 *
46 * 1: message sequence number (8 bit)
47 *
48 * 2: Unit quaternion i component LSB
49 * 3: Unit quaternion i component MSB
50 *
51 * 4: Unit quaternion j component LSB
52 * 5: Unit quaternion j component MSB
53 *
54 * 6: Unit quaternion k component LSB
55 * 7: Unit quaternion k component MSB
56 *
57 * 8: Unit quaternion real component LSB
58 * 9: Unit quaternion real component MSB
59 *
60 * 10: Instantaneous angular velocity about X LSB
61 * 11: Instantaneous angular velocity about X MSB
62 *
63 * 12: Instantaneous angular velocity about Y LSB
64 * 13: Instantaneous angular velocity about Y MSB
65 *
66 * 14: Instantaneous angular velocity about Z LSB
67 * 15: Instantaneous angular velocity about Z MSB
68 *
69 * Each quaternion is presented as signed, 16-bit fixed point, 2’s complement
70 * number with a Q point of 14. The components of angular velocity are signed,
71 * 16-bit fixed point, 2's complement with Q of 9. Reports are either 32 (in old
72 * firmware, early v1 reports) or 16 bytes (most firmware, both v1 and v2) long,
73 * and only v2+ reports contain angular velocity data.
74 *
75 * v3+ reports also contain additional data in the upper nibble of the version
76 * number.
77 *
78 * Report version number is exposed as Analog channel 0.
79 * Analog channel 1 should be interpreted as follows:
80 * 0: Status unknown - reports are < v3 or no connection.
81 * 1: No video input.
82 * 2: Portrait video input detected.
83 * 3: Landscape video input detected.
84 */
86 public vrpn_Analog,
87 protected vrpn_HidInterface {
88public:
89 /**
90 * @brief Constructor.
91 *
92 * @param name Name of tracker.
93 * @param dev Optional Already-opened HIDAPI device for the tracker.
94 * @param c Optional vrpn_Connection.
95 */
96 vrpn_Tracker_OSVRHackerDevKit(const char *name, hid_device *dev = NULL,
97 vrpn_Connection *c = NULL);
98
99 /**
100 * @overload
101 */
103
104 /**
105 * @brief Destructor.
106 */
108
109 /**
110 * @brief Standard VRPN mainloop method.
111 */
112 virtual void mainloop();
113
114 enum Status {
115 STATUS_UNKNOWN = 0,
116 STATUS_NO_VIDEO_INPUT = 1,
117 STATUS_PORTRAIT_VIDEO_INPUT = 2,
118 STATUS_LANDSCAPE_VIDEO_INPUT = 3
119 };
120
121protected:
122 /// Extracts the sensor values from each report.
123 void on_data_received(std::size_t bytes, vrpn_uint8 *buffer);
124 void shared_init();
125
126 /// Timestamp updated during mainloop()
127 struct timeval _timestamp;
128
129 /// Flag indicating whether we were connected last time through the
130 /// mainloop.
131 /// Used to send a "normal"-severity message when we connect with info on
132 /// the device and to handle re-connecting after a USB disconnect.
134
135 /// Used to forcibly send the analog update every so often
136 vrpn_uint16 _messageCount;
137
138 vrpn_uint8 _reportVersion;
139 bool _knownVersion;
140};
141
142#endif // VRPN_USE_HID
143
144#endif // VRPN_TRACKER_OSVR_HACKER_DEV_KIT_H_
定义 vrpn_Analog.h:28
Generic connection class not specific to the transport mechanism.
定义 vrpn_Connection.h:562
定义 vrpn_HumanInterface.h:70
OSVR Hacker Dev Kit HMD The official name of the Razer/Sensics HMD (until they change it again....
定义 vrpn_Tracker_OSVRHackerDevKit.h:87
void on_data_received(std::size_t bytes, vrpn_uint8 *buffer)
Extracts the sensor values from each report.
vrpn_Tracker_OSVRHackerDevKit(const char *name, hid_device *dev=NULL, vrpn_Connection *c=NULL)
Constructor.
vrpn_uint16 _messageCount
Used to forcibly send the analog update every so often
定义 vrpn_Tracker_OSVRHackerDevKit.h:136
virtual void mainloop()
Standard VRPN mainloop method.
bool _wasConnected
定义 vrpn_Tracker_OSVRHackerDevKit.h:133
virtual ~vrpn_Tracker_OSVRHackerDevKit()
Destructor.
vrpn_Tracker_OSVRHackerDevKit(const char *name, vrpn_Connection *c)
定义 vrpn_Tracker.h:49