简体   繁体   中英

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. I have tried a couple of options, SensorManager.getRotationMatrix(... and also 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.

I then tried with getRotationMatrix(..., I have mostly implemented this but the motion judders horribly even though I have interpolated the values.

I suspect that the issue with my first test was that the values that come back from getOrientation are the pitch, roll and azimuth ? 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.

You need to low pass filter TYPE_ACCELEROMETER or use TYPE_GRAVITY and also average out the resulting value to get a stable value. See my implementation at Android getOrientation Azimuth gets polluted when phone is tilted

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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