How do you rotate 2 quaternions back to starting position and then calculate the relative rotation?

一曲冷凌霜 提交于 2019-12-21 16:47:18

问题


I have 2 IMU's (Inertial measurement units) and I want to calculate their relative rotation. Unfortunately, the output of the IMU's gives me both quaternions relative to global (I'm assuming that's how quaternions work). However, I need measurements of the rotation of one of the sensors relative to the other. All the while, these two sensors have been rotated from their initial orientation in the global axis.

For example: I have one sensor attached to the chest and the other attached the arm. Both sensors are calibrated to the global axis. If I maintain that orientation, I can calculate the rotations just fine. However, when I rotate my body to a different orientation (90 degrees to the right) and perform the same movement, the sensors are rotating around their local axis but outputting quaternions relative to the global axis (a rotation about the sensors y axis is output as a rotation around the x global axis).

I want the same movements to produce the same quaternions (and thus show the same rotations) regardless of my orientation (laying down, facing left, right, front or backwards)

Basically, I want to have one sensor be the rotating "reference" axis and I want to measure rotational changes with the other sensor relative to the reference sensor (rotating reference axis).


回答1:


Transformation from one Q1 to other Q2 frame is simply done like

Q1intoQ2 = q1.inversed() * q2;
// check it,  q2 = q1 * Q1intoQ2 == q1 * q1.inversed() * q2 == q2


来源:https://stackoverflow.com/questions/25149231/how-do-you-rotate-2-quaternions-back-to-starting-position-and-then-calculate-the

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!