2 #include "trackable_device.h" 4 #include "controller.h" 5 #include "PSMoveClient_CAPI.h" 6 #include <openvr_driver.h> 12 static const int CONFIG_VERSION;
16 , extend_Y_meters(0.f)
17 , extend_Z_meters(0.f)
18 , z_rotate_90_degrees(
false)
19 , delay_after_touchpad_press(
false)
20 , meters_per_touchpad_axis_units()
21 , calibration_offset_meters(0.f)
22 , disable_alignment_gesture(
false)
23 , use_orientation_in_hmd_alignment(
true)
24 , steamvr_trigger_axis_index(1)
25 , virtual_touchpad_XAxis_index(-1)
26 , virtual_touchpad_YAxis_index(-1)
27 , thumbstick_deadzone(k_defaultThumbstickDeadZoneRadius)
28 , thumbstick_touch_as_press(
true)
29 , linear_velocity_multiplier(1.f)
30 , linear_velocity_exponent(0.f)
31 , system_button_id(k_PSMButtonID_Virtual_4)
32 , hmd_align_button_id(k_PSMButtonID_Virtual_5)
36 configuru::Config WriteToJSON()
override;
37 bool ReadFromJSON(
const configuru::Config &pt)
override;
40 float extend_Y_meters;
41 float extend_Z_meters;
44 bool z_rotate_90_degrees;
47 bool delay_after_touchpad_press;
51 float meters_per_touchpad_axis_units;
55 float calibration_offset_meters;
58 bool disable_alignment_gesture;
61 bool use_orientation_in_hmd_alignment;
64 int steamvr_trigger_axis_index;
67 int virtual_touchpad_XAxis_index;
68 int virtual_touchpad_YAxis_index;
71 float thumbstick_deadzone;
74 bool thumbstick_touch_as_press;
77 float linear_velocity_multiplier;
78 float linear_velocity_exponent;
81 ePSMButtonID system_button_id;
84 ePSMButtonID hmd_align_button_id;
93 VirtualController(PSMControllerID psmControllerID, vr::ETrackedControllerRole trackedControllerRole,
const char *psmSerialNo);
97 vr::EVRInitError Activate(vr::TrackedDeviceIndex_t unObjectId)
override;
98 void Deactivate()
override;
101 vr::ETrackedDeviceClass GetTrackedDeviceClass()
const override {
return vr::TrackedDeviceClass_Controller; }
102 void Update()
override;
103 void RefreshWorldFromDriverPose()
override;
106 const char *GetControllerSettingsPrefix()
const override {
return "virtual_controller"; }
107 bool HasPSMControllerId(
int ControllerID)
const override {
return ControllerID == m_nPSMControllerId; }
108 const PSMController * GetPSMControllerView()
const override {
return m_PSMServiceController; }
109 std::string GetPSMControllerSerialNo()
const override {
return m_strPSMControllerSerialNo; }
110 PSMControllerType GetPSMControllerType()
const override {
return PSMController_Virtual; }
115 std::string fnamebase= std::string(
"virtual_controller_") + m_strPSMControllerSerialNo;
120 void UpdateEmulatedTrackpad();
121 void UpdateControllerState();
122 void UpdateTrackingState();
125 int m_nPSMControllerId;
126 PSMController *m_PSMServiceController;
127 std::string m_strPSMControllerSerialNo;
130 vr::ETrackingResult m_trackingStatus;
133 int m_nPoseSequenceNumber;
137 bool m_bTouchpadWasActive;
139 std::chrono::time_point<std::chrono::high_resolution_clock> m_lastTouchpadPressTime;
140 bool m_touchpadDirectionsUsed;
142 std::chrono::time_point<std::chrono::high_resolution_clock> m_resetPoseButtonPressTime;
143 bool m_bResetPoseRequestSent;
144 std::chrono::time_point<std::chrono::high_resolution_clock> m_resetAlignButtonPressTime;
145 bool m_bResetAlignRequestSent;
149 PSMVector3f m_posMetersAtTouchpadPressTime;
153 PSMQuatf m_driverSpaceRotationAtTouchpadPressTime;
159 static void start_controller_response_callback(
const PSMResponseMessage *response,
void *userdata);
Definition: controller.h:39
Provides printf-style line logging via the vr::IVRDriverLog interface provided by SteamVR during init...
Definition: config.cpp:18
Definition: virtual_controller.h:89
Definition: virtual_controller.h:9
Definition: controller.h:14
Definition: facing_handsolver.h:5