uuv_simulator
uuv_simulator copied to clipboard
Negative GPS coordinate
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.
I have the same remark.
Is there a reason for the negative signs?
@musamarcusso Can you help with this answer ?
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.
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.