Android加速度计全系列 [英] Android accelerometer full range

查看:28
本文介绍了Android加速度计全系列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在处理 Android Sensor API 和加速度计数据.虽然内部组件应该支持高加速度(甚至+-16g),但我尝试了一些最近的智能手机,发现暴露数据的最大范围通常是+-2g(例如Nexus 5),有时是+-4g(例如Nexus 4).有没有办法设置传感器的满量程?(我没有设法为此找到公共 API)或者,是否有任何旗舰智能手机支持更高的库存范围?(例如 +-8g、+-16g).

I am currently working with Android Sensor API and accelerometer data. Though the internal components should support high acceleration (even +-16g), I tried some recent smartphone and found that the maximum range of exposed data is usually +-2g (e.g. Nexus 5) and sometimes +-4g (e.g. Nexus 4). Is there any way to set the full scale of the sensor? (I didn't manage to find a public API for this) Alternatively, is there any flagship smartphone that support higher range from stock? (e.g. +-8g, +-16g).

推荐答案

我面临和你一样的问题.免责声明:我刚刚发现我正在写的东西,所以我根本没有测试过......但我认为它的方向是正确的.

I'm facing the same problem as yours. DISCLAIMER: I just discovered what I'm writing, so I haven't tested it at all... but I think it's in the right direction.

检查哪个范围起作用非常简单:Sensor.getMaximumRange()http://developer.android.com/reference/android/hardware/Sensor.html#getMaximumRange%28%29

Checking what range is functional is quite simple: Sensor.getMaximumRange() http://developer.android.com/reference/android/hardware/Sensor.html#getMaximumRange%28%29

现在,如您所知,设置适当的值是一件更复杂的事情.我相信它与Android所谓的硬件抽象层"有关https://source.android.com/devices/reference/files.html

Now, as you know, setting the appropriate value is a much more involved thing. I believe it has to do with Android's so-called "Hardware Abstraction Layer" https://source.android.com/devices/reference/files.html

我找到了 STMicroelectronics 的这份文档,他们是三星 Galaxy SIII 和 S4 中嵌入的加速度计的制造商 http://www.st.com/st-web-ui/static/active/en/resource/technical/document/application_note/DM00063297.pdf

I've found this document by STMicroelectronics, who are the manufacturers of the accelerometers embedded in Samsung Galaxy SIII and S4 http://www.st.com/st-web-ui/static/active/en/resource/technical/document/application_note/DM00063297.pdf

如果我猜对了,您需要在 configuration.h(文档的第 5 页)中将 ACCEL_MAX_RANGE 定义为 8 或 16*GRAVITY_EARTH.下面有很多说明,我仍在努力理解,但我认为需要将智能手机设为 root 并从其源代码编译 Android.

If I'm getting it right, you need to #define ACCEL_MAX_RANGE in configuration.h (page 5 of the document) as 8 or 16*GRAVITY_EARTH. There are plenty of instructions following, which I'm still trying to understand, but I think one would need to root the smartphone and compile Android from its source.

希望这有帮助!如果您设法解决了它,请告诉我,以便我们互相帮助.

Hope this helps! If you manage to solve it, please let me know so that we can help each other.

问候

这篇关于Android加速度计全系列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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