ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

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?

Thanks

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

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

osilva gravatar image

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)
538.390445368
edit flag offensive delete link more

Question Tools

2 followers

Stats

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

Seen: 358 times

Last updated: Oct 01 '21