**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: x -> east and 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:

longitudein degrees (double) of Blender originlatitudein degrees (double) of Blender originaltitudein m of the Blender origin- optionnaly
angle_against_northin degrees is the angle between geographic north and the blender X axis.angle_against_northis positive when the blender X-axis is east of true north, and negative when it is to the west.

To be able to simulate a GPS-sensor 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 x_0 in the `ECEF-r` coordinates.

For this conversion x_0 is the base. A point x_e is given
in the `ECEF-r` coordinates and the goal is to get x_t (=
x_e in the `LTP`-coordinates).

1. Transform P (Blender origin, geodetic coordinates
(stored in the properties)) into x0 (geocentric (`ECEF-r`)
coordinates)

2. Calculate R_{te}[1] with longitude, latitude and altitude; matrix is the rotation part of the transformation

- Transform x_e into x_t with x_t = R_{te} * (x_e-x_0)

Known: P in Geodetic coordinates (→ x_0 in `ECEF-r`) and
x_t in `LTP`-coordinates

Goal: x_e (= x_t in `ECEF-r` coordinates)

Based on the transformation described above the transformation is calculated with the transposed matrix R_{te}: x_e = x_0 + (R_{te})' * x_t [Psas]

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 x_e in “GPS-coordinates” in
radians.

“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

“Conversion of Geodetic coordinates to the Local Tangent Plane”, Version 2.01, http://psas.pdx.edu/CoordinateSystem/Latitude_to_LocalTangent.pdf

*No configurable parameter.*

*Functional levels* are predefined *abstraction* or *realism* levels for the sensor.

`simple`(default level) simple GPS: only current position in Blender is exportedAt 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:*`yarp_json`as json encoded data in yarp::bottle (`morse.middleware.yarp.yarp_json.YarpJsonPublisher`)`moos`as db entries (`morse.middleware.moos.gps.GPSNotifier`)`ros`as sensor_msgs/NavSatFix (`morse.middleware.ros.gps.NavSatFixPublisher`)`yarp`as yarp::Bottle (`morse.middleware.yarp_datastream.YarpPublisher`)`pocolibs`as POM_ME_POS (`morse.middleware.pocolibs.sensors.pom.PomSensorPoster`) or as POM_POS (`morse.middleware.pocolibs.sensors.pom.PomPoster`)`text`as key = value format with timestamp and index value (`morse.middleware.text_datastream.Publisher`)`socket`as straight JSON serialization (`morse.middleware.socket_datastream.SocketPublisher`)

`raw`raw GPS: position in Geodetic coordinates and velocity are exportedAt 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<float>, initial value:`[0.0, 0.0, 0.0]`): Instantaneous speed along East, North, Up in meter sec^-1

*Interface support:*`yarp_json`as json encoded data in yarp::bottle (`morse.middleware.yarp.yarp_json.YarpJsonPublisher`)`socket`as straight JSON serialization (`morse.middleware.socket_datastream.SocketPublisher`)`yarp`as yarp::Bottle (`morse.middleware.yarp_datastream.YarpPublisher`)`text`as key = value format with timestamp and index value (`morse.middleware.text_datastream.Publisher`)

`extended`extended GPS: adding information to fit a standard GPS-sentenceAt 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<float>, 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:*`yarp_json`as json encoded data in yarp::bottle (`morse.middleware.yarp.yarp_json.YarpJsonPublisher`)`socket`as straight JSON serialization (`morse.middleware.socket_datastream.SocketPublisher`)`yarp`as yarp::Bottle (`morse.middleware.yarp_datastream.YarpPublisher`)`text`as key = value format with timestamp and index value (`morse.middleware.text_datastream.Publisher`)

`get_configurations()`(blocking)Returns the configurations of a component (parsed from the properties).

Return value

a dictionary of the current component’s configurations

`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

The following examples show how to use this component in a *Builder* script:

```
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(<x>, <y>, <z>)
gps.rotate(<rx>, <ry>, <rz>)
# select a specific abstraction level (cf below), or skip it to use default level
gps.level(<level>)
robot.append(gps)
# define one or several communication interface, like 'socket'
gps.add_interface(<interface>)
env = Environment('empty')
```

*(This page has been auto-generated from MORSE module morse.sensors.gps.)*