W3C home > Mailing lists > Public > public-geolocation@w3.org > April 2011

Re: separating compass heading from orientation?

From: Dean Jackson <dino@apple.com>
Date: Thu, 28 Apr 2011 04:21:17 +1000
Message-id: <C2B7E4CC-DBBA-4227-972F-8E3FE45F3D10@apple.com>
To: public-geolocation@w3.org
I didn't see any comments on this. FWIW, I've been playing with an experimental implementation of it and have found it to be much more useful than the combined data (which, as I say, is noisy and makes existing content worse).

Dean

On 22/02/2011, at 12:47 PM, Dean Jackson wrote:

> Hi,
> 
> Apologies in advance - this is another fairly large change request :(
> 
> I've been looking at incorporating the compass heading into the DeviceOrientation data, as the specification says they should be. If you don't know, iOS 4.2 added support for DeviceOrientation but the data are not real-world accurate - it is from a frame of reference which the developer must keep track of. In other words, the alpha value is not your compass heading.
> 
> Luckily, we added the 'absolute' property to the event to indicate this situation, so if the feature were to be implemented the developer could notice the change.
> 
> However, I think that we should NOT require the alpha to be a compass heading, and separate heading out either completely or into new properties on the event.
> 
> The problem is that compasses are prone to being inaccurate. Especially compared to modern gyroscope hardware. Consider the following scenario: I'm playing a game where I control the player by turning my device. I don't care about my real-world heading - I'm using orientation just for control. All of a sudden, the compass decides that my heading has changed (a source of interference has been removed). What should the system do? If it changes the DeviceOrientation events, the player might jump off a cliff even though I didn't move. But it can't ignore the change in heading.
> 
> If you have a gyroscope, then it might be possible to detect that you haven't actually moved. But that has other issues - you can't always tell whether the new or old compass heading is the most accurate. In fact, they might be equally inaccurate.
> 
> Then there is the issue that compasses have a slight lag. This would also be very annoying in games that don't care about heading. I don't see much downside in separating the compass from the orientation. Developers can still use the compass to make augmented reality or navigation apps, and can also use the gravity to get more accurate orientation.
> 
> In summary, conforming to the specification would make some of the Web apps that are using DeviceOrientation worse.
> 
> My proposal would be to add the following to DeviceOrientationEvent:
> 
> readonly attribute double? compassHeading; // heading in degrees from magnetic north
> readonly attribute double? compassAccuracy; // degrees
> readonly attribute boolean? compassCalibrated; // as it is already specified
> 
> There's also this specification, but I can't tell if it has been abandoned:
> 
> http://dev.w3.org/2009/dap/system-info/compass.html
> 
> (I don't like the callbackishness of that spec compared to the event approach in device orientation, but I can see its use in non-DOM contexts)
> 
> Dean
> 
> 
Received on Wednesday, 27 April 2011 18:21:47 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 22 March 2012 18:13:55 GMT