Jilt - a library to read the sudden motion sensor on Apple Powerbooks and MacBooks using JavaApple added a wonderful feature to its recent laptops - an internal sensor that can measure the tilt and gravity. They do this in order to protect the data on the hard disk; in case you drop your laptop, the operating system can quickly shut down the hard disk before the computer crashes on the floor. Of course, such a sensor can do a lot more, and it would be a pity to use it only for computers that crash on the floor. So many people created nice little applications, like the carpenters scale widget, the rotating windows hack or the all-purpose Lilt software. Some time ago I hacked together a JNI library for Java in order to make it possible for our geometry software Cinderella to read the data from the sudden motion sensor. This enables us to have more realistic physics simulation - the gravity in the simulation corresponds to the real gravity! Unfortunately, the interface changed for the new MacBook Pro computers, and so we decided to remove this feature from the version of Cinderella released in June 2006. However, some weeks ago I stumbled across the Unimotion library and I gave it another try. The result is a JNI library for Java that should work on all Apple computers that have a sudden motion sensor. I could test it only on two models, however, so I'd love to get some feedback. Demo Videohttp://www.youtube.com/v/aM0PrEu-xO8 DownloadThe jilt library itself is available here, it is licensed unter LGPL, as is the unimotion library from where I copied most of the code.
DocumentationInclude the jar file into your classpath and the libjilt.jnilib in your native library path and call java -jar AMSReader.jaron the command line to retrieve the current data of the sensor. Bug reports etc.Please mail me if you have any suggestions, bug reports, feature requests or whatever. Further linksSeveral other people have done similar things, for example Daniel Shiffman. His approach uses the original unimotion library, which seems to make more sense. |