加速度计和陀螺仪数据
我将 Android SDK (2.2) 与 Droid 结合使用,并且可以访问 3 轴加速计和陀螺仪。
如果这暴露了我对物理学的无知,我提前道歉。已经有一段时间了。
我不明白的是,为什么当我倾斜手机时,加速度计会给出不同的 x、y、z 值。它至少是静止不动的,加速度可以忽略不计,甚至速度基本恒定,只是倾斜了。我以为这是陀螺仪的工作?
我不希望方程中存在重力...我只希望其他力影响手机。除非我移动得更快,否则一切最好都是 0,0,0。我想知道我把手机敲到桌子上的力度有多大,以及当我这样做时 x、y、z 力的方向和大小。到目前为止,我对如何使用加速度计和陀螺仪数据访问它感到非常困惑。我试图将陀螺仪作为方向,将加速度计作为幅度。不幸的是,这些数据并不真正同步(我必须设置两个事件来获取每对数据,并且它们可能在不同的时间出现),但仅缓冲它们并假设某种情况可能就足够了同步。
绝望的, 安德鲁
I'm using the Android SDK (2.2) with a Droid and I have access to the 3-axis accelerometer and gyrometer.
I apologize in advance if this reveals my ignorance of physics. It has been awhile.
What I don't understand is why the accelerometer is giving different x,y,z values when I tilt the phone. It's standing still, at least, with negligible acceleration and even mostly constant velocity, it's just tilted. I thought that this was the gyrometer's job?
I don't want gravity in the equation...I just want the other forces affecting the phone. Everything had better be 0,0,0 unless I'm moving it faster. I want to know how hard I hit the phone on the table, and the direction and magnitude of the x,y,z forces when I do so. So far, I am confused beyond belief about how to access this with the accelerometer and gyrometer data. I'm trying to take the gyrometer as the direction and the accelerometer as the magnitude. Unfortunately, the data for those aren't really in sync (I have to setup two events to get each pair of data, and they may come at different times), but it might be good enough to just buffer them and assume some sort of synchronization.
Desperate,
Andrew
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
恐怕这就是加速计的工作原理,在地球上总会有 9.8 G 指向地面。
如果您可以假设您有一个可用的指南针,则只需取一个长度向量 STANDARD_GRAVITY,以从磁力计获取的当前方向旋转,并从加速度计的矢量中减去该方向。
请记住,您还应该抑制从加速度计返回的值,使用最后几个值的运行平均值。
I'm afraid that's just how accelerometers work, here on earth there will always be 9.8 Gs pointing at the ground.
If you can assume that you have a working compass, just take a vector of length STANDARD_GRAVITY, rotate with the current orientation taken from the magnetometer and subtract this from your accelerometer's vector.
Keep in mind that you should also dampen the values you get back from the accelerometer, use a running average of the last few values.