Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GPS coordinates are inversed (lat/long) when using Geodetic Modifier #764

Open
ejalaa12 opened this issue Apr 26, 2017 · 0 comments
Open

Comments

@ejalaa12
Copy link
Contributor

Problem

Minimal code to reproduce the problem:

#! /usr/bin/env morseexec

""" Basic MORSE simulation scene for <sim_tests> environment

Feel free to edit this template as you like!
"""

from morse.builder import *

robot = Morsy()
robot.translate(1.0, 0.0, 0.0)
robot.rotate(0.0, 0.0, 3.5)


# Add a keyboard controller to move the robot with arrow keys.
keyboard = Keyboard()
robot.append(keyboard)
keyboard.properties(ControlType='Position')
# Add the gps
gps = GPS()
gps.add_stream('ros')
gps.alter('geodetic')
robot.append(gps)

robot.add_default_interface('socket')
# set 'fastmode' to True to switch to wireframe mode
env = Environment('sandbox', fastmode=False)
env.set_camera_location([-18.0, -6.7, 10.8])
env.set_camera_rotation([1.09, 0, -1.14])
env.properties(latitude=1.53, longitude=45.1, altitude=0)

If you launch this simulation and monitor the topic /robot/gps, you will see that latitude, longitude are respectively 45.1 and 1.53, instead of (1.53 and 45.1 as defined in the script)

Solution proposition

Inverting x and y in the publisher, modifier or coordinates transforms

I'm not sure at which level this invertion appears. It might appear:

  1. In the publisher associated with the gps: NavSatFixPublisher, where longitude is defined as y instead of x.
  2. In the modifier geodetic.py, where lines 36/37 (or 45/46) should inversed.
  3. In the function ecef_to_geodetic in module helpers/coordinates.py

By using another level of abstraction of the GPS sensor

There is also another way to use geodetic coordinates with a GPS sensor (using abstraction levels):

gps = GPS()
gps.level('raw')

In this case, the local_data x,y,z of the sensor are not set. But: local_data['longitude'], local_data['latitude'], local_data['altitude'] are set instead.
However you cannot use the default ros publisher for gps which is: NavSatFixPublisher, for two reasons:

  1. This publisher uses data['x'] as the latitude and data['y'] as the longitude. (instead of data['latitude'] and data['longitude'])
  2. When using a different level of abstraction (here, to raw), the class of gps sensor becomes RawGPS, which doesn't have a publisher associated (see MORSE_DATASTREAM_DICT in data.py

One solution might be to create another ROSPublisher associated with RawGPS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant