ndeadly / MissionControl

Use controllers from other consoles natively on your Nintendo Switch via Bluetooth. No dongles or other external hardware neccessary.
GNU General Public License v2.0
2.4k stars 137 forks source link

[Bug Report]: Motion controls on DualShock 3 #622

Open antoninvf opened 1 year ago

antoninvf commented 1 year ago

Switch Firmware Version

15.0.1

Atmosphère Version

1.5.2 (Latest)

Mission Control Version

0.9.2 (Latest)

Boot Method

Hekate

Issue Description

Motion controls on DualShock 3 (CECHZC2E)

Only rotating the controller up and down works. (e.g. aiming a bow in botw)

Error Report

No response

Additional Context

If I remember correctly, the DualShock 3 SIXAXIS should have six degrees of freedom so motion controls should work.

ndeadly commented 1 year ago

Only accelerometer support has been added. The controller does have a gyro, but apparently it's only single-axis. I took this comment from the linux driver as a sign not to bother.

Should have named it fouraxis...

antoninvf commented 1 year ago

Weird, from what I remember from PS3 games, the motion stuff was pretty good and would be good enough for like aiming a bow in botw, but it has been a while. I found this old video showing it off but then again it's a presentation from Sony so it might be bs https://youtu.be/afMRIMvgEZE?t=91

If I got a DualShock 4 controller would motion controls work with that?

Masamune3210 commented 1 year ago

The problem with the DS3 is it technically doesn't actually do gyroscopy, it has tilt and limited depth of field and rotation, but just like the rest of the controller, absolutely none of it is in any actual standard. Sony really had a case of standardphobia around the PS3, Vita, and PSP, so a lot of things involving them are quite weird sometimes

ndeadly commented 1 year ago

Weird, from what I remember from PS3 games, the motion stuff was pretty good and would be good enough for like aiming a bow in botw, but it has been a while. I found this old video showing it off but then again it's a presentation from Sony so it might be bs https://youtu.be/afMRIMvgEZE?t=91

Having the accelerometer + a single-axis gyro is enough to fully determine the orientation of the controller in 3d space. The gravity vector is enough to infer the orientation in x and y, and the gyro can be used to resolve any abiguity regarding rotation about the z-axis. I guess this was good enough for the PS3 at the time. Modern systems are typically using sensor fusion methods such as Kalman filtering to merge 3d data from multiple measurement devices in order to compensate for the shortcomings of any single measurement type and thus improving accuracy. Such is the case on the Switch. Unfortunately, the Kalman filter model used on the Switch expects gyro input in all 3 axes. We have no way to reconfigure it for the DS3 setup. You've probably noticed that the motion inputs appear to "lag" currently with the DS3 controller. I think this is the missing gyro data causing the filter to underestimate the output quantities. Adding the single axis we do have may improve this slightly, but will not compensate for the missing data.

I think what the comment in the linux driver is referring to is the fact that the Dualshock 3 and Sixaxis versions of the PS3 controller (and possibly different minor revisions in between) cannot easily be distinguished from one another, making it difficult to normalise the incoming data. The Sixaxis version apparently has the gyro axis inverted and uses a different sensitivity range. I'm also not sure whether the controllers store any motion calibration data.

I might try to investigate at some point whether it's possible to distinguish the controller revisions somehow, and whether it might be possible to improve the current output by synthesising the missing gyro inputs from the acceleration data. In any case, the motion output for these controllers will never be as good as those with true 6-DOF motion sensors.

If I got a DualShock 4 controller would motion controls work with that?

Yes, motion controls are fully supported for both the Dualshock 4 and Dualsense controllers. Controller layout preferences aside, these two are probably the best all-round replacements for the Pro Controller in terms of features and overall compatibility.

antoninvf commented 1 year ago

Ah alright, I thought because of the wikipedia page for the DualShock in the DualShock 3 sections saying "Input: Motion sensing (3 axes, 6 degrees of freedom)" that it would work 😅

Anyways, thanks for explaining and reassuring me that the PS4 controller will work.

ndeadly commented 1 year ago

Ah alright, I thought because of the wikipedia page for the DualShock in the DualShock 3 sections saying "Input: Motion sensing (3 axes, 6 degrees of freedom)" that it would work 😅

Yeah, there seems to be a lot of confusion about this on the internet. Most of the high-level sources seem to say this. There are only 4 values sent in the input reports. Even if the sensor itself could measure angular velocity in all 3 axes, the controller is definitely only sending the measurement of one.

And, if you dig deeper you find sites like this with info about it being only single-axis. https://mclab.uunyan.com/lab/sixaxis/sxs004.htm

(translated from Japanese)

It consists of 3-axis acceleration + 1-axis angular velocity . I thought it was a 6-axis sensor, but it was a shocking result . However, if you think about it carefully , it's a 6-axis detection system , so if you can detect roll, pitch, and yaw of rotation, horizontal x 2, and vertical movement (surge, sway, heave?), this is enough under gravity. It looks like