0
$\begingroup$

Rosanswers logo

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;
//initialisation
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 ));
//callback
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.

Thanks


Originally posted by adesh on ROS Answers with karma: 36 on 2012-04-09

Post score: 0


Original comments

Comment by tfoote on 2012-04-09:
What are you setting as the target frame? What is "tf", is it different that "tf_"? Do you get any message outputs from rxconsole?

Comment by adesh on 2012-04-10:
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.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by adesh with karma: 36 on 2012-04-10

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.