尝试校准加速度计

发布于 2024-11-27 08:46:47 字数 356 浏览 0 评论 0原文

我正在编写一个应用程序,它将使用加速度计来计算施加在手机上的平均地理力。考虑到这个问题,我得出的结论是,当手机处于静止状态时,将所有轴值加在一起将得到+9.8(重力加速度)的答案。

我现在假设,如果我从所有轴的总和中减去 9.8,它将给出施加在手机上的合力,而不考虑重力。因此,如果手机处于固定位置,它将返回值 0。

现在,如果手机直接位于一个轴上,但如果手机以大约 45 度的角度靠在某个物体上,则结果确实如此。角度,它返回一个 4-5 的值(大约是重力的一半),角度越接近轴,记录的力就越小(继续假设它是成比例的)

根据我的理解,这应该不会发生,它应该返回 0 作为所有的轴都会互相抵消,不是吗?由于手机是静止的,所以手机应该没有记录到力,对吗?

I am writing an app that will use the accelerometer to calculate the average geforce exerted on the phone. Thinking about the problem, I came to the conclusion that when the phone is in rest, adding all of the axis values together will give me an answer of +9.8 (acceleration due to gravity).

I now assumed that if I subtract 9.8 from the sum of all axes, it will give me the combined force being exerted on the phone without taking gravity into account. So if the phone was to be in a fixed position it would return the value 0.

Now this does work out to be true if the phone is lying directly on one axis, but if the phone were to lie against something at a ~45 degree angle, it returns a value of 4-5 (roughly half that of gravity) the closer the angle gets to an axis, the smaller the registered force is (going to go ahead and assume that it is proportional)

From my understanding, this shouldn't happen, it should return a 0 as all of the axis would cancel each other out, no? as the phone is stationary there should be no force recorded with the phone right?

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

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

发布评论

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

评论(1

凝望流年 2024-12-04 08:46:47

4-5 m/s2 的值表示计算中存在小错误或硬件缺陷。你说你正在添加所有值,但是你怎么做呢?您必须将幅度计算为 sqrt(x*x + y*y + z*z)。这是因为速度、位置等加速度都是向量,并且计算它们的长度根据勾股定理

一般来说,这些传感器并不像您想象的那么精确。在 iPhone 上,我测量的 g 力值在 9.75 到 9.87 之间。值取决于温度(将其放入冰箱中,您会得到较低的值 - 我检查过;-)并且在改变方向时确实存在差异。我发现值增量为 0.3 m/s2。为了解决这个问题,你需要大量的数学知识(卡尔曼滤波器或类似的东西)和当然还有第二个传感器(陀螺仪,因为磁力计,即指南针反应太慢)。

A value of 4-5 m/s2 indicates either a little bug in your calculation or a hardware defect. You said that you are adding all values, but how do you do it? You have to calculate the magnitude as sqrt(x*x + y*y + z*z). This is because acceleration like velocity, position, ... are vectors and their length is calculated according to the Pythagorean theorem.

In general these sensors are not that exact as you might expect. On iPhone I measured g-force values between 9.75 and 9.87. Values depend on temperature (put it in the fridge and you get lower values - I checked it ;-) and there are indeed differences when changing the orientation. I found value deltas of 0.3 m/s2. In order to get this fixed you will need heavy maths (Kalman-Filter or similar stuff) and of course a second sensor (gyroscope because magnetometer i.e. compass reacts too slow).

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