集成陀螺仪和加速度计读数

发布于 2024-07-05 23:48:56 字数 507 浏览 4 评论 0原文

可能的重复:
组合陀螺仪和加速度计数据

我读过很多关于卡尔曼滤波器的论文,但似乎很少有好的公开可用的从数学论文到实际工作代码的示例。

我有一个系统,包含一个三轴加速计和一个测量围绕加速计轴之一的旋转的陀螺仪。 该系统设计为由人类手持,并且大部分时间陀螺仪将测量围绕重力矢量或接近重力矢量的旋转。 (在同一行业工作的人可能会从中认识到我在说什么;))我意识到这是有限的。

陀螺仪似乎具有近乎恒定的偏差,该偏差对于系统的每个实例都略有不同。 当系统倾斜以使陀螺仪轴与重力不共线并且绕陀螺仪轴旋转时,我将如何编写一个滤波器以使用加速度计读数来校准陀螺仪? 似乎应该有足够的信息来做到这一点,但被告知没有以及为什么也会有答案:)

Possible Duplicate:
Combine Gyroscope and Accelerometer Data

I have read a number of papers on Kalman filters, but there seem to be few good publically accessible worked examples of getting from mathematical paper to actual working code.

I have a system containing a three-axis accelerometer and a single gyro measuring rotation around one of the accelerometer axes. The system is designed to be held by a human, and much of the time the gyro will be measuring rotation about the gravity vector or close to it. (People working in the same industry will likely recognise what I am talking about from that ;)) I realise this is underconstrained.

The gyros appear to have a near-constant bias that is slightly different for each instance of the system. How would I go about coding a filter to use the accelerometer readings to calibrate the gyro at times when the system is tilted so the gyro axis is not collinear with gravity, and is being rotated about the gyro axis? It seems like there should be enough information to do that, but being told that there isn't and why would be an answer too :)

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

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

发布评论

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

评论(6

攀登最高峰 2024-07-12 23:48:56

您似乎在这里有两个(或三个)单独的问题。

1. 您并不真正了解卡尔曼滤波器和/或其背后的数学原理。 这将使正确实施和使用变得非常困难。

2.你似乎不理解这个问题所涉及的基本物理原理。 (基础物理意味着基础物理,而不是简单物理,因为它并不简单。)

我建议您尝试使用更简单的积分器,例如 Runga-Kutta 4,您可以找到许多书籍,其中包含实现和使用的示例。 对于这个问题应该足够了。 (如果客户指定卡尔曼,请询问原因。)

至于为什么问题受到限制,在我看来,它无法确保设备保持垂直,也无法测量实际方向。 暂时忘记陀螺仪并假设设备不能绕垂直轴旋转。 您有三个加速度计,大概是为了估计 3D 位置。 因此,如果您看到 X 方向上有加速度,您就会增加对您在 X 方向上的位置的估计。 同样,如果您看到 Z 方向上的加速度(我假设是“向上”),您就会增加对 Z 方向上的位置的估计。 现在稍微旋转设备,例如绕 Y 轴旋转 30 度。 现在,当设备认为您正在沿 X 方向加速时,设备实际上的加速度比 X 中指示的要小一点并且它也在 Z 方向上加速。 所以你的位置估计现在不正确。

旋转更难积分(方程更“僵化”,需要更小的时间步长来保持精度)。 但如果设备倾斜(因为设备无法判断它是否倾斜),它们也会遇到类似的计算错误答案的问题。 它会认为绕垂直轴的旋转比实际的大或小,因为旋转的一部分实际上是绕着不同的轴(就像加速部分的一部分是沿着不同的轴一样)。

也许您需要聘请一名顾问(不,我不是在找工作)来帮助您制定数学公式。

You seem to have two (or three) separate problems here.

1. You don't really understand Kalman filters and/or the mathematics behind them. That is going to make it very difficult to correctly implement and use one.

2. You don't seem to understand the basic physics involved in the problem. (Basic physics means underlying physics, not simple physics, because it isn't simple.)

I'd suggest that you try to use a much simpler integrator, such as a Runga-Kutta 4, for which you can find many books with examples of both the implementation and the use. It should be sufficient for this problem. (If the customer specified Kalman, inquire why.)

As for why the problem is under constrained, it seems to me that it is having no way to insure that the device is held vertically and no way to measure the actual orientation. Forget the gyro for the moment and assume the device can not be rotated about a vertical axis. You have three accelerometers, presumably to estimate position in 3D. So if you see an acceleration in the X direction, you increase the estimate of where you are in the X direction. Similarly, if you see an acceleration in the Z direction (which I will assume is "up"), you increase the estimate of where you are in the Z direction. Now rotate the device slightly, say 30 degrees about the Y axis. Now when the device thinks you are accelerating along the X direction, the device is actually accelerating a bit less than indicated in X and it is also accelerating in the Z direction. So your position estimate is now incorrect.

Rotations are much harder to integrate (the equations are more "stiff", requiring a smaller time step to maintain precision). But they will suffer similar problems of computing wrong answers if the device is tipped (because the device can not tell that it is tipped). It will think that the rotation about the vertical axis is larger or smaller than it actually is, because part of the rotation is actually about a different axis (just as part of the acceleration part was along a different axis).

Perhaps you need to hire a consultant (no, I'm not seeking a job) to assist you in formulating the mathematics.

榆西 2024-07-12 23:48:56

鉴于您对卡尔曼滤波器感兴趣,也许您打算通过惯性测量来增强 GPS 数据。 关于你的问题:

“我将如何编写过滤器
使用加速度计读数
有时校准陀螺仪
系统倾斜,因此陀螺仪轴为
与重力不共线,并且
绕陀螺仪轴旋转? 它
看来应该有足够的
执行此操作的信息”

。假设您正在进行工厂校准,并将设备放在工作台上,您将能够独立测量对准。然后运行您将编写的调平代码并返回测量和陀螺仪校准之间的差异产生的陀螺仪偏差误差

如果您想动态更新陀螺仪漂移,那么您将需要卡尔曼滤波器,

就实施而言,我建议第 7 章“GPS 和惯性积分”。 全球定位系统理论与应用第 2 卷 拥有出色的背景它有理论和数学,但没有源代码。

Given your interest in the kalman filter, perhaps you intend to augment GPS data with inertial measurements. About your question:

"How would I go about coding a filter
to use the accelerometer readings to
calibrate the gyro at times when the
system is tilted so the gyro axis is
not collinear with gravity, and is
being rotated about the gyro axis? It
seems like there should be enough
information to do that"

This sounds like a gyrocompasing alignment. Assuming you are doing a factory calibration, and have the unit on a bench, you will be able to independently measure the alignment. Then run the leveling code you will write and back out the gyro bias error from the difference between the measure and gyrocompased alignments.

If you want to update gyro drift on-the fly, then you will need the kalman filter.

As far as implementation goes I recommend Chapter 7, GPS and Inertial Integration of Global Position System Theory and Applications vol 2 has excellent background on the topic. It has the theory and math, but no source code.

二手情话 2024-07-12 23:48:56

我在此博客。 关于卡尔曼滤波的部分有点模糊,但似乎有代码示例。

您还可以在 http://academic.csuohio.edu/simmond/ 找到有关卡尔曼滤波的一般资源Publications.html(8) 中提到的文章是一篇很好的、不太吓人的介绍卡尔曼滤波器背后的数学。

I found good articles about the use of accelerometers and gyroscopes in navigation on this blog. The part on Kalman filtering is a bit hazy, but there seems to be code samples.

You will also find general resources on Kalman filtering at http://academic.csuohio.edu/simond/publications.html. The article referred in (8) is a good, not too scary, introduction to the mathematics behind Kalman filters.

轻许诺言 2024-07-12 23:48:56

nBot,两轮平衡机器人
关于作者如何选择解决他的两轮机器人的平衡问题的大量信息和链接。

nBot, a two wheel balancing robot
Quite a bit of info and links about how this author chose to solve the balance problem for his two wheeled robot.

鲸落 2024-07-12 23:48:56

丹麦的一位绅士刚刚发布了 卡尔曼滤波器的推导示例几乎完全解决了这个问题。

A gentleman in Denmark has just posted a worked example of the derivation of a Kalman filter for solving almost exactly this problem.

隱形的亼 2024-07-12 23:48:56

如果您碰巧正在为 Propeller uController 进行开发,那么视差对象交换 有一些代码。 好问题;-)

If you happen to be developing for the Propeller uController, than the Parallax Object Exchange has some code. Great question ;-)

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