2 #include "trackable_device.h" 4 #include "controller.h" 5 #include "PSMoveClient_CAPI.h" 6 #include <openvr_driver.h> 13 static const int CONFIG_VERSION;
17 , rumble_suppressed(
false)
18 , extend_Y_meters(0.f)
19 , extend_Z_meters(0.f)
20 , z_rotate_90_degrees(
false)
21 , calibration_offset_meters(0.f)
22 , disable_alignment_gesture(
false)
23 , use_orientation_in_hmd_alignment(
true)
24 , thumbstick_deadzone(k_defaultThumbstickDeadZoneRadius)
25 , linear_velocity_multiplier(1.f)
26 , linear_velocity_exponent(0.f)
30 configuru::Config WriteToJSON()
override;
31 bool ReadFromJSON(
const configuru::Config &pt)
override;
34 bool rumble_suppressed;
37 float extend_Y_meters;
38 float extend_Z_meters;
41 bool z_rotate_90_degrees;
45 float calibration_offset_meters;
48 bool disable_alignment_gesture;
51 bool use_orientation_in_hmd_alignment;
54 float thumbstick_deadzone;
57 float linear_velocity_multiplier;
58 float linear_velocity_exponent;
67 PSDualshock4Controller(PSMControllerID psmControllerID, vr::ETrackedControllerRole trackedControllerRole,
const char *psmSerialNo);
71 vr::EVRInitError Activate(vr::TrackedDeviceIndex_t unObjectId)
override;
72 void Deactivate()
override;
75 vr::ETrackedDeviceClass GetTrackedDeviceClass()
const override {
return vr::TrackedDeviceClass_Controller; }
76 void Update()
override;
77 void RefreshWorldFromDriverPose()
override;
80 const char *GetControllerSettingsPrefix()
const override {
return "playstation_dualshock4"; }
81 bool HasPSMControllerId(
int ControllerID)
const override {
return ControllerID == m_nPSMControllerId; }
82 const PSMController * GetPSMControllerView()
const override {
return m_PSMServiceController; }
83 std::string GetPSMControllerSerialNo()
const override {
return m_strPSMControllerSerialNo; }
84 PSMControllerType GetPSMControllerType()
const override {
return PSMController_Virtual; }
89 std::string fnamebase= std::string(
"ds4_") + m_strPSMControllerSerialNo;
95 const float thumb_stick_x,
const float thumb_stick_y,
96 float &out_sanitized_x,
float &out_sanitized_y);
97 void UpdateThumbsticks();
98 void UpdateEmulatedTrackpad();
99 void UpdateControllerState();
100 void UpdateTrackingState();
101 void UpdateRumbleState(PSMControllerRumbleChannel channel);
107 int m_nPSMControllerId;
108 PSMController *m_PSMServiceController;
109 std::string m_strPSMControllerSerialNo;
112 vr::ETrackingResult m_trackingStatus;
115 int m_nPoseSequenceNumber;
117 std::chrono::time_point<std::chrono::high_resolution_clock> m_lastTouchpadPressTime;
118 bool m_touchpadDirectionsUsed;
120 std::chrono::time_point<std::chrono::high_resolution_clock> m_resetPoseButtonPressTime;
121 bool m_bResetPoseRequestSent;
122 std::chrono::time_point<std::chrono::high_resolution_clock> m_resetAlignButtonPressTime;
123 bool m_bResetAlignRequestSent;
126 bool m_bUseControllerOrientationInHMDAlignment;
129 float m_lastSanitizedLeftThumbstick_X;
130 float m_lastSanitizedLeftThumbstick_Y;
131 float m_lastSanitizedRightThumbstick_X;
132 float m_lastSanitizedRightThumbstick_Y;
135 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: ps_ds4_controller.h:10
Definition: controller.h:14
Definition: ps_ds4_controller.h:63