Ds4windows: Removing Gyro jitter: Gyro smoothness options

Created on 3 May 2020  Â·  7Comments  Â·  Source: Ryochan7/DS4Windows

From what I can tell, the gyro output from DS4Windows is essentially raw. I can infer this by putting my DS4 controller on the table, and it results in jittery movement in-game.

Is there any control in DS4Windows to change the smoothness of the gyro output (i.e. filter out high frequency noise)?

Most helpful comment

This is a case of needing more details. Gyro Mouse and Gyro Mouse Joystick already have a minor smoothing routine. However, the gyro data sent to the UDP server has no smoothing applied to it. That was the way it was when it was first implemented and I left it that way. I don't use the UDP server so it has not been important to me. Also, nobody has sent a pull request to change the behavior.

As it is, I have been playing around with the 1€ Filter in other projects and it has helped improve gyro controls. I think I would choose to use that filter rather than the weighted average smoothing technique that I had used in other output methods.

https://cristal.univ-lille.fr/~casiez/1euro/

All 7 comments

Was searching for a solution for the same issue. At least minimal filtering of the data sent to UDP would be a lot better.

This is a case of needing more details. Gyro Mouse and Gyro Mouse Joystick already have a minor smoothing routine. However, the gyro data sent to the UDP server has no smoothing applied to it. That was the way it was when it was first implemented and I left it that way. I don't use the UDP server so it has not been important to me. Also, nobody has sent a pull request to change the behavior.

As it is, I have been playing around with the 1€ Filter in other projects and it has helped improve gyro controls. I think I would choose to use that filter rather than the weighted average smoothing technique that I had used in other output methods.

https://cristal.univ-lille.fr/~casiez/1euro/

The 1€ Filter has now been incorporated into DS4Windows. For right now, it is only used to allow Smoothing to be performed for the Gyro 360 Steering Wheel mode. It will take some extra work to try to use the filter for the UDP server output. Also, I currently do not have Cemu nor Breath of the Wild on my system to test any possible changes.

I can incorporate the 1€ Filter for the UDP server output and send it out as a pull request.

Where would you recommend putting the filter and filter logic? I see the UDP server gets the gyro information from class DS4State (i.e. in UDPServer.cs (float)hidReport.Motion.angVelPitch). Should I incorporate the filter into the DS4State class or whatever class updates that value, or should I just incorporate it into the UDP server class and update it on each ReportToBuffer?

It would probably be best to not place the logic in the UDP server class; don't want to add the OneEuroFilter class as a direct dependency. I would probably put the filter instances in the ControlService class and calculate the filtered values in the MotionEvent that passes the data to the UDP server routine.

In Start:
https://github.com/Ryochan7/DS4Windows/blob/jay/DS4Windows/DS4Control/ControlService.cs#L895

In Hotplug:
https://github.com/Ryochan7/DS4Windows/blob/jay/DS4Windows/DS4Control/ControlService.cs#L1174

Version 2.1.10 has an option for using a OneEuro filter for the UDP Gyro output data.

https://github.com/Ryochan7/DS4Windows/releases/tag/v2.1.10

I just installed the newest version of DS4Windows and can confirm that it works with Cemu/Breath of the Wild.

Though when letting the controller sit on the table with smoothing enabled, the camera ever-so-slowly rotates rightward. It rotates as if it was a clock hand, "jumping" to the next rotation, constantly over time. This issue also occurs with smoothing disabled.

Is there smoothing applied to the yaw rotation of the gyro?

Was this page helpful?
0 / 5 - 0 ratings