8
<rpavlik@iastate.edu> and <abiryan@ryand.net>
9
http://academic.cleardefinition.com/
10
Iowa State University Virtual Reality Applications Center
11
Human-Computer Interaction Graduate Program
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)
20
#ifndef INCLUDED_vrpn_Tracker_RazerHydra_h_GUID_8c30e762_d7e7_40c5_9308_b9bc118959fd
21
#define INCLUDED_vrpn_Tracker_RazerHydra_h_GUID_8c30e762_d7e7_40c5_9308_b9bc118959fd
24
#include "vrpn_Configure.h"
25
#include "vrpn_HumanInterface.h"
26
#include "vrpn_Analog.h"
27
#include "vrpn_Button.h"
28
#include "vrpn_Tracker.h"
30
// Library/third-party includes
38
/** @brief Device supporting the Razer Hydra game controller as a tracker,
39
analog device, and button device, using the USB HID protocol directly
41
The left wand (the one with LB and LT on its "end" buttons) is sensor 0.
42
Be sure to have the wands resting in their positions on the base when
43
starting - haven't figured out how to do the calibration yet.
45
The base coordinate system is right-handed with the axes:
46
* X - out the right of the base
47
* Y - out the front of the base
50
The wand coordinates are also right-handed, with the tracked point somewhere near
51
the cable entry to the controller. When held with the joystick vertical, the axes
54
* Y - out the front of the controller (trigger buttons)
55
* Z - Up, along the joystick
57
Buttons are as follows, with the right controller's button channels starting
59
* 0 - "middle" button below joystick
60
* 1-4 - numbered buttons
61
* 5 - "bumper" button (above trigger)
62
* 6 - joystick button (if you push straight down on the joystick)
64
Analog channels are as follows, with the right controller starting at 3
66
* 0 - joystick left/right: centered at 0, right is positive, in [-1, 1]
67
* 1 - joystick up/down: centered at 0, up is positive, in [-1, 1]
68
* 2 - analog trigger, in range 0 (not pressed) to 1 (fully pressed).
70
class VRPN_API vrpn_Tracker_RazerHydra: public vrpn_Analog, public vrpn_Button_Filter, public vrpn_Tracker, vrpn_HidInterface {
72
vrpn_Tracker_RazerHydra(const char * name, vrpn_Connection * trackercon);
73
~vrpn_Tracker_RazerHydra();
75
virtual void mainloop();
76
virtual void reconnect();
78
virtual void on_data_received(size_t bytes, vrpn_uint8 *buffer);
82
HYDRA_WAITING_FOR_CONNECT,
83
HYDRA_LISTENING_AFTER_CONNECT,
84
HYDRA_LISTENING_AFTER_SET_FEATURE,
88
void _waiting_for_connect();
89
void _listening_after_connect();
90
void _listening_after_set_feature();
92
void _enter_motion_controller_mode();
94
void _report_for_sensor(int sensorNum, vrpn_uint8 * data);
97
bool _wasInGamepadMode;
99
struct timeval _timestamp;
100
struct timeval _connected;
101
struct timeval _set_feature;
106
#endif // INCLUDED_vrpn_Tracker_RazerHydra_h_GUID_8c30e762_d7e7_40c5_9308_b9bc118959fd