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

Roscpp header file for tf2 transform

asked 2017-03-15 09:42:55 -0500

errolflynn gravatar image

updated 2017-03-15 09:43:12 -0500

Which header file to include for tf2::Transform? Unfortunately this is not a well documented way to use tf2 as far as I can find. It is in the file Transform.h, but that file can't be included as such: <tf2/Transform.h> or <tf2/LinearMath/Transform.h>

Should I revert to using tf? Is this not a canonical way to use tf2?


edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2017-03-15 11:37:57 -0500

tfoote gravatar image

The tf2::Transform is in <tf2/LinearMath/Transform.h> here. My guess is that you are not adding the correct paths to your include directories in you CMakeLists.txt

Note that in general it's recommended to use a standalone linear math library like eigen or bullet or kdl

You can used packages like tf2_bullet or tf2_eigen or tf2_kdl

Or you can add support for your own datatypes:

edit flag offensive delete link more


Thank you. Any reasons why to use specifically one of those options over the other?

errolflynn gravatar image errolflynn  ( 2017-03-15 11:56:40 -0500 )edit

I like eigen because it is more general purpose and is easy to use (IMO).

Airuno2L gravatar image Airuno2L  ( 2017-03-15 12:17:25 -0500 )edit

What is include header for tf2_eigen?

errolflynn gravatar image errolflynn  ( 2017-03-16 17:58:58 -0500 )edit

is it not tf2_eigen.h ?

Airuno2L gravatar image Airuno2L  ( 2017-03-17 13:57:27 -0500 )edit

Getting the message fatal error: tf2_eigen/tf2_eigen.h: No such file or directory #include <tf2_eigen/tf2_eigen.h>

errolflynn gravatar image errolflynn  ( 2017-03-17 14:54:41 -0500 )edit

Not getting the same error for tf2_kdl/tf2_kdl.h

errolflynn gravatar image errolflynn  ( 2017-03-17 14:58:38 -0500 )edit

Solved: It's because I didn't have tf2_eigen installed

errolflynn gravatar image errolflynn  ( 2017-03-17 15:02:10 -0500 )edit

answered 2017-03-15 10:58:18 -0500

Airuno2L gravatar image

Have you seen the tf2 tutorials? They all seem to use geometry_msgs/Transform.

edit flag offensive delete link more


Correct me if I'm wrong, but it is my understanding that the tf2 Transform class is in a different namespace. It has an API that allows for native algebra and some other stuff. geometry_msgs Transform is generated from a ROS .msg. Thus it's API is limited to mostly access and some conversions.

errolflynn gravatar image errolflynn  ( 2017-03-15 11:24:57 -0500 )edit

Question Tools

1 follower


Asked: 2017-03-15 09:42:55 -0500

Seen: 2,182 times

Last updated: Mar 15 '17