Detect car acceleration in Android app? - java

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

Related

Comparing between two skeleton tracking on processing 3

I am currently doing my dissertation which would involve in having 2 people a professional athlete and an amateur. First with the image processing skeletonization I would like to record the professional athlete while performing the squat exercise , then when the amateur performs the exercise I want to be able to compare the professional skeleton with that of the amateur to see if it is properly formed.
Please I m open for any suggestions and opinions , Would gladly appreciate some help
Here lies your question:
properly formed.
What does properly performed actually mean ? How can this be quantified ?
Bare in mind I'm not an athletic/experienced in this field.
If I were given the task I would counter-intuitively go in the opposite direction:
moving away form Processing 3/kinect/computer. I would instead:
find a professional athlete
find a skilled with trainer with functional mobility training.
find an amateur (probably easiest)
Item 2 will be trickier.For example FMS seems to put a lot of emphasis on correct exercising and mobility (to enhance performance and reduce risk of injuries). I'm not sure if that's the only approach or the best. You might want to check opinions on Physical Fitness, consult with people studying/teaching exercise science, etc. Do check credentials as it feels like a field where everyone has an opinion/preference.
The idea is to understand how a professional educated trainer asses correct movement. Take note of how that works in the real world and try to systemise it.
What are the cues for a correct execution ?
is the key poses
the motion in between
how the skeletal and muscular system work together/ the weights/forces applied/etc.
Having a better understanding of how this works in the real world should lead you to things you can start quantifying/comparing numerically on a computer.
Try to make a checklist/score system manually using a pen and paper based on the information you gather. If this works you already have a system you can start programming.
The next step is acquiring the data.
This is probably where the kinect comes, but bare in mind:
the second version of the kinect is more precise than the first
there is a Kinect2 SDK wrapper for Processing 3: use that if you can (windows only). There is a way you can get libfreenect2 working with OpenNI on osx/linux and therefore with SimpleOpenNI in Processing, but it's not straight forward and you won't have the same precision on the skeleton tracking algorithm
use data that is as precise as possible:
you can get the accuracy of a tracked skeleton joint
use an environment that doesn't contain a complex background (makes it easy to segment users and detect/track skeletons with little change of mistaking it for something else). prefer artificial non-incandescent light (less of a problem with kinect v2, but still you want as little IR interference as possible).
comparing orientation matrices or joints on single poses might not be enough to get the full picture: how do you capture/quantify motion taking into account the things that the kinect can't easily see: muscles flexing/forces applied/moving centre of gravity/etc.
try to use a grid system that will make it simple to pair the digital values with real world measurements. Check out how people used to study motion in the past, for example Étienne-Jules Marey or Eadweard Muybridge
Motion capture by Étienne-Jules Marey
Motion study by Eadweard Muybridge (notice the grid)
It's a pretty full on project to get right involving bits of anatomy/physics/kinematics/etc.
Start with the research first:
how did people study this in the past ?
what are the current developments ?
how does it work in the real world (without computers) ?
Take your constraints into account:
what resources (people/gear/etc.) can you use ?
how much time do you have available ?
Given the above, what topic/section of the project can be realistically be tackled to get useful results.
Overall probably something along these lines:
background research
real world studies
comparison system has feature which can be measured both with kinect and by a person
record data (real world data + mobility comparison evalutation and kinect data + mobility comparison)
compare data
write evaluation of findings (how effective is the system? what are limitations ? what could be improved (future work) ? etc.)
In short be aware of the kinect limitations: skeleton tracking is probability based: it's not 100% accurate. use data that's as clean/correct as possible to begin with (make it easy to acquire good data if you can control the capture environment). From what a real trainer would track, what could you track with a kinect ? do a comparison of the intersecting measurements.

android accelometer detect jumping?

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).

Finding the direction with GPS

Please consider this scenario:
An app knows which of a few routes the phone is on, thanks to GPS. That means it knows the only two directions that the device will be traveling in.
Am I right in thinking that the best way to determine which direction the phone is moving (it will almost certainly not be pointing the right way, so compass is not an option) is to poll the GPS until it starts moving, and find the direction the Co-Ords are moving in?
How regularly, and for how long, do you suggest the polling polls/lasts for?
Thanks in advance!
This is a science in itself, read up on kalman filtering. Basically, the difference between the last two points given by the GPS is the direction you are moving. Then errors come into the equation and you need to start learning about good ways to filter the data and get better results.
Attempt at explaining kalman filtering:
A kalman filter uses a Model to predict new values for the predicted thing. It makes an assumption like "stuff usually moves in the direction of their speed. so if it was here a second ago, it will be there now". It will then use this model to predict the next point and when it actually can measure the next point, it will use that data to update the model and assess the accuracy of the prediction. Then it will start giving you predictions based on a combination of real data and predictions which are weighted according to it's measurements of the prediction accuracy. So if the model is normally very accurate but there is suddenly a jump in the data, it will assume that it is a fluke and it will not let it affect the value too much. If the data is very jumpy, it will trust the data more and the model less.

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...

Can anyone help me create a simple machine learning algorithm for a 'pet' application

I'm creating an organism simulator for Android, so I guess the algorithm would ideally be in Java. I realize that there is a whole Stanford course on Machine Learning available on youtube, but I simply don't have the time to sit through the whole thing, and I think for my purposes the solution could be very simple.
The organism will be interacted with by the touchscreen primarily, or even if it's interacted with through the mic or accelerometer the inputs in the algorithm will mostly amount to coordinate positions for the different limbs. I think it will be inelegant to have a 'scolding' or 'rewarding' mechanism for random behaviors, so I would like to avoid that. So tracking general directions or patterns in movements and being able to repeat them when they have a high enough frequency would be the goal.
To be honest I'm not really sure how hard this is to accomplish, but I'd like to hear any feedback to know how much more I have to research before I can implement it.
EDIT: Is this a genetic algorithm? The problem is I have no idea how to measure a successful or non successful evolution.
EDIT 2: Okay, I'll try to add as much detail as possible. The application is still in concept stage at the moment, but I just wanted to know how difficult the algorithm would be to put it. So I'm building it in Processing, which is really just Java. The organism would be comprised of limbs that have a fixed distance between them, but are allowed to move independently from the center piece. The limbs move around freely and would find random points periodically to ease to. The organism would have a center appendage that has x and y coordinates as well, and each of the outer limbs would move in relation to that. The user could interact with the organism by manually moving the appendages or the center piece with drags on the touch screen. When the organism is being interacted with is where the algorithm would be used, because there's no point in learning from just random numbers. So I guess the algorithm would take the x and y coordinates of the center piece into consideration, and each appendage would have its own version of the algorithm that learns independently from the others. For instance, if the user continually dragged the organism to the right side of the touch screen, it might be more attracted to that place when it isn't being interacted with. I hope that clarifies a little bit.
I think that for your case, you should try to sit down and write down what are the variables that you can observe and what are the variables that you want to predict
Observable variables: position of the appendage, how many times a specific one is interacted with, for how long, ...
Variables you want to predict: which appendage will be interacted with next time, ...
Once you have the input variables and output variables, you can try to go through the list of standard machine learning algorithms. There are Weka(Java), Rapidminer, KNIME ... which are both libraries and standalone tools. Try to throw your problem at the available tools and see if you are doing better than chance.
If you are, tune its parameters. If you are not performing better than chance, you should ask your Data Mining/Machine Learning friends. They will know best what will work for your problem.
Other things that might affect your choice of algorithms:
Are there hidden states?
Are the variables independence?
The way I see it, all you'd need to do is have an array of, for example, the appendage coordinates, then just average them out and have it move towards that point on the screen

Categories

Resources