ALVR icon indicating copy to clipboard operation
ALVR copied to clipboard

Help with my MixedMode FreePIE script

Open DavidJelinek opened this issue 8 years ago • 4 comments

ALVR_MixedMode.zip

Hi, I made my modificication of sample3.py script by your suggestion in Issue #179 to attached ALVR_MixedMode.py script. All gestures works similar like in RiftCat:

  • Back button = System button
  • Top touchpad click = Enable second controller a switch controllers (hands)
  • Left touchpad click = switch On/Off Grip button (behaviour can be customized in starting section)
  • Bottom touchpad click = Application button
  • Right touchpad click = Switch to Fly mode

The cursor keys works like Fly mode - can be mapped to gamepad attached to PC. With this Mixed mode configuration is easy finish SteamVR Tutorial and Oculus Touch basics without changing/switching more modes.

I have now only one problem with position of second controller. I want change position of second controller with yaw rotation of headset to seems move like with your body. I expected that yaw value from alvr.input_head_orientation[0] will be 0-2*PI when I will rotate 360° from left to right and pitch with roll will stay on constant value, but when I rotate all yaw_pitch_roll change values. I don't understand how Euler vectors works. Please look to lines 277 a 279 where is my offset modification for second controller, which works now only when you rotate clockwise 45° and help me with modification to work for 360° rotation.

Thank you for your time.

DavidJelinek avatar Sep 04 '18 22:09 DavidJelinek

@DavidJelinek yes, it is similar to #189 . I'm into the same situation now for positioning the controller when you rotate your head. The problem is, that with the used euler order you only get pitch (alvr.input_head_orientation[1], left right rotation) in the range of +-1/2 pi (-90° .. +90°) and therefor you can't use this angle alone for the correct rotation, you always need the yaw and roll, too.

I'm currently looking into using the quaternion from the head orientation and extracting only the pitch rotation. It should work similar to this: https://stackoverflow.com/questions/5782658/extracting-yaw-from-a-quaternion

TyborAUT avatar Sep 26 '18 05:09 TyborAUT

@DavidJelinek I solved it, see attached example. example_controller_position.zip

TyborAUT avatar Sep 28 '18 17:09 TyborAUT

@TyborAUT Good job!

yaw_pitch_roll may be completely broken... But the euler2quaternion function (perhaps) produces correct quaternion. You can avoid broken data by using this function.

polygraphene avatar Sep 29 '18 18:09 polygraphene

@polygraphene Thanks. I'm currently working on a PS Move + Oculus Go script with virtual movement which is a low cost HTC Vive replacement thanks to your great work with ALVR!

About the euler math. yaw_pitch_roll is not broken! You just have to be careful about the euler convention of the angles (the order in which the angles are applied)! This can be different from implementation to implementation just compare PSMoveFreePieBridge (https://bitbucket.org/hawkinse/psmovefreepiebridge/src/master/PSMoveFreepieBridge/FreepieMoveClient.cpp#lines-271) to yours (https://github.com/polygraphene/ALVR/blob/6cd404898a7ca280404a7596663bf5e5ac2c0e60/alvr_server/Utils.h#L157)

TyborAUT avatar Sep 30 '18 10:09 TyborAUT