A global location object. The latitude and longitude are relative to the `WGS84 coordinate system `_. The altitude is relative to mean sea-level (MSL). For example, a global location object with altitude 30 metres above sea level
| 96 | |
| 97 | |
| 98 | class LocationGlobal(object): |
| 99 | """ |
| 100 | A global location object. |
| 101 | |
| 102 | The latitude and longitude are relative to the `WGS84 coordinate system <http://en.wikipedia.org/wiki/World_Geodetic_System>`_. |
| 103 | The altitude is relative to mean sea-level (MSL). |
| 104 | |
| 105 | For example, a global location object with altitude 30 metres above sea level might be defined as: |
| 106 | |
| 107 | .. code:: python |
| 108 | |
| 109 | LocationGlobal(-34.364114, 149.166022, 30) |
| 110 | |
| 111 | .. todo:: FIXME: Location class - possibly add a vector3 representation. |
| 112 | |
| 113 | An object of this type is owned by :py:attr:`Vehicle.location`. See that class for information on |
| 114 | reading and observing location in the global frame. |
| 115 | |
| 116 | :param lat: Latitude. |
| 117 | :param lon: Longitude. |
| 118 | :param alt: Altitude in meters relative to mean sea-level (MSL). |
| 119 | """ |
| 120 | |
| 121 | def __init__(self, lat, lon, alt=None): |
| 122 | self.lat = lat |
| 123 | self.lon = lon |
| 124 | self.alt = alt |
| 125 | |
| 126 | # This is for backward compatibility. |
| 127 | self.local_frame = None |
| 128 | self.global_frame = None |
| 129 | |
| 130 | def __str__(self): |
| 131 | return "LocationGlobal:lat=%s,lon=%s,alt=%s" % (self.lat, self.lon, self.alt) |
| 132 | |
| 133 | |
| 134 | class LocationGlobalRelative(object): |
no outgoing calls