-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to control unsteady rotation and unwanted flips of brain slices generated via IDL bridged to python using HTC Vive Controller? #18
Comments
This appears to be related to how this library converts the pose matrix to euler angles. This has been suspect many other times as well and has to do with how the sin and cos functions used in this conversion handle the transition from 0 deg to 360. Also in your code, you are calling .get_pose_euler() 6 times and accessing each element. This could mean that the pose information comes from separate samples. Better to do this as: If possible can you adapt your IDL script to use a pose matrix instead of euler angles? How about quaternions? |
Thanks @lgbeno . We'll try and let you know in a while what happens ahead. |
@lgbeno we tried implementing the above method :
However, self.index is throwing an error : |
I added a "get_pose_matrix" function however will leave it to you to test and see if it works: https://github.com/TriadSemi/triad_openvr/blob/master/triad_openvr.py#L113 self.index is a member of the vr_tracked_device_class so you have to define the function inside that class. now you should be able to do: mat = v.devices["controller_1"].get_pose_matrix() |
Hey @lgbeno ! thanks for the "get_pose_matrix" function. We tested it and it works just fine. Upon moving ahead to use quaternions for displaying the slices, we are facing a difficulty. We do not know the exact usage of "r_w" obtained from "convert_to_quaternion" function. When we use euler coordinates, we get six parameters( x,y,z,r_x,r_y,r_z) which are passed directly into the
|
@Vitthal98, maybe you have found your answer by now, but quaternions are an alternative to euler angles which solves an issue known as gimbal lock. In 3D rendered things, quaternions are commonly used due to their advantages, so optimally you would use the 4 part quaternion for angles and not worry about euler angles. |
We are trying to generate 2D brain slices from 3D model of the brain using VR controller ( HTC Vive). We want to control brain orientation using controller's rotation and be able to generate slices in all possible directions by moving the controller. Our current code is able to extract the slices but traversing them and changing the orientation of brain is difficult because the controls are unstable. The slices flip randomly over a slight change in the controller position. The code does not read the slice in the right orientation of the controller pose. This needs to be corrected.
We have written the code in python and are extracting the brain slice using IDL bridged to python. To track controller's movement and linking it 3-D model of the brain we are using a python library triad_openvr. To get controller's co-ordinates and rotation we are using get_euler_pose()[]. We set the initial co-ordinates and rotation to 0 so that controller sets the origin to the place it was kept initially.
The slices appear as expected most of the times. It is the traversal that is causing an issue. Movement of controller causes slices to behave differently at times. The slices tend to flip over a certain rotation of the controller and the movement is not smooth. It has become difficult to synchronize the axes of the brain with the real life axes.
The text was updated successfully, but these errors were encountered: