plus_plugins
plus_plugins copied to clipboard
[Request][sensors_plus]: Get absolute values of Gyroscope readings
Plugin
sensors_plus
Use case
From gyroscopeEvents
I can get the delta of orientation of a device (I guess it's in radians/second
). So if the device is currently not rotating the reading is zero.
In some cases, the developer needs to have absolute values (e.g. in radians
). For example in my scenario when I want to show an image to a user, where user can move the image just by rotating his device. The image needs to be centered when the device is pointing straight, and that's when the absolute values are needed.
Another example of a use case could be those games where you need to tilt your phone to get a ball to a hole through obstacles. The app needs to know when the device is completely flat.
The only package that has this functionality is aeyrium_sensor (it's very poorly maintained). I went through the code and there is a little heuristic to be able to get those absolute readings, but I tested it, and it works well on both iOS and Android. Therefore I would suggest taking the platform code from there.
I'm not that much skilled in the platform code, but if needed I can make the PR. Just let me know.
Proposal
Current gyroscopeEvents
readings :
device pointing straight: pitch = 0, roll...
device pointing down: pitch = 0, roll...
Example of the requested gyroscopeAbsoluteEvents
readings:
device pointing straight: pitch = 0, roll...
device pointing down: pitch = -1.57, roll...
Any updates on this?
Btw, if someone here is also looking for a solution, I found this new up-to-date simple_sensor package, and it has these absolute values.
Update: no, it doesn't have usable pitch values