I am going to develop Android application which needs to read x,y,z coordinates of phone on 3D space.
I would like to write a simple code and test on the device..
I am using ginger bread on both the device and emulator.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
To get position from acceleration you need to integrate it twice.
Integrating acceleration gives you velocity and integrating the velocity gives you the position.
Keep in mind that integrating noise creates drift and integrating drift creates A LOT of drift, the android sensors tend to generate quite a lot of noise.
On my Galaxy S3 I have been able to get the drift in position down to 0.02 m in 5 seconds using Google’s Linear Accelerometer composite sensor.
I am not sure if you can use the linear accelerometer sensor on gingerbread. If you can’t you will have to remove the gravity before integrating.
If you haven’t already, read everything here
http://developer.android.com/guide/topics/sensors/sensors_motion.html
A great talk about the motion sensors in android
http://www.youtube.com/watch?v=C7JQ7Rpwn2k
Code:
Now you have the position in 3d space, keep in mind it assumes that the phone is stationary when it starts sampling.
If you don’t remove gravity it will soon be very far away.
This doesn’t filter the data at all and will generate a lot of drift.