Android :: Get Accelerometer Reading Every X Seconds?
Jul 23, 2010
To be able to do some accurate calculations that I want for my app, I need to be able to get an accelerometer reading every 100ms. I haven't found a way to do this on android, it seems like the only way to get accelerometer readings is to put a listener that can listen at different intervals. Basically, is there a way to get a reading at exact intervals?
View 2 Replies
Jun 9, 2009
I am developing a game. In which the user controls movement using the accelerometer. Sounds effects can also be enabled. However when laying the phone flat down and playing the game without the accelerometer gives nice 0,0,0 values. However when play WITH SOUNDS on, i get a buch of weird values: while the phone is NOT moving.
This is really a big bug that makes life hard for Game Developers. I tried to take an avarge of the last 5 values from the sensor.. but this is not enough.. The harder the sounds plays: the higher the weird sensor values. When using the headphones: almost no weird values. Seems that sounds interferes with the accelerometer sensor.
View 5 Replies
View Related
Jul 10, 2009
I'm designing a game for Android and I would like to use the accelerometer for some aspects of control. Has anyone come across a tutorial or example for something like this?
View 1 Replies
View Related
Jan 15, 2010
My accelerometer is not reading the angle of the phone right. When I play Teeter I have to keep the phone on a sharpe angle to keep the ball still, and I feel I have to rotate it extra to go into landscape mode. Now the question is... how do I readjust the accelerometer?
View 6 Replies
View Related
Jan 23, 2009
Where can I find a simple example application that uses the Accelerometer Sensor?
I've seen the Open Intents applications, but I'd rather use the raw Android API, at least until I understand it a little better. I'm surprised at the lack of documentation.
View 3 Replies
View Related
May 20, 2010
I want to know how to calculate the accelerometer movement.When i place the mobile horizontally in idle state and similarly when i place the mobile in hands,So there accelerometer value change when it is place horizontally or while it is in hand vertically.How To Identify them,Any Sample Codes will be useful.
View 1 Replies
View Related
Aug 23, 2010
I'm working on adding a calibration feature to an accelerometer-driven game. For the calibration, I need a single value from the accelerometer. Should I register a listener, get the first value it gives me, and unregister it, or is there a better way to get just one value?
View 2 Replies
View Related
Apr 8, 2010
I've been playing with the data given by the accelerometer,trying to work out how I can gauge a shake from front to back or side to side. This all seems straightforward enough.But I'd love to know the direction of the shake. So, if the user is shaking backwards and forwards, I want to know if the device is moving away from the user, or back towards him/her. I can't find any way of telling this.
View 6 Replies
View Related
Oct 17, 2010
I'm tinkering around with trying to build a speedometer using only the accelerometer for use when I go snowboarding. I can read values from the accelerometer but I'm not sure how I would derive the velocity. I was thinking of taking the square root of (X^2 + Y^2 + Z^2) where X, Y, and Z are the values reported by the accelerometer in each axis but that only would only give me the amplitude of acceleration at any given instant. I could multiple that by the sampling frequency to get my instantaneous velocity but this approach fails when I'm moving at a constant speed.
View 2 Replies
View Related
Feb 11, 2009
I wanted to get the frequency of accelerometer output. How many readings can I get per second? And to what precision do I get?
View 5 Replies
View Related
Jun 7, 2010
I know this question is definitely solved somewhere many times already, please enlighten me if you know of their existence,
Quick rundown:
I want to compute from a 3 axis accelerometer the gravity component on each of these 3 axes.
I have used 2 axes free body diagrams to work out the accelerometer's gravity component in the world X-Z, Y-Z and X-Y axes. But the solution seems slightly off, it's acceptable for extreme cases when only 1 accelerometer axis is exposed to gravity, but for a pitch and roll of both 45 degrees, the combined total magnitude is greater than gravity (obtained by Xa^2+Ya^2+Za^2=g^2; Xa, Ya and Za are accelerometer readings in its X, Y and Z axis).
More detail:
The device is a Nexus One, and have a magnetic field sensor for azimuth, pitch and roll in addition to the 3-axis accelerometer.In the world's axis (with Z in the same direction as gravity, and either X or Y points to the north pole, don't think this matters much?), I assumed my device has a pitch (P) on the Y-Z axis, and a roll (R) on the X-Z axis. With that I used simple trig to get:
Sin(R)=Ax/Gxz
Cos(R)=Az/Gxz
Tan(R)=Ax/Az
There is another set for pitch, P.Now I defined gravity to have 3 components in the world's axis, a Gxz that is measurable only in the X-Z axis, a Gyz for Y-Z, and a Gxy for X-Y axis.Gxz^2+Gyz^2+Gxy^2=2*G^2 the 2G is because gravity is effectively included twice in this definition. Oh and the X-Y axis produce something more exotic I'll explain if required later.From these equations I obtained a formula for Az, and removed the tan operations because I don't know how to handle tan90 calculations (it's infinity?).So my question is, anyone know whether I did this right/wrong or able to point me to the right direction?
View 3 Replies
View Related
Oct 27, 2009
I have a code snippet to detect accelerometer movements. It works some times by properly detecting slight movements, but sometimes it detects movements when I kept my device idle too. Are there any problems with built-in accelerometer detection on Android?
I use an HTC G-1 device. My code snippet is below. How do I resolve it so I can detect small device movements but not detect anything when the device is idle?
CODE:..............
View 3 Replies
View Related
Oct 13, 2010
i dont have an android phone write now.But in my application i need to use accelerometer values..so i need an a simulator capable of it.
View 2 Replies
View Related
Jul 9, 2009
We are writing an application that uses acceleration sensor data to plot phone's movement in 3D. We are finding gross inconsistencies in the actual data output by the sensor. Also, sampling rates vary greatly from 8 to 200 millis. (using System.currentTimeMillis())
Specifically, when we try to draw a circle with G1 flat on the table all the time (filtering out gravity accel 9.8), most of the time we would get a plot of phone's position that is not a circle at all. Lots of times, it would be close to a straight line. Sometimes, it would start drawing an arc, but would not close the circle shooting off in a random direction.
We tried to eliminate the time variable, by substituting a constant time sampling rate (10 millis) to calculate phones position, but the result was very close to what we had before (shapewise). Also, the acceleration in Z direction when the phone is displaced lying flat on a table (XY plane) varies too by +/- 2 units which is a lot.
I do not think it is an error in our code, as we have checked it many times. If there were an error indeed and the accelerometer worked properly, we would see a consistently wrong depiction of the phone's movement. Unfortunately, repeating the same movement (circle) would produce sometimes wildly differently shaped plots.
It all comes down to us wanting to know if that is indeed the case that the G1 accelerometer is very unreliable and inconsistent device when used for more or less precise measurements? Is there some documentation/facts paper that would tell us just how reliable accelerometer is?
View 5 Replies
View Related
Sep 9, 2009
It seems trivial to use GPS in a background service, but how can you do the same with the accelerometer? Everything I've tried seems to require a context, but a background service doesn't have a context?
View 5 Replies
View Related
May 30, 2010
the remapCoordinateSystem method remaps the axis for sensor readings, but I want to remap the coordinate system to any angle, for example: new coordinate system is say relative to earth's coordinate system, 20 degrees clockwise to earth's X axis, and 10 degrees to earth's Y axis, while Z is derived from X and Y axis.
View 2 Replies
View Related
Apr 16, 2009
Currently it seems that locking the screen automatically turns off the accelerometer. I looked around for quite a while and didnt find any solution for that. Is that intentional? It would be really helpful to know if this is how it is or if I just didnt find the solution for that so far.thank you for any help on that (and as I said, even "doesnt work right now/on purpose/.
View 5 Replies
View Related
Apr 13, 2010
As I understand it, there seems to have been a change in the OS that prevents the accelerometer from running when the screen turns off and the phone CPU goes into its power saving state.Can this be confirmed?I have gotten around this by using a wake lock, but this is a much less than ideal solution as it drains a lot of battery.If the accelerometer was disabled in low power mode to save the battery, it may very well have the opposite effect in many cases, such as mine.A partial wake lock seems to be required to keep it running, which is obviously much worse than if just the accelerometer were running without the need for the wake lock.Are there any other workarounds anyone knows of to getting accelerometer values while the phone is in low power mode?Also, are there any plans to change this in future versions of the OS?If there are no plans to change this, I would definitely like to petition for this to be changed.
View 14 Replies
View Related
Jul 31, 2010
removing the g factor from accelerometer readings. I am using SensorEventListener with onSensorChanged() method for getting Sensor.TYPE_ACCELEROMETER data. I need only pure acceleration values in all directions. So at any state if the device is stable (or in constant speed), it should give (0.0,0.0,0.0) roughly.
Currently, depending on its pitch and roll, it gives me variable output depending on the g forces acting on each axis. I hope there is some formula to remove this, as I also get orientation values (pitch and roll) from Sensor.TYPE_ORIENTATION listener. I had used some but didn't work.
View 1 Replies
View Related
Jun 8, 2009
I am developing a small application for learning purpose which will move image when accelerometer readings change. I want a mapping of accelerometer values to screen coordinates. I am using trial and error method rite now. But it seems that it will not help. Is there any algorithm??
View 2 Replies
View Related
Jun 28, 2010
Can it be determined that where a person is i.e is he walking ? is he in elevator ? or is he climbing up the stairs ? using android's accelerometer or is there any other way to calculate such in android ?
View 2 Replies
View Related
Apr 20, 2009
Does anyone know how to convert the accelerometer readings from g's to degrees?For example, if I want to use the x-axis readings and measure the tilt of the phone, flat would be 0g = 0 degrees and a 90 degree tilt to the right would be 1g (9.80665 m/sec^2).I can't come up with a formula for say 20 degrees or 45 degrees. Any help would be greatly appreciated.
View 2 Replies
View Related
Jul 9, 2009
Has anyone been able to get the accelerometer on the G1 to sample consistently for long periods of time? We been doing some testing of the G1 accelerometer on Android, and wanted to see if others have gotten the same result.Our test uses a partial wake lock to keep the CPU alive.It stores the xyz values and time to local storage and then writes them to a file on the SD card once a second.The code below produces a csv file.The xyz values we're getting are within the expected range, but the sample rate of the accelerometer varies greatly.To determine that using the file produced, for each sample, we found the difference between the samples timestamp (taken from the SensorEvent) and the timestamp from the previous sample.The test results showed the time between samples ranging from 30 milliseconds up to 4.6 second spikes.We're interested to know if other people are seeing similar behavior from their phones.If you have the time and means.
View 4 Replies
View Related
Nov 19, 2010
I am currently using Java API to get accelerometer values in 5Hz, which is below my requirements. I want to achieve at least 50Hz. Is there any way to increase the sampling rate of accelerometer?
View 2 Replies
View Related
Oct 27, 2010
I'm currently working on a project which requires the detection of user state (walking, running, driving), I've looked through some of the existing solutions on Android platform such as pedometer or calculating velocity with given acceleration, but I'm still unsure how I can approach this problem. Is there a way to accomplish this without much of data mining/signal processing? How can I solve this with simple logic? Or is this better solved with gps instead of accelerometer? The program will only need to return simple user-state descriptions like walking.
View 1 Replies
View Related
Mar 2, 2010
Please tell me how i can stop the change in orientation of application when device rotate. How i can control the accelerometer.
View 5 Replies
View Related
Sep 4, 2010
I just read the developer blog post about non-phone Android devices such as tablets and GoogleTV - http://android-developers.blogspot.com/2010/09/brace-for-future.html.
I'm writing an accelerometer-based game and would like to filter for devices that have an accelerometer (or orientation sensor). Is there a way to do that? It would also be useful to filter for devices with a compass or GPS receiver.
View 2 Replies
View Related
Oct 28, 2009
How do I filter noise of the accelerometer data in Android? I would like to create a high-pass filter for my sample data so that I could eliminate low frequency components and focus on the high frequency components. I have read that Kalman filter might be the best candidate for this, but how do I integrate or use this method in my application which will mostly written in Android Java? or can it be done in the first place? or through Android NDK? Is there by any chance that this can be done in real-time?
View 4 Replies
View Related
Jan 5, 2010
I have looked and looked and looked and I cant seem to find anything that helps me control the accelerometer more then either having it on or off.
Its a little picky, so I need help calibrating it as well as seeing if there is a way I can designate it to only work in certain programs. If there is no way to do that, is there a widget that will allow me to turn the accelerometer on/off that I can download (if so whats the app called in the marketplace)?
View 12 Replies
View Related
Dec 14, 2009
This used to be (what I thought was) a hardware problem with the G1 at some point, but I thought it was resolved for the Droid.
View 2 Replies
View Related