Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
New Contributor
marshallm
Posts: 8
Registered: ‎05-10-2011
My Device: PlayBook
My Carrier: Orange
Accepted Solution

Digital Compass or Gyroscope

I'm testing location services on my PlayBook, and whilst GPS semi seems to function I cannot see any API references to utilising the digital compass or gyroscope which is apparently in the hardware?

 

Any help is appreciated - I understand that the PlayBook is still a work in progress (as can be seen quite easily)! 

 

Matt

Please use plain text.
Developer
MauriceRice
Posts: 425
Registered: ‎03-17-2011
My Device: Developer
My Carrier: Telus

Re: Digital Compass or Gyroscope

You can't find the interfaces because AS3 does not currently support the compass or gyroscope. We'll have to wait until RIM provides the necessary hooks via the native SDK. Or perhaps air sdk 2.6 will have therequired  support.

 

In any event, the ball is in RIM's court and we mere developers will have to be patient. But, I agreee with you that GPS is a very poor substitute for a real magnetic compass. If RIM wants us to generate apps with real WOW facter, then they need to support the remaining sensors on the double.

_________________________
In the dark and need a sky map?
Discover What's up at App World.
Follow What's up on Facebook

Please use plain text.
New Contributor
marshallm
Posts: 8
Registered: ‎05-10-2011
My Device: PlayBook
My Carrier: Orange

Re: Digital Compass or Gyroscope

Ah I did suspect that, I know they have a team working around the clock on this device and have been for a long-time now, it's a shame their software teams let them down slightly (or management I should specify).

 

However a lot of progress has been made over the past month or two, so hopefully that will continue!

 

Thanks

Please use plain text.
New Contributor
PicaxeEffect
Posts: 9
Registered: ‎05-09-2011
My Device: PlayBook
My Carrier: ATT

Re: Digital Compass or Gyroscope

The 3-axis gyroscope and the 3-axis accelerometer are combined to make a 6-axis motion sensor. You can access the motion sensor with flash.sensors.Accelerometer. The PlayBook has a 3-Axis Digital Compass but I can't find out how access it now. Peter 9477 commented  "As for the compass, there is no Flash API that will let us access it yet, so until they provide that, or release the native SDK, you're out of luck."

Please use plain text.
New Contributor
marshallm
Posts: 8
Registered: ‎05-10-2011
My Device: PlayBook
My Carrier: Orange

Re: Digital Compass or Gyroscope

However with the Accelerometer class there are no methods to retreive the current alignment from the gyroscope, only the standard acceleration when moving the device, not stationary. Please do correct me If I am wrong!

Please use plain text.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Digital Compass or Gyroscope

@marshallm, you are correct. For now we have only basic GPS and accelerometer (3-axis) through the standard Flash APIs in flash.sensors. Nothing else has been discussed yet, other than RIM noting the existence of those sensors. For all we know, they will never get around to providing Flash support for them (though we assume when the native SDK comes out it will be possible to just do it ourselves, if they haven't managed to get to it yet).

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Please use plain text.
New Contributor
PicaxeEffect
Posts: 9
Registered: ‎05-09-2011
My Device: PlayBook
My Carrier: ATT

Re: Digital Compass or Gyroscope

[ Edited ]

No but the data from a gyroscope isn't very useful. The data from a gyroscope will drift over time. A gyroscope is used to smooth out the accelerometer errors. By averaging data that comes from the accelerometer and the gyroscope you can obtain a relatively better estimate of the current device inclination.

 

EDIT: Note flash.sensors.Accelerometer is a little misleading. You're not getting the data from the accelerometer, you're getting the average data from both the accelerometer and the gyroscope.

Please use plain text.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Digital Compass or Gyroscope

@PicaxeEffect, can you provide a reference for that information? I've never seen any mention of that API combining the two sensors, nor in fact any information at all about the gyroscope in the PlayBook, other than its existence.

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Please use plain text.
Developer
XoomMan
Posts: 128
Registered: ‎03-18-2011
My Device: PlayBook
My Carrier: verizon

Re: Digital Compass or Gyroscope


PicaxeEffect wrote:

No but the data from a gyroscope isn't very useful. The data from a gyroscope will drift over time. A gyroscope is used to smooth out the accelerometer errors. By averaging data that comes from the accelerometer and the gyroscope you can obtain a relatively better estimate of the current device inclination.

 

EDIT: Note flash.sensors.Accelerometer is a little misleading. You're not getting the data from the accelerometer, you're getting the average data from both the accelerometer and the gyroscope.


I don't think that's true. I can't see how you can get the rotation around the z-axis (azimuth) with just a accelerometer and a 6-axis sensor needs rotations around the 3 axis too. flash.sensors.Accelerometer doesn't give you rotations. I apologize if you can show me wrong.

 

Please use plain text.
Developer
brentcameron
Posts: 110
Registered: ‎10-31-2010
My Device: Blackberry Torch 9800
My Carrier: Bell Mobility

Re: Digital Compass or Gyroscope

flash.events.AccelerometerEvent. provides rotation around all three axis's...  Rotation around the X axis is pitch (measured by changes in AccelerationX). Rotation around the Y axis is roll (measured by changes in AccelerationY) and rotation around the Z axis is yaw (measured by changes in AccelerationZ).   No API's yet for the gyroscope (which would be useful in order to bring the rotations back to a zero point).  

Best regards,

Brent

If you found my post helpful, please thank me with a Kudo. Thanks!
Please use plain text.