Ask Your Question
0

How to calculate distance between two GPS values?

asked 2017-05-28 04:23:16 -0500

rsmitha gravatar image

Hi,

I am using the jackal in simulation. I have C++ code which has a subscriber to the "navsat/fix" topic. My program has the jackal travelling to a distance of 10m in the "x direction" before it stops. I am trying to collect data from different sensors one of them being the gps. I have latitude, longitude and altitude values. How do I use the values to calculate the distance travelled between two points?

the first value is : lat = 49.9; long = 8.9; alt = 0.0634842; The value at the end of 10m is: lat = 49.9001; long = 8.9; alt = 0.0634803;

Please help.

Regards, rsmitha.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-05-28 19:58:33 -0500

ufr3c_tjc gravatar image

Have a look at the robot_localization package, and its documentation here. It sounds like you could be trying to perform the job that it does already. It includes a node called navsat_transform_node which performs accurate GPS -> map conversions, to fuse with imu and odometry data to position your robot more accurately.

If you don't want to use the node itself, have a look at the navsat_conversions.h file in its include directory. This provides a lat/long -> UTM conversion. UTM is measured in meters, so you can easily find the positions in the UTM grid and use this to get your distance travelled in meters.

edit flag offensive delete link more

Comments

Thanks for the help and the documentation, @ufr3c_tjc. If the navsat_transform_node is already present, when we do "rostopic list" shouldn't the odometry/gps topic be listed?

rsmitha gravatar image rsmitha  ( 2017-05-28 20:05:49 -0500 )edit

Have you set up navsat_transform_node correctly? Please read through the documentation fully. It's not a trivial exercise and may take you a while to make sure the node is working correctly. Once it is all working, yes, it will publish the data on the odometry/gps topic.

ufr3c_tjc gravatar image ufr3c_tjc  ( 2017-05-28 20:10:33 -0500 )edit

Your Answer

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

Add Answer

Question Tools

2 followers

Stats

Asked: 2017-05-28 04:23:16 -0500

Seen: 696 times

Last updated: May 28 '17