uuv_simulator icon indicating copy to clipboard operation
uuv_simulator copied to clipboard

Negative GPS coordinate

Open s1887252 opened this issue 4 years ago • 5 comments

While modifying the UUV sensor plugins for a project, I have found this:

// Copy the output of Gazebo's GPS sensor into a NavSatFix message this->gpsMessage.latitude = -this->gazeboGPSSensor->Latitude().Degree(); this->gpsMessage.longitude = -this->gazeboGPSSensor->Longitude().Degree();

what is the reason for making negative the latitude and longitude?

Thank you for your availability.

s1887252 avatar Mar 26 '20 15:03 s1887252

I have the same remark.

nicolaje avatar Mar 31 '20 16:03 nicolaje

Is there a reason for the negative signs?

MohitGupta007 avatar May 12 '20 20:05 MohitGupta007

@musamarcusso Can you help with this answer ?

pxalcantara avatar May 17 '20 18:05 pxalcantara

This was an issue raised by another user (I don't recall the issue number but I will look for it) where Gazebo's GPS sensor (for which the sensor here is a ROS wrapper) was delivering the readings with the axes flipped. I will check it again.

musamarcusso avatar May 23 '20 19:05 musamarcusso

I think the issue that @musamarcusso was pointing out is that Gazebo (as of Gazebo 11) output lat lon in (-E) -(N) U instead of the expected ENU...

This is due to a bug in Gazebo with the spherical coordinates (see gazebo issue 2022 ) and how some internal function is malfunctioning (see ign-math issue 235 )

The quick fix to get everything back to normal (ENU normal) consists as explained here to add the following to the world definition :

  <spherical_coordinates>
        <!-- currently gazebo has a bug: instead of outputing lat, long, altitude in ENU
        (x = East, y = North and z = Up) as the default configurations, it's outputting (-E)(-N)U,
        therefore we rotate the default frame 180 so that it would go back to ENU -->
        <heading_deg>180</heading_deg>
    </spherical_coordinates>

This combined with the removal of the negative latitude and longitude in the uuv simulator GPS ROS wrapper fixed the issue for me.

ViVittori avatar Oct 27 '21 09:10 ViVittori