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

callback issue when using tf::MessageFilter

asked 2012-04-09 07:12:44 -0500

adesh gravatar image

updated 2014-01-28 17:11:55 -0500

ngrennan gravatar image

Hello all, I am trying to use Message filter just like given in the tutorial 'Using Stamped datatypes with tf::MessageFilter'. for two messages. tf and odom . I also have one more subscriber (which is not synchronized) and has its own callback.

Here is what I am doing:

tf::TransformListener tf;
tf::MessageFilter<nav_msgs::Odometry> * tf_filter;
message_filters::Subscriber<nav_msgs::Odometry> odom_sub;
method1_sub = nh_.subscribe( "topic1",1,&ClassA::method1Callback, this);
odom_sub.subscribe(nh_, "in_odom", 10);
tf_filter = new tf::MessageFilter<nav_msgs::Odometry>(odom_sub, tf,target_frame, 10);
tf_filter->registerCallback( boost::bind(&ClassA::callback_odom, this, _1 ));
void callback_odom( const nav_msgs::Odometry::ConstPtr& msg )
ROS_INFO_STREAM("callback_odom Test");

void method1Callback( const geometry_msgs::xyz::ConstPtr& msg )
 ROS_INFO_STREAM(" method1Callback Test");

But my callback_odom callback function is not getting called;However method1Callback does get called. Does anybody know what might be going wrong? What I want to do is process some data in the 'callback_odom' and then use it further.


edit retag flag offensive close merge delete



What are you setting as the target frame? What is "tf", is it different that "tf_"? Do you get any message outputs from rxconsole?

tfoote gravatar image tfoote  ( 2012-04-09 16:16:29 -0500 )edit

Sorry it was a typing mistake. tf was same as _tf. I have corrected it. I am setting 'odom' as the target frame. In the rxconsole, I can see 'method1Callback Test' which is the implementation of my method1Callback.

adesh gravatar image adesh  ( 2012-04-10 06:45:55 -0500 )edit

3 Answers

Sort by ยป oldest newest most voted

answered 2012-04-10 14:33:27 -0500

adesh gravatar image

Hello all I got the issue solved. There was a small mismatch in the 'params' between the source file and the launch file. Thank you.

edit flag offensive delete link more

answered 2012-04-10 08:34:51 -0500

tfoote gravatar image

Are there any messages being sent on "in_odom" topic?

edit flag offensive delete link more

answered 2012-04-10 10:41:04 -0500

adesh gravatar image

Yes, I see the position and orientation of the robot in the in_odom topic.

edit flag offensive delete link more

Question Tools


Asked: 2012-04-09 07:12:44 -0500

Seen: 350 times

Last updated: Apr 10 '12