vrpn 07.35
Virtual Reality Peripheral Network
Loading...
Searching...
No Matches
vrpn_Tracker_RazerHydra.h
Go to the documentation of this file.
1
14// Copyright Iowa State University 2011.
15// Distributed under the Boost Software License, Version 1.0.
16// (See accompanying file LICENSE_1_0.txt or copy at
17// http://www.boost.org/LICENSE_1_0.txt)
18
19#pragma once
20
21// Internal Includes
22#include "quat.h" // for q_vec_type
23#include "vrpn_Analog.h" // for vrpn_Analog
24#include "vrpn_Button.h" // for vrpn_Button_Filter
25#include "vrpn_Tracker.h" // for vrpn_Tracker
26
27// Library/third-party includes
28// - none
29
30// Standard includes
31// - none
32
33#ifdef VRPN_USE_HID
34
35#include "vrpn_HumanInterface.h"
36#include "vrpn_OwningPtr.h"
37
93{
94 public:
95 vrpn_Tracker_RazerHydra(const char* name, vrpn_Connection* con = NULL);
96 vrpn_Tracker_RazerHydra(const char* name, hid_device* ctrl_dev,
97 hid_device* data_dev,
98 vrpn_Connection* con = NULL);
99 vrpn_Tracker_RazerHydra(const char* name, const char* ctrl_dev_path,
100 const char* data_dev_path,
101 vrpn_Connection* con = NULL);
103
104 virtual void mainloop();
105
106 virtual bool reconnect();
107
108 private:
109 void _shared_init();
110 enum HydraStatus
111 {
112 HYDRA_WAITING_FOR_CONNECT,
113 HYDRA_LISTENING_AFTER_CONNECT,
114 HYDRA_LISTENING_AFTER_SET_FEATURE,
115 HYDRA_REPORTING
116 };
117
118 enum
119 {
120 ANALOG_CHANNELS = 6,
121 BUTTON_CHANNELS = 14,
122 POSE_CHANNELS = 2
123 };
124
125 void _swap_channels();
126 void _waiting_for_connect();
127 void _listening_after_connect();
128 void _listening_after_set_feature();
129
130 void _enter_motion_controller_mode();
131
132 void _report_for_sensor(int sensorNum, vrpn_uint8 * data, double dt);
133
134 HydraStatus status;
135 bool _wasInGamepadMode;
136 int _attempt;
137 struct timeval _timestamp;
138 struct timeval _connected;
139 struct timeval _set_feature;
140
141 const float _docking_distance;
142 bool _docked[POSE_CHANNELS];
143 bool _calibration_done[POSE_CHANNELS];
144 int _mirror[POSE_CHANNELS];
145 int _sign_x[POSE_CHANNELS];
146 q_vec_type _old_position[POSE_CHANNELS];
147
148 q_type _calibration_pose_conj[POSE_CHANNELS];
149
150 // This device has both a control and a data interface.
151 // On the mac, we may need to swap these because we can't tell which
152 // is which when we open them.
153 class MyInterface;
154
157};
158
159#else
161#endif
162
A unique-ownership smart pointer, with the ability to transfer ownership, but only explicitly (aka,...
virtual void mainloop()=0
Called once through each main loop iteration to handle updates. Remote object mainloop() should call ...
All button servers should derive from this class, which provides the ability to turn any of the butto...
Definition vrpn_Button.h:66
Generic connection class not specific to the transport mechanism.
Device supporting the Razer Hydra game controller as a tracker, analog device, and button device,...
#define VRPN_API
struct hid_device_ hid_device