r57zone / OpenVR-ArduinoHMD

OpenVR driver for Arduino DIY HMD / OpenVR самодельного Arduino шлема
The Unlicense
24 stars 6 forks source link

Replacing YPR state storaging with Hmd quaternion rotation state #8

Open pitboxx opened 3 weeks ago

pitboxx commented 3 weeks ago

When rotating HMD left and right, we encounter a gimbal lock situation. To avoid this, I suggest storing the HDD rotation state also in a quaternion, which rotates incrementally from the IMU sensor.

pitboxx commented 3 weeks ago

I also added moving the position offset to the direction of view of HMD

r57zone commented 3 weeks ago

Hi, thanks for your pull request, however if we reassign yprOffset we can no longer center the helmet in Euler angle mode, which is a pretty important feature

pitboxx commented 3 weeks ago

Added a reset and rotation of the HMD quaternion to current IMU readings inside SetCentering function. Now, when we press Num5, the helmet is centered.

r57zone commented 3 weeks ago

As soon as I can test it, I will accept your changes, thank you very much!

pitboxx commented 3 weeks ago

Thank you. I am glad to help you.

r57zone commented 2 weeks ago

Hi, I checked the fixes, unfortunately in "yaw, pitch, roll mode" the axes start "adding offsets" and stop working correctly.

Does everything work correctly for you?

pitboxx commented 2 weeks ago

Hello. Thank you for testing. I also just came across this effect of accumulation of rotation errors. I am currently in the process of finding a solution for this problem.

pitboxx commented 4 days ago

Hello. I was able to eliminate the gimbal lock between the pitch and roll axes by sequentially applying separate rotation quaternions along each of the axes. Please check it with yourself.