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?
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.
I have a HTC Hero here, and when I tried to get the list of available sensors on the device by calling ((SensorManager) getSystemService (Context.SENSOR_SERVICE)) .getSensorList(Sensor.TYPE_ALL); I get only the following sensors: D/SensorManager( 6302): found sensor: BMA150 3-axis Accelerometer, handle=0 D/SensorManager( 6302): found sensor: AK8973 3-axis Magnetic field sensor, handle=1 D/SensorManager( 6302): found sensor: AK8973 Orientation sensor, handle=2 D/SensorManager( 6302): found sensor: AK8973 Temperature sensor, handle=3 According to the specs, there should be a light and a proximity sensor on the Hero, and I've seen it in action (the automatic screen brightness adjustment) - so at least the ambient light sensor is definitely there. My question is then, why doesn't the getSensorList return for me the light and the proximity sensors?
Does anyone know the difference between the orientation sensor and magnetic field sensor on Android?Since I've read that magnetometer is synonymous with digital compass I'm a little bit confused. What are they really?
My home icon is way less responsive than the back icon which seems to be perfectly normal. Sometimes I have to "press" the home icon twice to get the "buzz" and have it move the screen. However the back icon works 99% of the time on the first press. IS there any adjustment I can make or should I bring the phone back. I have had it now for 2 weeks.
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?
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.
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?
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.
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.
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?
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?
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?
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?
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.
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/.
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.
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.
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??
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 ?
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.
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.