加速度计重力组件 [英] Accelerometer gravity components

查看:37
本文介绍了加速度计重力组件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这个问题肯定已经在某个地方解决过很多次了,如果你知道它们的存在,请赐教,谢谢.

I know this question is definitely solved somewhere many times already, please enlighten me if you know of their existence, thanks.

快速概述:我想从 3 轴加速度计计算这 3 个轴中每个轴上的重力分量.我使用了 2 轴自由体图来计算世界 X-Z、Y-Z 和 X-Y 轴中加速度计的重力分量.但是解决方案似乎有点偏离,对于只有 1 个加速度计轴暴露于重力的极端情况是可以接受的,但是对于 45 度的俯仰和滚转,组合的总幅度大于重力(由 Xa^2+Ya^ 获得)2+Za^2=g^2;Xa、Ya 和 Za 是其 X、Y 和 Z 轴上的加速度计读数).

Quick rundown: I want to compute from a 3 axis accelerometer the gravity component on each of these 3 axes. I have used 2 axes free body diagrams to work out the accelerometer's gravity component in the world X-Z, Y-Z and X-Y axes. But the solution seems slightly off, it's acceptable for extreme cases when only 1 accelerometer axis is exposed to gravity, but for a pitch and roll of both 45 degrees, the combined total magnitude is greater than gravity (obtained by Xa^2+Ya^2+Za^2=g^2; Xa, Ya and Za are accelerometer readings in its X, Y and Z axis).

更多细节:该设备是 Nexus One,除了 3 轴加速度计外,还有一个用于方位角、俯仰和滚转的磁场传感器.

More detail: The device is a Nexus One, and have a magnetic field sensor for azimuth, pitch and roll in addition to the 3-axis accelerometer.

在世界轴上(Z 与重力方向相同,X 或 Y 指向北极,不认为这很重要吗?),我假设我的设备在YZ 轴,以及 XZ 轴上的滚动 (R).有了这个,我使用简单的触发来获得:Sin(R)=Ax/GxzCos(R)=Az/GxzTan(R)=Ax/Az

In the world's axis (with Z in the same direction as gravity, and either X or Y points to the north pole, don't think this matters much?), I assumed my device has a pitch (P) on the Y-Z axis, and a roll (R) on the X-Z axis. With that I used simple trig to get: Sin(R)=Ax/Gxz Cos(R)=Az/Gxz Tan(R)=Ax/Az

还有另外一组音高,P.

There is another set for pitch, P.

现在我将重力定义为在世界轴上有 3 个分量,一个 Gxz 仅在 X-Z 轴上可测量,一个 Gyz 代表 Y-Z,一个 Gxy 代表 X-Y 轴.Gxz^2+Gyz^2+Gxy^2=2*G^22G 是因为重力在这个定义中有效地包含了两次.

Now I defined gravity to have 3 components in the world's axis, a Gxz that is measurable only in the X-Z axis, a Gyz for Y-Z, and a Gxy for X-Y axis. Gxz^2+Gyz^2+Gxy^2=2*G^2 the 2G is because gravity is effectively included twice in this definition.

哦,X-Y 轴会产生一些更奇特的东西......如果需要,我稍后会解释.

Oh and the X-Y axis produce something more exotic... I'll explain if required later.

从这些方程中我得到了 Az 的公式,并删除了 tan 运算,因为我不知道如何处理 tan90 计算(它是无穷大?).

From these equations I obtained a formula for Az, and removed the tan operations because I don't know how to handle tan90 calculations (it's infinity?).

所以我的问题是,有人知道我这样做是对还是错,或者是否能够指出正确的方向?

So my question is, anyone know whether I did this right/wrong or able to point me to the right direction?

谢谢!影碟

推荐答案

据我了解您的问题,您知道设备的俯仰和偏航(来自磁力计),并希望使用此信息来计算重力分量您的每个(设备)坐标轴?

As I understand your question, you know the pitch and yaw of your device (from the magnetometer) and want to use this information to calculate the component of gravity along each of your (device) coordinate axes?

作为一名物理学家,我从小就使用欧拉角而不是俯仰-偏航-滚转,但查看 http://en.wikipedia.org/wiki/Yaw,_pitch,_and_roll 我会这样计算:假设您的设备最初沿全局坐标系定向,因此重力为 gvec:={0,0,-g}(在本地坐标系中).现在我们必须计算 gvec 的局部坐标,因为我们通过偏航-俯仰-滚转(偏航不做你提到的任何事情).对我来说,这对旋转矩阵来说是最简单的:我们必须改变角度的符号,因为 gvec 保持不变.我会用 Mathematica 做这个,因为那是我的锤子,这是一个钉子

As a physicist I'm brought up with Euler angles instead of pitch-yaw-roll, but looking at http://en.wikipedia.org/wiki/Yaw,_pitch,_and_roll I would calculate this as follows: Assume that your device is initially oriented along the global coordinate frame, so that gravity is gvec:={0,0,-g} (in the local frame). Now we have to calculate the local coordinates of gvec as we go through the yaw-pitch-roll (yaw doesn't do anything as you mention). To me this is easiest with rotation matrices: we have to change the sign of the angles since gvec stays put. I'll do this with Mathematica because that's my hammer and this is a nail

yaw = RotationMatrix[-yawangle,{0,0,1}];
pitch = RotationMatrix[-pitchangle, {0,1,0}];
roll = RotationMatrix[-rollangle,{1,0,0}];
gvec={0,0,-g}
yaw.gvec
pitch.yaw.gvec
roll.pitch.yaw.gvec

输出是 gvec 在偏航之前以及偏航、俯仰和滚转之后的本地坐标(所以下面的最后一行应该是您的答案):

The output is the local coordinates for gvec before yaw, and after yaw, pitch, and roll (so last line below should be your answer):

{0,0,-g}
{0,0,-g}
{g Sin[pitchangle],0,-g Cos[pitchangle]}
{g Sin[pitchangle],-g Cos[pitchangle] Sin[rollangle],-g Cos[pitchangle] Cos[rollangle]}

这篇关于加速度计重力组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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