I already showed the use of device orientation in a fun game called Box of Marbles. Based on my experience trying out this API implementation, often it is easy to get confused by device motion vs device orientation. Thus, I created two web-based applications (using on Sencha Touch): Device Motion and Device Orientation. Each basically just visualizes the values of the data in a bunch of sliders:
You can find the code in the usual X2 repository, under the subdirectory javascript/devicemotion and javascript/deviceorientation, respectively. Obviously, the rest of Sencha Touch library is needed before you can deploy and run the examples. For the lazy, just run the live demo for Device Motion and Device Orientation (they support offline mode).
While right now only iOS 4.2 on iPhone/iPad/iPod Touch implements this API, I have a strong hope that Android (post Gingerbread) and Nokia (thanks to QtWebKit and Qt Mobility) will support this cool API in the near future. Well, at least I do plan to revive my Symbian setup to custom compile QtWebKit and test it on Nokia N8.
Side note: from my limited understanding, seems that both accelerometer and gyroscope are needed in order to supply the accurate data, much like in an inertial navigation system ("Inertial Phone", anyone?).
3 comments:
Are you able to develop for your N8 via linux, and load apps onto it, or do you have to use window for the Ovi Suite app?
"Side note: from my limited understanding, seems that both accelerometer and gyroscope are needed in order to supply the accurate data, much like in an inertial navigation system ("Inertial Phone", anyone?)."
You need both gyros and accelerometers if you intend to keep track of device position at any time, as the accelorometers cannot tell which force is gravity and which are inertial forces deriving from movement. So you need to integrate the output of Gyros to keep track of position.
Problem is that MEM gyros have big bias in measurement, so the position tends to diverge, so you need to mix the information of gyros with accelerometers with a low-pass filter to prevent this, and this introduces lags and puntual differences with reality.
This is, of course, if you want to keep track of position during dynamic manouvers (like in an inertial navigation system)
If you only want to know the orientation of the device while hold it still... you only need the accelerometer.
Don't ask how i know about this or i might have to kill you. :)
@Saem: Windows is the bless platform. But see also http://labs.qt.nokia.com/2010/12/17/experimental-packages-for-symbian-development-on-linux
Post a Comment