Ask Your Question

how to calculate distance between two GPS?!

asked 2021-09-30 06:07:40 -0600

Delbina gravatar image

Hi everyone, I am using 2 instances of robot_localization pkg, and Rtabmap SLAM as map provider. it is said that the output of navsat_transform node will transform geographic coordinates (latitude and longitude) into the robot’ world frame. Now I want to know, how can I calculate the distance between two GPS coordinates? as I checked odometry/gps again provides lat and values! Will any topic provide this to me?


edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2021-10-01 12:58:29 -0600

I am not sure I understand how you want to get this difference from a topic. But to calculate the distance between 2 GPS points you could use a Python package like geopy

As shown in the repo, a simple example:

from geopy.distance import geodesic
newport_ri = (41.49008, -71.312796)
cleveland_oh = (41.499498, -81.695391)
print(geodesic(newport_ri, cleveland_oh).miles)
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2021-09-30 06:07:40 -0600

Seen: 26 times

Last updated: Oct 01 '21