vrpn  07.33
Virtual Reality Peripheral Network
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 
90 {
91  public:
92  vrpn_Tracker_RazerHydra(const char * name, vrpn_Connection * trackercon);
94 
95  virtual void mainloop();
96 
97  virtual bool reconnect();
98 
99  private:
100  enum HydraStatus
101  {
102  HYDRA_WAITING_FOR_CONNECT,
103  HYDRA_LISTENING_AFTER_CONNECT,
104  HYDRA_LISTENING_AFTER_SET_FEATURE,
105  HYDRA_REPORTING
106  };
107 
108  enum
109  {
110  ANALOG_CHANNELS = 6,
111  BUTTON_CHANNELS = 14,
112  POSE_CHANNELS = 2
113  };
114 
115  void _waiting_for_connect();
116  void _listening_after_connect();
117  void _listening_after_set_feature();
118 
119  void _enter_motion_controller_mode();
120 
121  void _report_for_sensor(int sensorNum, vrpn_uint8 * data, double dt);
122 
123  HydraStatus status;
124  bool _wasInGamepadMode;
125  int _attempt;
126  struct timeval _timestamp;
127  struct timeval _connected;
128  struct timeval _set_feature;
129 
130  const float _docking_distance;
131  bool _docked[POSE_CHANNELS];
132  bool _calibration_done[POSE_CHANNELS];
133  int _mirror[POSE_CHANNELS];
134  int _sign_x[POSE_CHANNELS];
135  q_vec_type _old_position[POSE_CHANNELS];
136 
137  q_type _calibration_pose_conj[POSE_CHANNELS];
138 
139  // This device has both a control and a data interface.
140  // On the mac, we may need to swap these because we can't tell which
141  // is which when we open them.
142  class MyInterface;
143 
144  MyInterface * _ctrl;
145  MyInterface * _data;
146 };
147 
148 #else
150 #endif
151 
Device supporting the Razer Hydra game controller as a tracker, analog device, and button device...
Generic connection class not specific to the transport mechanism.
#define VRPN_API
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:65