Using Quaternion Coefficients to transform a vector from one reference frame to another I hope this

manierato5h

manierato5h

Answered question

2022-06-12

Using Quaternion Coefficients to transform a vector from one reference frame to another
I hope this question is not too trivial, and I welcome any pointers to good resources for this problem. I am not familiar with quaternions and have never had to use them before--all my learning about them has been my reading tonight. But most of the resources I've found haven't been too helpful, and I suspect I'm missing vocabulary that I might need to get to the information I need.
Suppose I have sensor which provides the quaternion coefficients for its relative rotation to some "primary" frame of reference. These coefficients are available in a vector, w , x , y , z , corresponding to the quaternion w + x i + y j + z k. I have a second vector, provided by the same sensor, which indicates acceleration, and is provided in the form X , Y , Z . This second vector provides the data from the sensor's frame of reference, not with respect to the "primary" frame of reference.
My goal is to transform the acceleration vector to the primary reference frame, so I can find the components of that vector with respect to my primary reference frame. This way I can determine the acceleration in each direction in the primary frame of reference.
From terms I've encountered, and a handful of other posts on similar issues, it seems that I would need to use some sort of rotation matrix, or possibly--since I have the quaternion already--use its inverse to return to the primary frame. But I am unsure of this, and wouldn't know how to do that without a better understanding of the methods involved.
I am hoping someone could point me to clear resources on this sort of problem, or explain the procedure (ideally with a simple example), and would be deeply grateful for any assistance.

Answer & Explanation

benedictazk

benedictazk

Beginner2022-06-13Added 22 answers

The solution, for an acceleration vector a, and a quaternion vector q, we have:
a′=qaq−1
A quaternion rotation can be undone by simply taking the inverse of the quaternion vector and applying it to the acceleration vector. Such that:
a=q−1a′q
For the link I supplied, this is as simple as taking the multiplication on page 16, and adjusting the sign of the elements of the quaternion vector such that q1 through q3 are of the opposite sign.

Do you have a similar question?

Recalculate according to your conditions!

Ask your question.
Get an expert answer.

Let our experts help you. Answer in as fast as 15 minutes.

Didn't find what you were looking for?