如何使用加速度计计算步数 [英] How to Count the Number of Steps Using the Accelerometer

查看:429
本文介绍了如何使用加速度计计算步数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何计算使用加速度计执行的步数。实际上我计算加速度并使用此代码来计算步长

  length = sqrt(x * x + y * y + z * z ); 
if(length> = 2){
stepcount + = 1;
}

其中长度使用Acceleration.x,acceleration.y,acceleration.z计算加速度
但是我在启动应用程序时遇到的主要问题是stepcount给出了正确的步长值,但是随着时间的推移它的值不正确。请帮助我

解决方案

基本上,您使用某个特定值的突然加速来表示某人正在结束或开始某个步骤。



首先,您必须确保您最终对加速度计进行足够频繁的采样,以免错过任何一个步骤。然后,您将必须确保正确猜测阈值应该是什么。



这将需要大量的反复试验。 / p>

我建议您绘制出随时间变化的长度,并查看您是否能得出通常正确的良好阈值。



但是,无论如何,它永远都不是准确的。我认为真正准确地测量脚步的唯一方法是在鞋中装有脚跟传感器。


i want to know how to calculate steps taken using the Accelerometer. Actually i calculate acceleration and use this code to count step

length = sqrt(x * x + y * y + z * z);
if(length>=2){
   stepcount+=1;
}

where length calculate acceleration using acceleration.x, acceleration.y,acceleration.z But my main problem at starting the application the stepcount gives correct step value but as time pass its value is not correct.Plz help me

解决方案

Basically you're using sudden acceleration over a certain value as a sign that someone is ending or starting a step.

First, you have to make sure you end up sampling the accelerometer frequently enough not to miss a step. Then you're going to have to make sure that you are guessing correctly about what your threshold should be.

This is going to require a lot of trial and error.

What I would recommend is graphing out what the length is over time and seeing if you can come up with a good threshold value that's usually correct.

But, regardless, it's never really going to be accurate. I think the only way to really measure steps accurately is with a heel sensor in the shoe.

这篇关于如何使用加速度计计算步数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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