'The vehicle location in global, global relative and local frames (:py:class:`Locations`).
The different frames are accessed through its members:
* :py:attr:`global_frame <dronekit.Locations.global_frame>` (:py:class:`LocationGlobal`)
* :py:attr:`global_relative_frame <dronekit.Locations.global_relative_frame>` (:py:class:`LocationGlobalRelative`)
* :py:attr:`local_frame <dronekit.Locations.local_frame>` (:py:class:`LocationLocal`)
For example, to print the location in each frame for a ``vehicle``:
.. code-block:: python
# Print location information for `vehicle` in all frames (default printer)
print "Global Location: %s" % vehicle.location.global_frame
print "Global Location (relative altitude): %s" % vehicle.location.global_relative_frame
print "Local Location: %s" % vehicle.location.local_frame    #NED
# Print altitudes in the different frames (see class definitions for other available information)
print "Altitude (global frame): %s" % vehicle.location.global_frame.alt
print "Altitude (global relative frame): %s" % vehicle.location.global_relative_frame.alt
print "Altitude (NED frame): %s" % vehicle.location.local_frame.down
.. note::
All the location "values" (e.g. ``global_frame.lat``) are initially
created with value ``None``. The ``global_frame``, ``global_relative_frame``
latitude and longitude values are populated shortly after initialisation but
``global_frame.alt`` may take a few seconds longer to be updated.
The ``local_frame`` does not populate until the vehicle is armed.
The attribute and its members are observable. To watch for changes in all frames using a listener
created using a decorator (you can also define a listener and explicitly add it).
.. code-block:: python
@vehicle.on_attribute(\'location\')
def listener(self, attr_name, value):
# `self`: :py:class:`Vehicle` object that has been updated.
# `attr_name`: name of the observed attribute - \'location\'
# `value` is the updated attribute value (a :py:class:`Locations`). This can be queried for the frame information
print " Global: %s" % value.global_frame
print " GlobalRelative: %s" % value.global_relative_frame
print " Local: %s" % value.local_frame
To watch for changes in just one attribute (in this case ``global_frame``):
.. code-block:: python
@vehicle.on_attribute(\'location.global_frame\')
def listener(self, attr_name, value):
# `self`: :py:class:`Locations` object that has been updated.
# `attr_name`: name of the observed attribute - \'global_frame\'
# `value` is the updated attribute value.
print " Global: %s" % value
#Or watch using decorator: ``@vehicle.location.on_attribute(\'global_frame\')``.'

@property
def location(self):

    return self._location
