dhiltonp / hexbright

The easiest way to start programming your hexbright.
BSD 2-Clause "Simplified" License
124 stars 114 forks source link

Accelerometer functions #47

Closed joshgoebel closed 10 years ago

joshgoebel commented 10 years ago

Trying to understand some of this accelerometer stuff in a possible attempt to see if there is any room for improvement. What is the purpose of find_down? All it seems to do is average the last 4 settings... is that just because the accelerometer isn't consider precise and the down vector should be used to filter out noise? Real "down" seems to always be -100 in the 2nd axis... am I missing something?

dhiltonp commented 10 years ago

find_down tries to point to the center of the earth relative to the light.

As it is an average, it isn't very accurate when the light is undergoing significant acceleration over time (less common than you might expect, but common enough). In the case of consistent rotation, it will lag behind the 'true' down.

programs/spin_level exploits the fact that under large acceleration the actual down cannot be determined; when rapidly rotating the light as in its video (http://www.youtube.com/watch?v=SV6-1KUU9g8), from the perspective of the light, the earth seems to be spinning wildly around the light.