1
$\begingroup$

I'm getting some accelerometer readings from an Android phone, but it comes in on the phone's coordinate system. I want to apply a transformation to put the acceleration in the world coordinate system (e.g. so Y will always be up and down, regardless of how the phone is rotated)

Android allows you to get the accelerometer values. It can also calculate a rotation matrix (using a gyroscope and a magnetic sensor), so all I need to do is multiple the acceleration vector through by this matrix and I have transformed values. I followed the steps here: https://stackoverflow.com/questions/14963190/calculate-acceleration-in-reference-to-true-north

However, there are 3 sensors at play here: acceleration, gyro, magnetic. The way android operates is event based, so whenever it detects a change in any of these sensors, it will give you back a value.

Given these are 3 different sensors, the events for each one is very likely to come in at different times, and you may get more readings from one sensor than another within some time period

My question is, does varying amounts of spacing between readings for the 3 different sensors matter for doing coordinate system transformations? And if so, what is the best solution for doing this type of transformation with event based sensors?

$\endgroup$
1
$\begingroup$

It will call your function each time any motion event gets fired. This can affect the timing of css animations responding to sensor input. Try getting the orientation values and updating your transformations from within an interval.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.