Ask Your Question
0

odom_broadcaster.sendTransform(odom_trans) compiling error

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

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

ngrennan gravatar image

Hi guys,

I'm trying to follow this tutorial http://www.ros.org/wiki/navigation/Tutorials/RobotSetup/Odom 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

odom_broadcaster.sendTransform(odom_trans);

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

EDIT 2:

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
4

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

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

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:

odom_broadcaster->sendTransform(odom_trans)

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.

Edit:
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

Comments

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 imagedanielq ( 2013-06-23 23:53:33 -0600 )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 imageJeremy Zoss ( 2013-06-24 03:19:53 -0600 )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 imagexmfbit ( 2013-11-20 03:05:27 -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-06-20 22:02:52 -0600

Seen: 4,427 times

Last updated: Jun 27 '13