结合陀螺仪和加速度计数据 [英] Combine Gyroscope and Accelerometer Data
问题描述
我建立使用乐高Mindstorm的NXT系统平衡机器人。我使用从HiTechnic的两个传感器,首先是一个加速度计和第二个是一个陀螺仪。我已经成功地过滤掉噪声从两个传感器和来自角度为在-90和90度之间的范围内,0度是完全平衡的。
I am building a balancing robot using the Lego Mindstorm's NXT system. I am using two sensors from HiTechnic, the first being an Accelerometer and the second being a Gyroscope. I've successfully filtered out noise from both sensors and derived angles for both in a range between -90 and 90 degrees, with 0 degrees being perfectly balanced.
我的下一个挑战是两个传感器值结合起来,以纠正陀螺仪的漂移随着时间的推移。下面是我从实际的数据创建了一个例子图演示从陀螺仪漂移:
My next challenge is to combine both of the sensor values to correct for the Gyroscope's drift over time. Below is an example graph I created from actual data to demonstrate the drift from the gyroscope:
最常用的方法,我已经看到了,使结合这些传感器坚如磐石的是使用一个卡尔曼滤波器。不过,我不是微积分方面的专家,我真不明白的数学符号,我明白数学源$ C $ C虽然。
The most commonly used approach I've seen to make combining these sensors rock solid is by using a Kalman filter. However, I'm not an expert in calculus and I really don't understand mathematical symbols, I do understand math in source code though.
我使用RobotC(这就像任何其他C衍生物)和倒很AP preciate,如果有人可以给我如何完成这在C的例子。
I'm using RobotC (which is like any other C derivative) and would really appreciate if someone can give me examples of how to accomplish this in C.
感谢您的帮助!
解决方案结果:
好吧,kersny通过介绍我补充过滤器解决我的问题。这是说明我的结果的曲线图:
Alright, kersny solved my problem by introducing me to complementary filters. This is a graph illustrating my results:
结果#1 的
结果#2 的
正如你所看到的,过滤器校正陀螺漂移和两个信号合并成一个单一的光信号。
As you can see, the filter corrects for gyroscopic drift and combines both signals into a single smooth signal.
编辑:自从我反正固定破碎的形象,我认为这将是有趣的,以显示我用来产生这些数据的装备:
Since I was fixing the broken images anyways, I thought it would be fun to show the rig I used to generate this data:
推荐答案
卡尔曼滤波器是巨大的,但是我找到了互补滤波器更容易实现类似的结果。我已经找到了编码一个互补滤波器最理想的用品是<一href="http://web.archive.org/web/20091121085323/http://www.mikroquad.com/bin/view/Research/ComplementaryFilter"相对=nofollow>这个wiki (连同这篇文章关于此页面(在技术文档,相信在zip文件名是filter.pdf);
Kalman Filters are great and all, but I find the Complementary Filter much easier to implement with similar results. The best articles that I have found for coding a Complementary Filter are this wiki (along with this article about converting sensors to Engineering units) and a PDF in the zip file on this page (Under Technical Documentation, I believe the file name in the zip is filter.pdf);
PS。如果你被困在一个卡尔曼滤波器, 是一些C语法$ C $下实现它的Arduino的。
PS. If your stuck on a Kalman Filter, here is some C-syntax code for the Arduino that implements it.
这篇关于结合陀螺仪和加速度计数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!