GPS === **A GPS sensor that returns coordinates .** A GPS sensor which returns the position either in Blender or Geodetic coordinates. This sensor always provides perfect data on the levels "raw" and "extended". To obtain more realistic readings, it is recommended to add modifiers. - **Noise modifier**: Adds random Gaussian noise to the data coordinates in Blender: :math:`x` -> east and :math:`y` -> north The "heading" is Clockwise (mathematically negative). .. warning:: To work properly in "raw" and "extented" mode, you need to configure the following variables at the environment level: - **longitude** in degrees (double) of Blender origin - **latitude** in degrees (double) of Blender origin - **altitude** in m of the Blender origin - optionnaly **angle_against_north** in degrees is the angle between geographic north and the blender X axis. **angle_against_north** is positive when the blender X-axis is east of true north, and negative when it is to the west. Conversion of Geodetic coordinates into ECEF-r, LTP into ECEF-r and vice versa ------------------------------------------------------------------------------ Conversion of Geodetic coordinates into ECEF-r ++++++++++++++++++++++++++++++++++++++++++++++ To be able to simulate a GPS-sensor :math:`P` (the Blender origin) must be defined in the properties in Geodetic coordinates (longitude, latitude, altitude). For the transformation [Psas_] the coordinates must be in decimal degrees (no North, minutes, etc.). The result is a point :math:`x_0` in the ``ECEF-r`` coordinates. Conversion of ECEF-r into LTP[Psas_] ++++++++++++++++++++++++++++++++++++ For this conversion :math:`x_0` is the base. A point :math:`x_e` is given in the ``ECEF-r`` coordinates and the goal is to get :math:`x_t` (:math:`= x_e` in the ``LTP``-coordinates). .. image:: ../../../media/conversion_coordinates.png 1. Transform :math:`P` (Blender origin, geodetic coordinates (stored in the properties)) into :math:`x0` (geocentric (``ECEF-r``) coordinates) 2. Calculate :math:`R_{te}[1]` with longitude, latitude and altitude; matrix is the rotation part of the transformation 3. Transform :math:`x_e` into :math:`x_t` with :math:`x_t = R_{te} * (x_e-x_0)` Conversion of LTP into ECEF-r +++++++++++++++++++++++++++++ Known: :math:`P` in Geodetic coordinates (→ :math:`x_0` in ``ECEF-r``) and :math:`x_t` in ``LTP``-coordinates Goal: :math:`x_e` (:math:`= x_t` in ``ECEF-r`` coordinates) Based on the transformation described above the transformation is calculated with the transposed matrix :math:`R_{te}`: :math:`x_e = x_0 + (R_{te})' * x_t` [Psas_] Conversion of ECEF-r into Geodetic coordinates ++++++++++++++++++++++++++++++++++++++++++++++ The last transformation is from ``ECEF-r`` coordinates into Geodetic coordinates. This transformation is calculated with the Vermeille's method [FoIz_]. The result is the point :math:`x_e` in "GPS-coordinates" in radians. Sources +++++++ .. _FoIz: "3.4 Vermeille's Method(2002)" in "Comparative Analysis of the Performance of Iterative and Non-iterative Solutions to the Cartesian to Geodetic Coordinate Transformation", Hok Sum Fok and H. Bâki Iz, http://www.lsgi.polyu.edu.hk/staff/zl.li/Vol_5_2/09-baki-3.pdf .. _Psas: "Conversion of Geodetic coordinates to the Local Tangent Plane", Version 2.01, http://psas.pdx.edu/CoordinateSystem/Latitude_to_LocalTangent.pdf .. cssclass:: properties morse-section Configuration parameters for GPS -------------------------------- *No configurable parameter.* .. cssclass:: levels morse-section Available functional levels --------------------------- *Functional levels* are predefined *abstraction* or *realism* levels for the sensor. - ``simple`` (default level) simple GPS: only current position in Blender is exported At this level, the sensor exports these datafields at each simulation step: - ``x`` (float, initial value: ``0.0``): x coordinate of the sensor, in world coordinate, in meter - ``y`` (float, initial value: ``0.0``): y coordinate of the sensor, in world coordinate, in meter - ``z`` (float, initial value: ``0.0``): z coordinate of the sensor, in world coordinate, in meter *Interface support:* - :tag:`ros` as `sensor_msgs/NavSatFix `_ (:py:mod:`morse.middleware.ros.gps.NavSatFixPublisher`) - :tag:`pocolibs` as `POM_ME_POS `_ (:py:mod:`morse.middleware.pocolibs.sensors.pom.PomSensorPoster`) or as `POM_POS `_ (:py:mod:`morse.middleware.pocolibs.sensors.pom.PomPoster`) - :tag:`moos` as GPSNotifier (:py:mod:`morse.middleware.moos.gps.GPSNotifier`) - :tag:`yarp_json` as json encoded data in yarp::bottle (:py:mod:`morse.middleware.yarp.yarp_json.YarpJsonPublisher`) - :tag:`yarp` as yarp::Bottle (:py:mod:`morse.middleware.yarp_datastream.YarpPublisher`) - :tag:`socket` as straight JSON serialization (:py:mod:`morse.middleware.socket_datastream.SocketPublisher`) - :tag:`text` as key = value format with timestamp and index value (:py:mod:`morse.middleware.text_datastream.Publisher`) - ``raw`` raw GPS: position in Geodetic coordinates and velocity are exported At this level, the sensor exports these datafields at each simulation step: - ``longitude`` (double, initial value: ``0.0``): longitude in degree [-180°,180] or [0°,360°] - ``latitude`` (double, initial value: ``0.0``): latitude in degree [-90°,90°] - ``altitude`` (double, initial value: ``0.0``): altitude in m a.s.l. - ``velocity`` (vec3, initial value: ``[0.0, 0.0, 0.0]``): Instantaneous speed along East, North, Up in meter sec^-1 *Interface support:* - :tag:`yarp` as yarp::Bottle (:py:mod:`morse.middleware.yarp_datastream.YarpPublisher`) - :tag:`socket` as straight JSON serialization (:py:mod:`morse.middleware.socket_datastream.SocketPublisher`) - :tag:`text` as key = value format with timestamp and index value (:py:mod:`morse.middleware.text_datastream.Publisher`) - :tag:`yarp_json` as json encoded data in yarp::bottle (:py:mod:`morse.middleware.yarp.yarp_json.YarpJsonPublisher`) - ``extended`` extended GPS: adding information to fit a standard GPS-sentence At this level, the sensor exports these datafields at each simulation step: - ``longitude`` (double, initial value: ``0.0``): longitude in degree [-180°,180] or [0°,360°] - ``latitude`` (double, initial value: ``0.0``): latitude in degree [-90°,90°] - ``altitude`` (double, initial value: ``0.0``): altitude in m a.s.l. - ``velocity`` (vec3, initial value: ``[0.0, 0.0, 0.0]``): Instantaneous speed along East, North, Up in meter sec^-1 - ``date`` (DDMMYY, initial value: ``0``): current date in DDMMYY-format - ``time`` (HHMMSS, initial value: ``0``): current time in HHMMSS-format - ``heading`` (float, initial value: ``0``): heading in degrees [0°,360°] to geographic north *Interface support:* - :tag:`yarp` as yarp::Bottle (:py:mod:`morse.middleware.yarp_datastream.YarpPublisher`) - :tag:`socket` as straight JSON serialization (:py:mod:`morse.middleware.socket_datastream.SocketPublisher`) - :tag:`text` as key = value format with timestamp and index value (:py:mod:`morse.middleware.text_datastream.Publisher`) - :tag:`yarp_json` as json encoded data in yarp::bottle (:py:mod:`morse.middleware.yarp.yarp_json.YarpJsonPublisher`) .. cssclass:: services morse-section Services for GPS ---------------- - ``get_properties()`` (blocking) Returns the properties of a component. - Return value a dictionary of the current component's properties - ``get_local_data()`` (blocking) Returns the current data stored in the sensor. - Return value a dictionary of the current sensor's data - ``set_property(prop_name, prop_val)`` (blocking) Modify one property on a component - Parameters - ``prop_name``: the name of the property to modify (as shown the documentation) - ``prop_val``: the new value of the property. Note that there is no checking about the type of the value so be careful - Return value nothing - ``get_configurations()`` (blocking) Returns the configurations of a component (parsed from the properties). - Return value a dictionary of the current component's configurations .. cssclass:: examples morse-section Examples -------- The following examples show how to use this component in a *Builder* script: .. code-block:: python from morse.builder import * # adds a default robot (the MORSE mascott!) robot = Morsy() # creates a new instance of the sensor gps = GPS() # place your component at the correct location gps.translate(, , ) gps.rotate(, , ) # select a specific abstraction level (cf below), or skip it to use default level gps.level() robot.append(gps) # define one or several communication interface, like 'socket' gps.add_interface() env = Environment('empty') .. cssclass:: files morse-section Other sources of examples +++++++++++++++++++++++++ - `Source code <../../_modules/morse/sensors/gps.html>`_ - `Unit-test <../../_modules/base/gps_testing.html>`_ *(This page has been auto-generated from MORSE module morse.sensors.gps.)*