如何将 2 个四元数旋转回起始位置,然后计算相对旋转? [英] How do you rotate 2 quaternions back to starting position and then calculate the relative rotation?

查看:116
本文介绍了如何将 2 个四元数旋转回起始位置,然后计算相对旋转?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有 2 个 IMU(惯性测量单元),我想计算它们的相对旋转.不幸的是,IMU 的输出给了我相对于全局的两个四元数(我假设这就是四元数的工作方式).但是,我需要测量一个传感器相对于另一个传感器的旋转.一直以来,这两个传感器都从其初始方向在全局轴上旋转.

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.

例如:我将一个传感器连接到胸部,另一个连接到手臂.两个传感器都针对全局轴进行校准.如果我保持这个方向,我可以很好地计算旋转.但是,当我将我的身体旋转到不同的方向(向右 90 度)并执行相同的运动时,传感器围绕其局部轴旋转但输出相对于全局轴的四元数(输出围绕传感器 y 轴的旋转)作为绕 x 全局轴的旋转).

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)

基本上,我想让一个传感器作为旋转参考"轴,我想测量另一个传感器相对于参考传感器(旋转参考轴)的旋转变化.

推荐答案

从一个 Q1 到另一个 Q2 帧的转换就像

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

这篇关于如何将 2 个四元数旋转回起始位置,然后计算相对旋转?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆