android accelometer detect jumping? - java

Hi!
I'm just starting out with Android development and i was wondering if there is any built in machinery in Android phones that are able to detect if a person is squatting (if a person holds his phone in his hand and keeps his hand steady, the phone changes it's altitude by approximately 1 m) or jumping. The user is holding his phone in his hand in both cases. If there is, what kind of packages should one look into to use those built in detectors?
Thank you very much for your help!

In both cases you'll want to make use of the inbuilt accelerometer. Squatting will be very difficult to detect reliably though. Jumping could be quite easy. For example, when jumping, there will be an upward acceleration significantly greater than gravity, followed by free-fall, followed by another upward acceleration upwards. (Landing).

Related

Is it possible to determine the location of a phone in relation to another phone (or just get accurate GPS data) based on bluetooth or wifi?

I want to determine the location or the direction of a phone in relation to another phone using wifi or Bluetooth since GPS is not accurate enough indoors. Is this possible? I have tried googling it, but I have not been able to find a sufficient answer.
Thank you for your help!
No, you can't- you don't get enough data. Let's say you have 2 phones A and B. A can broadcast a message over bluetooth (this works the same for any other radio type, including wifi). The receiver B can determine it's strength when it receives it. From that and knowing how strong it was when sent, it can know its approximate distance. So you don't know what direction A is, but you know how far he is. And that's all you can get. So you know B is in a circlearound A (this isn't 100% accurate as due to signal noise you're actually in a 2d- ring, but lets assume a perfect world here).
Now imagine A is at a fixed point. Now lets add in phone C, at another fixed point. If you got a message from A and from C and did the same signal strength math, you now B's distance from A and C. Two circles, one around A and C. B will need to be at one of the crossing points- there will be 2 of them. You don't know which.
Now add in D. You now have 3 circles. All 3 will cross at only 1 point. That's B's location. It takes 3 fixed points to find someone. In museums and other indoor places that do location tracking, you'll see dozens of bluetooth beacons, each with their own id, and you triangulate based on which ones you can see at all and which are closest.
That's finding your location relative to fixed points. With non-fixed points, to find someone you'd need to become the 3 points yourself. Imagine B stands still. A can make a reading. Then he can move 10 feet away. Take another reading. Move 10 feet away (not all in one line). Now you have 3 readings and can figure out where B is using the same math as above. Please note that to use this, you have to know very accurately exactly how far and in what directions you moved between the 3 points. If you don't, you won't get any accuracy. It doesn't matter what direction you moved, but you need to know that and the distance exactly.
Now if B is moving, that math will be off. But given the short distances involved it would probably be close enough to find them.
(all this assumes elevation isn't invloved, if it is you need more points).
Now if you're willing to take a hardware based answer- if you have something on the phone that can block the bluetooth signal and you can adjust physically you could get directionality by blocking it to all but a 30 degree cone, trying to read the signal, and moving the blocker until you can. Then you know the direction to within 30 degrees and the distance. But my guess is you're not willing to have them carry lead phone cases :)

Use android compass, accelerometer, and gyroscope to get current position

I'm new to android programing. I know how to get a position of a user in outdoor environment using GPS.
But i'm faced with a problem to find the location of a person inside a building where you don't have GPS available.
I can handle the coding part but i need an idea in how to use compass, accelerometer, and gyroscope data or any other sensor data except GPS to get the current position of the user inside the building after you pass the compass, accelerometer, and gyroscope data to the server. Here consider that the inside of the building is mapped.
Sorry if this is a stupid question.
It sounds like you intend to perform inertial navigation using accelerometer data based on the last good GPS fix. I think you'll find this is not feasible on a mobile phone. Accelerometers used in inertial navigation -- for example, in aircraft -- have to be extremely accurate and highly calibrated to minimize errors. Even then, all inertial systems drift over time. With the relatively low accuracy of a phone, these errors will accumulate quite rapidly and render your position solution unusable very quickly.
Without GPS, most phones can still give you a rough position estimate using cell-site multilateration. This is nowhere near as accurate as a GPS fix, but it's better than nothing.
See also this excellent discussion of indoor locationing (inertial navigation is mentioned there too):
Android accelerometer accuracy (Inertial navigation)
Indoor locationing is quite difficult, if not impossible today.
What works is mounting Low energy Blue Tooth "Beacons" at multiple places in the building,
and use that as info. (see ios Beacons) (But you have to manage that yourself, relation between beaconID and location inside bulding).
With compass, accelerometre and gyroscope you will not have (much) success:
In this Google Tech Talk video it is quite detailed explained why a gyro / accelerometer (relaive) navigation cannot work because the slight inaccuracies accumulate within 2 or 3 seconds so strong that you cannot use the result. This is cause by the double integration, see video at 23:30.
Private WLAN (inside your building) triangulation can work, but not inside an (limited) phone which does not give you the info which WLANs are vissible, at which strength.
What remains the already build it GSM-Cell or Wlan location in your smart phone for indoor usage.
There is one further approach:
Evaluating the magnet fields of an building.
This can work, and at least one company works on that, but you have to calibrate that for each building.
But this is more a reasearch topic, than a well known technic.
Further info
My Algorithm to Calculate Position of Smartphone - GPS and Sensors

Android Game Development - Moving the phone

First of all, sorry for the vague title. I have no other ideas of what could possibly be put there, but you'll see this for yourself as you read on.
I am a very new Java developer for android and a martian to game development, therefore my question is not so related to particulars as it is related to theory and possibilities.
I'm interested in how I can develop my game so if holding the phone horizontally and it is tilted one way or another, an object will move in that direction. I'm sure this is very common and easily done but what about if I wanted the top speed to increase the further it was turned, and the acceleration to increase the quicker it was turned?
I honestly have no idea of the complexity of this question, whether you will laugh and give me one line of code or whether it's something you just can't teach.
Either way, thanks for reading, I look forward to your responses.
Check this out http://mobilestrategist.blogspot.com/2010/01/android-accelerometer-and-orientation.html
This gives you what you need to do what you're asking for, but as the other answer suggests, you may be running before you crawl here. I have been writing Android for 2 years and have yet to take advantage of the accelerometer. Though if you're just looking to noodle around with the device's capabilities, this is as good a place to start as any, I suppose.
You could read about sensors & sensor events.
TYPE_ACCELEROMETER is perhaps what you are looking for...

Detect car acceleration in Android app?

I want to incorporate some Accelerometer code into a Android application im working and want to see if this is possible. Basically what I need is for the code to detect car acceleration motion. I am not wanting to determine speed with the code but just distinguish if the phone is in a car and has accelerated motion (Hence the car is moving for the first time). I have gone through many different accelerometer applications to see if this motion produces a viable profile to go off of and it appears it does. Just looking for something that popups a "Hello World" dialog when it detects your in the car and its moving for the first time down the street. Any help would be appreciated and a simple yes or no its possible would work. I would also be interested in compensating anyone that is capable of doing this as well. I need this done like yesterday so please let me know.
Thank You,
JTW
Basically what I need is for the code
to detect car acceleration motion.
As others have noted, there is no such thing as "car acceleration". There is only acceleration. Acceleration, as a concept in physics, can come from everything from a car to the device being shaken.
So, for example, here is some code that detects a device being shaken.
So, the question then becomes: can you come up with an acceleration value that is definitively from a car in motion? I suspect the answer is no, for most cars. For example, this site indicates that a 2008 Aston Martin demonstrates an acceleration of 6.5 meters/second^2. The force of gravity is greater (9.8 meters/second^2). My shake code will only register a shake at around 12 meters/second^2 -- less than that, and simple movements will be considered a shake.
As another answer suggests, you are probably better served using GPS.
If, on the other hand, you can supply me with a 2008 Aston Martin for testing, I'd be happy to run some accelerometer experiments... :-)
Yes. If by moving the car, the device moves :P
http://stuffthathappens.com/blog/2009/03/15/android-accelerometer/
But probably, it would be better to combine it with GPS.
http://www.devx.com/wireless/Article/43005/1954

How to do Gesture Recognition using Accelerometers

My goal is to recognize simple gestures from accelerometers mounted on a sun spot. A gesture could be as simple as rotating the device or moving the device in several different motions. The device currently only has accelerometers but we are considering adding gyroscopes if it would make it easier/more accurate.
Does anyone have recommendations for how to do this? Any available libraries in Java? Sample projects you recommend I check out? Papers you recommend?
The sun spot is a Java platform to help you make quick prototypes of systems. It is programmed using Java and can relay commands back to a base station attached to a computer. If I need to explain how the hardware works more leave a comment.
The accelerometers will be registering a constant acceleration due to gravity, plus any acceleration the device is subjected to by the user, plus noise.
You will need to low pass filter the samples to get rid of as much irrelevant noise as you can. The worst of the noise will generally be higher frequency than any possible human-induced acceleration.
Realise that when the device is not being accelerated by the user, the only force is due to gravity, and therefore you can deduce its attitude in space. Moreover, when the total acceleration varies greatly from 1g, it must be due to the user accelerating the device; by subtracting last known estimate of gravity, you can roughly estimate in what direction and by how much the user is accelerating the device, and so obtain data you can begin to match against a list of known gestures.
With a single three-axis accelerometer you can detect the current pitch and roll, and also acceleration of the device in a straight line. Integrating acceleration minus gravity will give you an estimate of current velocity, but the estimate will rapidly drift away from reality due to noise; you will have to make assumptions about the user's behaviour before / between / during gestures, and guide them through your UI, to provide points where the device is not being accelerated and you can reset your estimates and reliably estimate the direction of gravity. Integrating again to find position is unlikely to provide usable results over any useful length of time at all.
If you have two three-axis accelerometers some distance apart, or one and some gyros, you can also detect rotation of the device (by comparing the acceleration vectors, or from the gyros directly); integrating angular momentum over a couple of seconds will give you an estimate of current yaw relative to that when you started integrating, but again this will drift out of true rapidly.
Since no one seems to have mentioned existing libraries, as requested by OP, here goes:
http://www.wiigee.org/
Meant for use with the Wiimote, wiigee is an open-source Java based implementation for pattern matching based on accelerometer readings. It accomplishes this using Hidden Markov Models[1].
It was apparently used to great effect by a company, Thorn Technologies, and they've mentioned their experience here : http://www.thorntech.com/2013/07/mobile-device-3d-accelerometer-based-gesture-recognition/
Alternatively, you could consider FastDTW (https://code.google.com/p/fastdtw/). It's less accurate than regular DTW[2], but also computationally less expensive, which is a big deal when it comes to embedded systems or mobile devices.
[1] https://en.wikipedia.org/wiki/Hidden_Markov_model
[2] https://en.wikipedia.org/wiki/Dynamic_time_warping
EDIT: The OP has mentioned in one of the comments that he completed his project, with 90% accuracy in the field and a sub-millisecond compute time, using a variant of $1 Recognizer. He also mentions that rotation was not a criteria in his project.
What hasn't been mentioned yet is the actual gesture recognition. This is the hard part. After you have cleaned up your data (low pass filtered, normalized, etc) you still have most of the work to do.
Have a look at Hidden Markov Models. This seems to be the most popular approach, but using them isn't trivial. There is usually a preprocessing step. First doing STFT and clustering the resultant vector into a dictionary, then feeding that into a HMM. Have a look at jahmm in google code for a java lib.
Adding to moonshadow's point about having to reset your baseline for gravity and rotation...
Unless the device is expected to have stable moments of rest (where the only force acting on it is gravity) to reset its measurement baseline, your system will eventually develop an equivalent of vertigo.

Categories

Resources