简体   繁体   English

Android传感器偏航,俯仰和滚动

[英]Android sensor yaw, pitch & roll

After a lot of searching and wasted hours, I have been trying to get a stable set of roll, pitch and yaw values from an Android device using the Sensor manager. 经过大量搜索和浪费时间后,我一直在尝试使用传感器管理器从Android设备获得一组稳定的滚动,俯仰和偏航值。 I have tried a couple of options, SensorManager.getRotationMatrix(... and also SensorManager.getOrientation(... 我尝试了几个选项,SensorManager.getRotationMatrix(...以及SensorManager.getOrientation(...)

When I tried to get the roll, pitch and yaw values with getOrientation, the movement was smooth and desirable, however, when I got past the horizon, the rotational direction flipped making it impossible to look up. 当我试图通过getOrientation获得滚动,俯仰和偏航值时,运动是平滑且可取的,然而,当我越过地平线时,旋转方向翻转使得无法向上看。

I then tried with getRotationMatrix(..., I have mostly implemented this but the motion judders horribly even though I have interpolated the values. 然后我尝试使用getRotationMatrix(...,我已经实现了这个,但是即使我已经内插了值,运动仍然可怕地抖动。

I suspect that the issue with my first test was that the values that come back from getOrientation are the pitch, roll and azimuth ? 我怀疑我的第一次测试的问题是从getOrientation返回的值是俯仰,滚转和方位角 I would like to know if there is a way to get the devices local roll , pitch and yaw values within the closed range of [0...360] for each axis and using a system that doesn't involve gravity fields and magnetic poles. 我想知道是否有办法让设备在每个轴的[0 ... 360]的闭合范围内获得局部滚动俯仰偏航值,并使用不涉及重力场和磁极的系统。

You need to low pass filter TYPE_ACCELEROMETER or use TYPE_GRAVITY and also average out the resulting value to get a stable value. 您需要低通滤波器TYPE_ACCELEROMETER或使用TYPE_GRAVITY并平均输出结果值以获得稳定值。 See my implementation at Android getOrientation Azimuth gets polluted when phone is tilted 看看我在Android上的实现getOrientation当手机倾斜时Azimuth被污染了

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM