Ask Your Question
1

Math functions for geometry_msgs?

asked 2013-05-01 18:39:42 -0600

aswin gravatar image

Hi all, What is the best practice for doing simple math operations such as 'calculating 3D euclidian distance between two geometry_msgs::Points'?

I found a Linearmath folder in the 'tf' include for vectors, but did not find any related documentation.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2013-05-02 03:42:40 -0600

dornhege gravatar image

If it is really simple (like your example): Do it by hand, i.e. hypot(p1.x - p2.x,...).

If it is a little more advanced, or you might do more than 1 simple calculation: Convert the messages (which are just 'dumb' containers for data) to their respective tf data types. There are conversion functions like tf::pointMsgToTF for converting forth and back. The tf data types have all the geometry operations you'd expect for linear math.

edit flag offensive delete link more

Comments

1

Also note that the geometry stack includes nice functions for getting tf data into Eigen and KDL types. This can be useful if you need more complex math operations.

jarvisschultz gravatar imagejarvisschultz ( 2013-05-02 05:17:35 -0600 )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

Stats

Asked: 2013-05-01 18:39:42 -0600

Seen: 2,416 times

Last updated: May 02 '13