加速度计低通滤波器平滑 [英] Accelerometer Low Pass Filter Smoothing

查看:142
本文介绍了加速度计低通滤波器平滑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用设备加速度计,并尝试平滑加速度计数据 CMAcceleration

I am using the device accelerometer and try to smooth the Accelerometer Data CMAcceleration.

我正在执行此操作借助以下代码:

I am doing this with help of this code:

-(void)proccessAccelerometerData:(CMAcceleration)accelData {
    currentAccelX = (kUpdateInterval * accelData.x) + ((1.0 - kUpdateInterval) * currentAccelX);
    currentAccelY = (kUpdateInterval * accelData.y) + ((1.0 - kUpdateInterval) * currentAccelY);
}

currentAccelX currentAccelY 是最后的加速度计x和y数据。

Which currentAccelX and currentAccelY is the last accelerometer x and y data.

现在,我有了平滑的x和y值,什么是我的x或y值来确定用户向左/向右/向上/向下移动设备的ID?

Now, I have the smooth x and y values, What is my value of x or y to determine id the user move the device left/right/up/down?

只是为了使情况更清楚,例如,我有4个按钮,每个按钮分别用于向左/向右/向上/向下的方向,我想确定用户用户向哪个方向滑动设备? (不滑动手势)。
预先感谢!

Just to make things more clear, for example, let's say that I have 4 buttons, one for each direction left/right/up/down and I want to determine which direction the user user swipe the device? (not swipe gesture). Thanks in advance!

推荐答案

假设设备以纵向放置,则x轴指示移动到

y轴指示设备上下移动(正y向上,负y向下) 。

z轴指示设备向前和向后移动(正z朝向用户,负z远离用户)。

有一个信息图形由Apple提供: developer.apple.com

Assuming you hold the device in portrait orientation, the x-Axis indicates the movement to the left and right (positive x is to the right and negative x to the left).
The y-Axis indicates the movement of the device up and down (positive y is upwards and negative y is downwards).
The z-Axis indicates the movement of the device forwards and backwards (positive z is towards the user and negative z is away from the user).
There is an info graphic by Apple: developer.apple.com

这篇关于加速度计低通滤波器平滑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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