Recording Accelerometer and Gyroscope based gesture pattern and comparing it to trigger and event

1,031 views
Skip to first unread message
Assigned to steve....@gmail.com by me

Jay

unread,
Feb 28, 2014, 1:28:52 AM2/28/14
to mitappinv...@googlegroups.com
Hi,
I am trying to build an app similar to the one available at https://play.google.com/store/apps/details?id=com.probayes.movenlaunch.lite&hl=en

Kindly tell me weather I have understood the concept behind this right. The app records the accelerometer and gyroscope pattern and then compares it. I have a little experience with app inventor and using accelerometers and gyroscopes. I am able to trigger an event by comparing a set of predefined accelerometer patterns, say a tilt the phone two times and it triggers an even, but how to do it in the the way the Move'n launch app does it. Record a pattern and then compare it to trigger an event.

Can anyone tell me or give me some information which are already available by sharing the links, on how to capture a pattern and then compare it. Any algorithm to do this?

Thanks in advance for the people who help me in this project.

Please SEARCH in this forum before posting your question.   There's a good chance your question has already been asked.

If you are asking for technical help, you must provide the following information:
- Are you using MIT App Inventor Classic, MIT App Inventor 2, or something else (what?)

I am using MIT App Inventor 2

- What OS are you using? (e.g, MacOS 1.8, Windows 8, ...)

Windows 8

- What browser are you using (e.g, Chrome version 30, Firefox 24, IE 8, ...)

Chrome
Also provide as much information as you can, such as screenshots and instructions that will let others duplicate the issue.

SteveJG

unread,
Feb 28, 2014, 3:04:13 PM2/28/14
to
Probably not easy.   AI has an Orientation.Sensor and an Accelerormeter.Sensor   (Gyroscope equivalent?   I do not know).
Accelerometer has an Acceleratction.Changed event handler and other tools that  allow you to select the monitoring level and other goodies.

Orientation sensor has Orientation.Changed event handler.

Look here for what AI has available:     CONTROLS.

So, the basic tools are there.  I believe you have the concept OK :  Record a pattern and then compare it to trigger an event. 
Consider Activity.launcher is your friend, but can it launch the apps you are interested in..getting it to work with some apps might be a challenge.

I can think of two ways to record a pattern
1) use a list to temporarily store pattern;  possibly tag1 with the pattern to monitor;tag 2 with a recording of the most recent pattern.
2)Use a TinyDB.  Possibly not as fast as #1 but more persistent.

3) Use a timer (the clock) to sample events and or use the frequency of sampling tools in the two sensors to obtain what goes into in the list slot of Tag2.    Use the timer or a second timer to periodically monitor and compare the  two list items.  What you compare might be just a boolean (true/false) event ... found the pattern, did not find the pattern.   You probably will have lots of logic blocks.

Compare with logic blocks   and if..then statements.

Do not waste your time immediately programming this.  Learn what functions are available for each of the controls and how to use them.    Think about how you want this to work and make a diagram on paper.  Yes, stores still sell paper..you also need a pencil or pen.  I am not being sarcastic, it is just that you will have to make a flow chart diagram to see how this might be possible.

Consider, multiple gestures might be more difficult to compare than a single gesture executed multiple times withing a few seconds..   that is, it might be easier to count the number of occurrences of a single gesture repeated.

Consider, AI2 is not Eclipse or Android Studio.  Those tool probably were what were used to develop the program you wish to reproduce.  The tools available to that product's developer may not be available on AI2.  You will have to be clever.


I hope this is helpful.    Perhaps someone else will supply a link for an algorithm.  My guess, is you might be the first person to do this with AI2.    try googling things like "app inventor orientation sensor"     or "app inventor accelerometer sensor"..for more ideas.

Is this what you needed?

Regards,
Steve





Reply all
Reply to author
Forward
0 new messages