Java – How to detect this particular movement gesture by sensor?

How to detect this particular movement gesture by sensor?… here is a solution to the problem.

How to detect this particular movement gesture by sensor?

I’m working on an Android project. Its goal is to detect predefined movement gestures of the device. If the device rotates 45 degrees around the axis (X, Y, or Z) and then rotates back to its first position (the first and second positions will not be accurate, I mean not important if it rotates 50 degrees instead of 4!!!5 degrees) Then the gesture has occurred and the app should detect it.

I tried using the device’s accelerometer and magnetic sensors to continuously monitor the device’s orientation and detect gestures, but the result was Not Acceptable (explained here )。 Any starting point or idea?

Solution

No one seems to be going to provide a specific and value-worthy answer. So let me try to do that.

First of all, even a somewhat raw and straightforward approach can discover the fact that you don’t need to process all the data from the sensor. Also, humans aren’t that fast, so there’s no need to perform 10,000 values per second to identify any particular action.

enter image description here

All you really need is to identify the key points and make your decision. Sounds like tanget? To you?

enter image description here

My practical advice is to test your solution with a normal mouse and an available gesture recognition framework. Because the actual idea is almost the same. So please check:

enter image description here

This may make it easier to develop a suitable solution.

Update

Let’s say I’m holding my phone and I need to rotate it 90 degrees counterclockwise and then 180 degrees clockwise. I hope you don’t expect me to do some complicated 3D shapes in the air (which would ruin usability, and frankly I don’t want to lose my phone), so let’s say we can track a certain point or we can easily simulate it.

enter image description here

See my other answer in order to see simple but feasible solutions to similar problems:

enter image description here

Related Problems and Solutions