GoogleMaps-like compass - Orientation sensor

Hi,

This is my first post at the forum. So, first of all, I'd like to greet everyone and thank the developers for this wonderful tool.

I am trying to get a googleMaps/googleSky-like compass that indicates the device orientation respect to the North independently of the device's tilt. The "azimut" property of the orientation sensor alone is not enough as it depends on the device's tilt as shown in the figure:

O

In this figure, assume the North is just in front of the observer. If the device is tilted towards it the azimut value is ok, but if it is tilted towards the observer the value changes as if the device were pointing south. It looks like "azumut" is the angle toward which the top edge of the device points to.

Note that that is not the behaviour of the compass in google maps, etc. In both these two situations the compass would point North.

I tried to figure out how to recalculate that with the other parameters provided by the orientation sensor, but I could not figure out how. The "tilt" property is not enough as it apparently does not distinguish screen-down vs. screen-up, but just report the angle. I am not very good at spherical trigonometry and all that, I know :wink:

If you can help with that it would be really appreciate.

Thanks in advance!

Welcome.

Here a the tools you probably need

The built in Map component (that uses Open Street Map tiles) instead of Google Map tiles has a built-in compass that displays on the Map screen if you turn on the capability. Map ShowCompass specifies whether to provide a compass overlay on the Map. The compass will be rotated based on the device’s orientation if a digital compass is present in hardware.

Here are some resources to help you learn to use the AI2 tools. A very good way to learn App Inventor is to read the free Inventor's Manual here in the AI2 free online eBook http://www.appinventor.org/book2 ... the links are at the bottom of the Web page. The book 'teaches' users how to program with AI2 blocks.

There is a free programming course here http://www.appinventor.org/content/CourseInABox/Intro and the aia files for the projects in the book are here: http://www.appinventor.org/bookFiles

How to do a lot of basic things with App Inventor are described here: http://www.appinventor.org/content/howDoYou/eventHandling .

Also look here http://kio4.com/appinventor/index.htm and here http://www.imagnity.com/tutorial-index/ for more tutorials.

Learn about components http://ai2.appinventor.mit.edu/reference/components/
and visit the Library http://appinventor.mit.edu/explore/library Help>Library on the MENU