Gazebo | Ignition | Community
Ask Your Question

laughlin's profile - activity

2020-07-14 11:49:03 -0500 received badge  Taxonomist
2016-07-18 09:26:45 -0500 received badge  Famous Question (source)
2016-07-06 12:25:41 -0500 received badge  Notable Question (source)
2016-07-05 10:59:49 -0500 received badge  Student (source)
2016-07-05 10:58:38 -0500 received badge  Popular Question (source)
2016-07-04 14:59:41 -0500 received badge  Editor (source)
2016-07-04 14:58:51 -0500 asked a question Bug in SphericalCoordinates::SphericalFromLocal?

I was under the impression that gazebo assumed an East, North, Up (ENU) right-handed frame for the SphericalCoordinate class, but I think there's a bug in the conversion for lat-long.

Test code:

#include <gazebo/common/common.hh>

#include <ignition/math/Angle.hh>
#include <ignition/math/Vector3.hh>

int main(){

const ignition::math::Vector3d far_x(1000, 0, 0);
const ignition::math::Vector3d far_y(0,1000, 0);

const ignition::math::Angle lat(0), lon(0), hdg(0);
double ele = 0;

gazebo::math::Vector3 lat_long;

const gazebo::common::SphericalCoordinates::SurfaceType earth = (gazebo::common::SphericalCoordinates::SurfaceType)1;

gazebo::common::SphericalCoordinates sphericalCords(earth,lat,lon,ele,hdg);

//assuming ENU coordinates, pos x should be positive longitude
lat_long = sphericalCords.SphericalFromLocal(far_x);
std::cout << "Far x: [" << far_x << "] ---> [" << lat_long << "] \n";

//positive y should be positive latitude in ENU
lat_long = sphericalCords.SphericalFromLocal(far_y);
std::cout << "Far y: [" << far_y << "] ---> [" << lat_long << "] \n";

}

with results:

Far x: [1000 0 0] ---> [0 -0.008983 0.078393] 
Far y: [0 1000 0] ---> [-0.009044 0 0.078921]

The returned latitude and longitude should be positive if we're operating in an ENU coordinate system (assuming 0 deg heading offset, as is the case above).

Is this the intended behavior, or is this a bug?

I believe the offending negation is here.

2016-06-13 18:53:24 -0500 received badge  Famous Question (source)
2016-06-08 09:03:41 -0500 commented answer Native spherical (WGS84) coordinates?

Thank you.

2016-06-07 14:56:01 -0500 received badge  Notable Question (source)
2016-06-07 14:30:01 -0500 received badge  Supporter (source)
2016-06-07 14:29:59 -0500 received badge  Scholar (source)
2016-06-07 13:52:34 -0500 commented answer Native spherical (WGS84) coordinates?

Thanks @nkoenig. So if I understand correctly, underlying cord sys is still XYZ, but Spherical Coord. class implements proper WGS84<-->local XYZ (via intermediate ECEF frame), with local XYZ origin at the lat/long specified in world file (as defined here: http://sdformat.org/spec?ver=1.6&elem=world#world_spherical_coordinates). Local XYZ is in an ENU orientation. Does this sound correct?

2016-06-07 11:45:57 -0500 received badge  Popular Question (source)
2016-06-07 09:48:06 -0500 asked a question Native spherical (WGS84) coordinates?

Hello all,

I'm looking to build a simulation where I can accurately bookkeep my robots position in geodetic coordinates (WGS84 datum).

Unfortunately the ROS+Gazebo+Hector GPS plugin route isn't likely to work, exactly because I'm trying to simulate vehicles at high latitude (near the poles), and traveling large distances O(10 km).

Is it possible for Gazebo to run a simulation natively in spherical coordinates? I haven't been able to find any resources to date on this.

If not, have any others found themselves in a similar situation? Outside of writing a dynamical model in MATLAB or similar, have others found an acceptable solution?