Well I figured out the math for my app. The iPhone accelerometer provides the acceleration along the x-, y- and z-axis. If the iPhone is laying flat, the x- and y- values are 0, and the z- value is 1 (because gravity is pushing down with a force of 1). If the iPhone is static but tilted in various directions, the accelerometer returns the appropriate x- y- and z- co-ordinates. I use the following formula to figure out the angle of the iPhone's plane relative to a world frame:
radians = atanf(z/sqrtf(pow(x, 2) + pow(y, 2)))
The next step is applying a low-pass filter to the readings, there's a lot of noise that I need to average out.
Yesterday MC and Robin dropped by before dinner, they were out taking Corben (their 4-week-old) for a short walk. They looked really rested for new parents. Corben is very cute, with a full head of hair. We chatted for a few minutes, it was good to see them.
No comments:
Post a Comment