Example 3: GPS Location Based

Location based contents are a common use case for AR-applications. Junaio, for example, is a fully featured AR-browser that is build on top of the MobileSDK.

Contents


LLA Coordinates

What is LLA?

LLA stands for latitude, longitude and altitude and is a format for defining geo positions on the globe. While the altitude is measured in meters above sea-level, the latitude and the longitude are measured in degrees. There are a couple of different approaches how those angles are calculated which all have to deal with the problem that the earth is not a perfect ellipsoid. But that would be required to make a coordinate a perfect match on the earths surface. So every geodatic system is only an approximation to the real world.

The World Geodatic System 84

In the MobileSDK we use the widly known Word Geodetic System 84, or more commonly known as WGS84. The WGS84 zero longitude is near the Greenwich Prime Meridian. The latitude is based at the equator.

For further readings about geograpic coordinate systems we recommend Wikipedia.

Using LLA coordinates in the MobileSDK

The MobileSDK provides the ability to read the geo position from the device using the !UnifeyeSensorsManager. You can get the current position and the orientation of the device.

Important note on the altitude: The altitude is ignored by the MobileSDK. To move a model or a billboard in its altitude please use setMoveTranslation() to modify its z-value instead. To e.g. move the MetaioMan a bit down you could do the following:

mMetaioMan.setMoveTranslation( new Vector3d( 0, 0, -100) , true );

The second, boolean parameter which is true in the upper case tells the SDK to append this translation to the general translation in the world.

Geo referenced content

There are two kinds of geo referenced content possible:

  • Billboards: Billboards are floating images which are always facing the viewer. Billboards can be used as 'signs' indicating e.g. a point of intereset (POI). Optionally, they can be arranged in groups, so called BillboardGroups. A billboard group takes care of proper, non-overlaying display of billboards that are close to each other.

  • Models: 3D geometry which is rendered just like any other model.

Implementation LocationBasedActivity

In the simple package of the example application you will find a class named LocationBasedActivity. Similar to the other examples in that package that class inherits from ARViewActivity. It provides additional functionality for location based handling.

Getting the GPS and compass data from the device

There is a interface to recieve callbacks from the UnifeyeSensorsManager. The following interface definition can be found inside of the manager class.

  
 /**
   * Callback interface, any class which requires to update based on sensor values
   * can implement this interface and receive new sensor readings when the sensors are updated,
   * the class which implements this interface must register itself with the UnifeyeSensorsManager
   * 
   */
   public static interface Callback 
   {
      /**
      * Called when accelerometer sensor provide new reading at regular interval
      * 
      * @param vector Vector containing x,y,z angles
      */
      public void onAccelerometerSensorChanged(Vector3d vector);
      
      
      /**
      * Called when orientation sensor provide new reading at regular interval
      * 
      * @param orientation Vector containing orientation reading, x=azimuth, y=pitch, z=roll
      */
      public void onOrientationSensorChanged(Vector3d orientation);
      
      /**
      * Called when GPS provide new reading
      * 
      * @param location New location provided by the GPS
      */
      public void onLocationSensorChanged(LLACoordinate location);

   }

You can either implement this interface in your Activity or you can create a nested class that implements that. In any case you also need to link your class with the UnifeyeSensorsManager. You can do that by calling the registerCallback() method of it.

So for example a definition could look like this:

public <YourClassNameHere> implements UnifeyeSensorsManger.Callback 
{
}

-- SupportMetaio - 2011-12-02

Topic attachments
I Attachment Action Size Date Who Comment
jpgjpg location_based.jpg manage 31.4 K 2011-12-05 - 09:21 SupportMetaio  
Topic revision: r6 - 2011-12-08 - 10:50:17 - SupportMetaio
 
This site is powered by the TWiki collaboration platformCopyright &© by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback