callback issue when using tf::MessageFilter
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
What are you setting as the target frame? What is "tf", is it different that "tf_"? Do you get any message outputs from rxconsole?
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.