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

DEM origin overrides spherical coordinate flags defined in .world #2884

Open
Jaeyoung-Lim opened this issue Nov 20, 2020 · 3 comments
Open

Comments

@Jaeyoung-Lim
Copy link

Jaeyoung-Lim commented Nov 20, 2020

Problem Description
When using DEM models that have the global origin in the meta data, it is not possible to override the world location using the spherical_coordinates tag in the sdf file(world).

Even if the spherical_coordinates are modified, the world->SphericalCoords() returns the origin of the DEM file, not the origin defined with the spherical_coordinates flag.

It seems like gazebo overrides the spherical coordinate defined in the world file and uses the origin of the DEM if I understand correctly the following.

https://github.com/osrf/gazebo/blob/063d7386ed5499c2883de48e19ff5fb9dec01dff/gazebo/physics/HeightmapShape.cc#L109-L131

    // Modify the reference geotedic latitude/longitude.
    // A GPS sensor will use the real georeferenced coordinates of the terrain.
    common::SphericalCoordinatesPtr sphericalCoordinates;
    sphericalCoordinates = this->world->SphericalCoords();

    if (sphericalCoordinates)
    {
      ignition::math::Angle latitude, longitude;
      double elevation;

      this->dem.GetGeoReferenceOrigin(latitude, longitude);
      elevation = this->dem.GetElevation(0.0, 0.0);

      sphericalCoordinates->SetLatitudeReference(latitude);
      sphericalCoordinates->SetLongitudeReference(longitude);
      sphericalCoordinates->SetElevationReference(elevation);
      sphericalCoordinates.reset();
    }
    else
      gzerr << "Unable to get a valid SphericalCoordinates pointer\n";

    return 0;
  }

Expected behavior

  • world->SphericalCoords() returns the origin of the DEM file if there are no spherical_coordinates defined in the world file
  • world->SphericalCoords() returns the location defined in spherical_coordinates if defined in world file

@ahcorde FYI

Additional Context

@Jaeyoung-Lim
Copy link
Author

@chapulina @ahcorde @tfoote Would any one know how to move forward regarding this issue?

@Vicidel
Copy link

Vicidel commented Jul 18, 2023

Hello all. I know this issue is quite old, but the bug seems to be still happening. See for example this issue in PX4 forum.
Pinging recent contributors @chapulina @scpeters @iche033, anything you can do would help me.

@tfoote
Copy link
Contributor

tfoote commented Aug 9, 2023

The best way to push this forward would be to open a PR with the expected behavior.

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

3 participants