如何使用矩阵相对于另一个向量旋转参考系?

发布于 2024-09-25 06:04:55 字数 912 浏览 2 评论 0原文

现实生活中的案例(有助于理解问题)

我正在构建一个可以绕其所有轴(x,y,z)自由旋转的设备,并配备:

  • 一个加速度计(A),它给了我指向地球中心的矢量 (Va)
  • 提供地球磁场方向的 3D 磁力计 (M) (Vm)

这两个矢量共享相同的参考系 (x ,y,z),但我感兴趣的是找到相对于地球表面指向北方的向量[想象一个手持指南针:我想找到指针应该在哪里指向]。

此视频展示了一个“球形指南针”,其中有我的设备应该以电子方式复制几乎相同的行为。

编码问题

我做了一些研究的 ,在我看来,我应该使用的是 3D旋转矩阵执行以下两个步骤:

  1. 将Vm的参考系从R旋转到R',使得y'平行于Va,
  2. < 不幸的是,我仍然对如何具体

进行操作感到困惑(我以前没有使用向量和矩阵的经验)。让我困惑的一件事是,我可以在谷歌上搜索到的大部分材料都是从角度角度进行讨论的,但是我从两个传感器接收到的数据的形式是 V(Vx, Vy, Vz),其中 Vz、Vy 和 Vz 是 V 沿参考系的分量。

所以我的问题实际上可以归结为:我必须使用什么矩阵才能在第 1 步执行其中的转换?

提前感谢您的时间和专业知识。

Real-life case (helps understand the question)

I am building a device that can freely rotate around all its axis (x, y, z) and is equipped with:

  • an accelerometer (A) that gives me a vector pointing to the centre of the Earth (Va)
  • a 3D magnetometer (M) that gives me the direction of the magnetic field of the Earth (Vm)

The two vectors share the same reference system (x, y, z), but what I am interested to find is the vector that points to the north relative to the Earth surface [think of a hand-held compass: I want to find where the needle should point to].

This video shows a "ball compass" that has pretty much the same behaviour that my device should replicate electronically.

The coding question

I did a bit of research, and it seems to me that I should use is 3D rotation matrices doing the following two steps:

  1. rotate the reference system of Vm from R to R', in such a way that y' will be parallel to Va,
  2. "flatten" the Vm vector setting its y' component to 0

Unluckily I am still confused on how I should proceed in concrete terms (I have no previous experience of working with vectors and matrices). One of the things that confuses me is that most of the material I could google, talks in terms of angles, but the data I am receiving from both sensors is in the form V(Vx, Vy, Vz), where Vz, Vy and Vz are the components of V along the reference system.

So my question really boils down to: what is the matrix I have to use in order to perform the transformation of which at step #1?

Thank you in advance for your time and expertise.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

余生共白头 2024-10-02 06:04:55

我想到的一个更简单的答案是使用叉积。

你可以用 Ve = Va ⨉ Vm 找到东边
然后向北 Vn = Va ⨉ Ve

(这实际上可能是向南,没有考虑惯用手)

One simpler answer that comes to mind is to use cross products.

you can find east with Ve = Va ⨉ Vm
and then north with Vn = Va ⨉ Ve

(this might actually be south, haven't thought through the handedness)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文