如何从加速度的三个轴分量中找到加速度大小的方向? [英] How to find the direction of acceleration magnitude from three axes components of acceleration?

查看:27
本文介绍了如何从加速度的三个轴分量中找到加速度大小的方向?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想做什么?

使用Android的传感器,我收集了很多糖尿病患者跑步锻炼时的加速度值.每个加速度值由三个分量组成:x 轴加速度、y 轴加速度、z 轴加速度.然后,我需要计算每个加速度值的总大小及其方向.

Using the sensor of Android, I have collected a lot of acceleration values when some diabetic patients were running to do physical exercise. Each acceleration value consists of three components: Acceleration in x axis, acceleration in y axis, acceleration in z axis. Then, I need to calculate the total magnitude of each acceleration value and its direction.

那么,是什么造成了问题?

在我的数据中,加速度分量(x、y、z)的方向用符号(+ 或 -)表示.例如:加速度值的x轴分量:+5.4ms^-2,y轴:-2.3ms^-2,z轴:-6.7ms^-2.因此,我想要这样的方向(+或-)每个加速度值的总大小.

In my data, the direction of acceleration components (x, y, z) are represented in sign (+ or -). For example: x axis component of an acceleration value: +5.4ms^-2, y axis: -2.3ms^-2, z axis: -6.7ms^-2.Therefore, I wanted such direction (+ or -) for total magnitude of each acceleration value.

我已经使用公式square_root(x^2 + y^2 + z^2) 计算了每个加速度的大小.但是,我不知道如何计算那个大小的方向?即不知道总加速度的方向(+或-)?

I have calculated the magnitude of each acceleration using the formula square_root(x^2 + y^2 + z^2). However, I do not know how I can calculate the direction of that magnitude? That is, I do not know the direction (+ or -) of total acceleration?

注意:

我检查了很多问答(例如 123) 的 SO.我也检查了 android 文档.虽然文档稍微谈到了方向,但我不明白如何实现以找到总加速度大小的特定方向(+ 或 -).此外,我查阅了很多关于加速的文章.尽管如此,问题仍未解决.

I have checked a lot of Q&A (e.g. 1, 2, 3) of SO. I have checked the android documentation also. Though the documentation talked a little bit about the direction, I did not understand how can I implement to find the specific direction (either + or -) of the total acceleration magnitude. Moreover, I have checked many articles regarding acceleration. Still, the problem is not solved.

推荐答案

您只需使用简单的数学运算即可获得方向 - y/x=tan theta,其中 theta 是 xy 平面中与原点的夹角.类似的数学可以让你从另一个角度参与进来.对您而言,问题仅与手机有关,而不是与用户有关.因此,如果他的手机放在口袋里的某个角度,您将无法得到想要的答案.如果颠倒过来就更糟了.

You can get the direction just by using simple math- y/x=tan theta, where theta is the angle from origin in the xy plane. Similar math can get you the other angle involved. The problem for you is all that is relative to the phone, not to the user. So if his phone was at an angle in his pocket, you won't get the answers you want. Worse if it was upside down.

也就是说 - 我质疑这个的实际需要.如果你想从他们的锻炼中获得相对的努力,幅度应该就足够了.如果您正在尝试执行诸如映射之类的操作,则加速度数据对于准确性而言过于嘈杂.

That said- I question the actual need for this. If you're trying to get relative effort of their exercising, magnitude should be enough. If you're trying to do something like mapping, acceleration data is too noisy for accuracy.

这篇关于如何从加速度的三个轴分量中找到加速度大小的方向?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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