- Home /
relative orientation to initial coordinate system,relative rotation coordinate transformation
Hi,
I know this topic has been discussed, but I simply can't debug my code.
I want to observe the rate of rotation of the gyroscope in the initial coordinate system the phone.
the phone can be in an arbitrary orientation in time, but I want to look the rotationRateUnbiased.x of the phone in the initital coordinate system. I have tried the following methods:
method 1: gravity myVector = new Vector3(0.00f,-1.00f,0.00f); Quaternion q = Quaternion.FromToRotation(gyro.gravity,myVector); float result = q*gyro.rotationRateUnbiased.x;
method 2: attitude Quaternion initial = new Quaternion(-0.6f,0.4f,0.4f,-0.6f); Quaternion current = gyro.attitude; Quaternion relativeRotation = initial Quaternion.Inverse(current); float resultAttitude = relativeRotation gyro.rotationRateUnbiased.x;
However, both methods yield incorrect result.
Can someone point out what I am doing wrong?
,Hi,
I know this topic has been discussed, but I simply can't debug my code.
I want to observe the rate of rotation of the gyroscope in the initial coordinate system the phone.
the phone can be in an arbitrary orientation in time, but I want to look the rotationRateUnbiased.x of the phone in the initital coordinate system. I have tried the following methods:
method 1: gravity myVector = new Vector3(0.00f,-1.00f,0.00f); Quaternion q = Quaternion.FromToRotation(gyro.gravity,myVector); float result = q*gyro.rotationRateUnbiased.x;
method 2: attitude Quaternion initial = new Quaternion(-0.6f,0.4f,0.4f,-0.6f); Quaternion current = gyro.attitude; Quaternion relativeRotation = initial Quaternion.Inverse(current); float resultAttitude = relativeRotation gyro.rotationRateUnbiased.x;
However, both methods yield incorrect result.
Can someone point out what I am doing wrong?
Your answer
Follow this Question
Related Questions
The vision of a camera (displayed as a 3D Cone) needs to rotate towards the player 1 Answer
How to obtain roll / tilt angle from gyroscope? 3 Answers
quaternion - rotate camera based on original facing at scene start? 0 Answers
Rotate on one axis and check if angle is inside desired range 2 Answers
How to implement a mounted but movable headlight using the gyroscope? 1 Answer