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

odom_broadcaster.sendTransform(odom_trans) compiling error

asked 2013-06-20 22:02:52 -0500

updated 2014-01-28 17:17:00 -0500

ngrennan gravatar image

Hi guys,

I'm trying to follow this tutorial and I attach to my driver controll node but when I compile it the following error occurred

error: request for member ‘sendTransform’ in ‘odom_broadcaster’, which is of non-class >type ‘tf::TransformBroadcaster*’

this is the line it refers to


if I try to comment that line compile goes "well", but maybe I don't receive the transform for the base link?

Could someone help me?

EDIT 1: I'm sorry but I found somewhere that, that line chage from "tf::TransformBroadcaster odom_broadcaster" to "tf::TransformBroadcaster *odom_broadcaster" so changed it but without a great idea of what i'm doing. So I restore the original version and now the error is:

undefined reference to `tf::TransformBroadcaster::TransformBroadcaster()'

undefined reference to 'tf::TransformBroadcaster::sendTransform(geometry_msgs::TransformStamped_<std::allocator<void> > const&)'

I'm sorry but i thought I restored everything but I was wrong.

any new suggestion?

thanks a lot


Finnaly it works, maybe not in the right way but it works. I add the tf_broadcaster.cpp source in my source folder and also the line in my CMakelist.txt and compile it. I think it's not correct but for the moment is enough.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2013-06-21 02:34:54 -0500

updated 2013-06-25 03:14:38 -0500

The error message explains the problem, although it takes a bit of experience to understand what it means.

The error message says that you have declared odom_broadcaster as a tf::TransformBroadcaster pointer. If so, then you need to call the sendTransform method using pointer-syntax:


Note that the tutorial you referenced declares odom_broadcaster as an object, not a pointer, so won't have the issue you're seeing. Check to make sure you've followed the tutorial correctly.

The new error message you're reporting (undefined reference...) is a linker error. Make sure that you have a reference to the tf package in your manifest.xml/package.xml and CMakeLists.txt. The appropriate syntax depends on whether you're using catkin_make or rosmake. Have you tried following the initial tf tutorials here? The create_pkg command in Step 1 should have created the appropriate dependencies in your package.xml file. Check to make sure there's a tf dependency listed. If using catkin, make sure you have added the line:

target_link_libraries(turtle_tf_broadcaster ${catkin_LIBRARIES})

Also, it's not specified in the tutorial, but you probably also need an additional line in CMakeLists.txt to add the tf package as a catkin component, as explained here:

find_package(catkin REQUIRED COMPONENTS tf)
edit flag offensive delete link more


I follow the tutorial as is, but my experience in c# is closed to 0, so try to understand what the code do and attach it where I think is the correct place, this is the best I can do for the moment, Could you be a little more precise where I need to modify? thanks a lot for your answer

danielq gravatar image danielq  ( 2013-06-23 23:53:33 -0500 )edit

Please update your post with the code you're trying to run. You should probably change the line that currently reads "tf::TransformBroadcaster *odom_broadcaster" to read "tf::TransformBroadcaster odom_broadcaster".

Jeremy Zoss gravatar image Jeremy Zoss  ( 2013-06-24 03:19:53 -0500 )edit

Thank you a lot!I tried to follow 'tf' tutorials and found the same problem with the questioner.And I add the tf dependency to the 'CMakeLists.txt' and it works!

xmfbit gravatar image xmfbit  ( 2013-11-20 03:05:27 -0500 )edit

Question Tools


Asked: 2013-06-20 22:02:52 -0500

Seen: 5,309 times

Last updated: Jun 27 '13