W3C home > Mailing lists > Public > whatwg@whatwg.org > September 2009

[whatwg] Orientation event in Firefox

From: Dave Burke <daveburke@google.com>
Date: Wed, 2 Sep 2009 22:26:15 +0100
Message-ID: <6e608abf0909021426jeb1ac79s3603c4d6575a6f61@mail.gmail.com>
On Mon, Aug 31, 2009 at 11:06 PM, Doug Turner <doug.turner at gmail.com> wrote:

> Thanks Dave for your comments.
> I was thinking about update frequency.  right now, it is up to the UA (we
> are using 50ms).
>

To give an explicit example, if you want to run a high pass (say to detect
only sudden movements), you might code a simple k-order FIR filter of the
form:

   y[n] = b0.x[n] + b1.x[n-1] + ... +  bk.x[n-k]

The coefficient values b0 ... bk are a function of the sampling rate
("update frequency") and hence needs to be settable or at least known to
allow code portability.


> units -- yes.  in g.  This is best.
>
> magnetometer -- but in a different API, right?  I do not see directly how
> you would combined the two.
>

It's a different API, but (can be) closely related. You can present
magnetometer information either as x, y, z of the magnetic field vector or
as the special case of compass orientation. For example, Android has the
same SensorEvent<http://developer.android.com/reference/android/hardware/SensorEvent.html>for
both Sensor.TYPE_ACCELEROMETER and Sensor.TYPE_MAGNETIC_FIELD. Lots of
interesting use-cases for compass ranging from map tile orientation,
navigation, augmented reality, etc.


> Also see: http://dougt.org/wordpress/2009/08/orientation-update/ for some
> demos.
>
> Doug
>
> On Aug 31, 2009, at 2:54 PM, Dave Burke wrote:
>
> +1, I like this approach for its simplicity and familiarity.
>
> As part of fleshing out, there are probably a few small but key additions
> that would greatly increase effectiveness:
>   - update frequency (knowing the sample rate is crucial for even the most
> trivial DSP operations such as filtering)
>   - units (convention is in units of 'g', i.e 9.81 m/s^2)
>   - magnetometer in addition to accelerometer (for heading)
>
> Dave
>
> On Mon, Aug 24, 2009 at 4:39 AM, Doug Turner <doug.turner at gmail.com>wrote:
>
>> I posted some thoughts and a strawman for orientation in Firefox:
>>
>> http://dougt.org/wordpress/2009/08/orientation/
>>
>> Regards,
>> Doug Turner
>>
>>
>>
>>
>>
>
>
> --
>
> Sent from Wandsworth, Greater London, United Kingdom
>
>
>


-- 

Sent from Zurich, Switzerland
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20090902/49369769/attachment.htm>
Received on Wednesday, 2 September 2009 14:26:15 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:52 UTC