- Home /
Linearization of Android Acceleration Input
UPDATE If anyone is looking for a solution to this problem reference the forum post Reset Accelerometer? Is it possible? Tweaking and implementing this solution was much simpler than what I was attempting to accomplish in this post.
Hello fellow Uni-teers, I have a question for all of you math brainers out there. Let me preface this by saying that I probably slept through half of my math classes so if any of my concepts/vocab/understanding of the topic are incorrect, please be gentle :)
What I am trying to accomplish:
A simple control system where rotation of the device results in movement around the screen (X and Y only) within a preset confine. The players’ position is based on the delta input from their set default orientation meaning when the user returns the device to the default position, the character returns to the default position as well. (delta input = 1 means player position = 1, 0 = 0 and so forth) This control scheme is very much like the android game My Paper Plane.
What is working:
I have written a formula to convert the default android acceleration input (0 to +- 1 for every 90 degrees of rotation) to something that more suits my needs (0 to +- 2 for every 180 degrees of rotation) This allows me to easily save a default orientation and calculate the delta input from that orientation. This solution is working perfectly for me so far except for…
The problem:
The values that the android device feeds me are not linear. Rather, in a 360 degree cycle, they create a sin wave. This gradual falloff of perceived input (towards the +1/-1 end of the wave) is causing non uniform movement per degree of rotation and even dead spots! This is not conducive to what I want.
The data:
BLUE is a graph of rotation vs. acceleration input that the device currently gives along with the approximated data per 5 degrees of input for 180 degrees.
ORANGE This is what I need the graph to look like. Straight lines, uniform input per unit of rotation, a happy developer :D
What I need:
I need to linearize the data from the android accelerometer (graph 1) to feed into my formula for conversion and movement.
The solution:
This one is for you guys… Please let me know if anything needs clarification or more information. Also if anyone has a simpler solution to create such movement, I am all ears :)
Thanks in advance,
Your friendly neighborhood Space Ninja
for the well formatted question! Unfortunately I have no idea how to help you...
Answer by s_guy · Apr 03, 2013 at 06:21 PM
If your context allows you to treat this as a signal processing issue, you might look into
and
Thanks for the information. This looks very promising! I will take a closer look at it tonight and see how this might be implemented.
Your answer
Follow this Question
Related Questions
Android Acceleration Axis, not working with screen orientation? 0 Answers
Help with android shake intensity. 0 Answers
How to calibrate accelerometer according to start ? 1 Answer
screenCanDarken for Android (Backlight going dark) 1 Answer
Video player app button touch input working on android not on ios 0 Answers