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

multiple messages sync with tf

asked 2011-12-16 05:42:17 -0500

Akin gravatar image

updated 2011-12-16 06:55:09 -0500

Hello,

I am trying to write a callback where two topics and tf are synchronized. For example I want to have an image, a pointcloud and tf at the same time.

I inspired from the piece of code below, which deals with one topic and tf. Does anybody know how to extend tf:MessageFilter to two or more topics?

Thanks

 tf::TransformListener tf_;
 tf::MessageFilter<sensor_msgs::PointCloud2> * tf_filter_;
 message_filters::Subscriber<sensor_msgs::PointCloud2> cloud2_sub_;

//initialisation
cloud2_sub_.subscribe(n, "/kinect/rgb/points2", 10);
tf_filter_ = new tf::MessageFilter<sensor_msgs::PointCloud2>(cloud2_sub_, tf_, "/map", 10);
tf_filter_->registerCallback( boost::bind(&PointReader::pointCloudCallback, this, _1) );

//callback
void pointCloudCallback(const sensor_msgs::PointCloud2::ConstPtr& sensor_msg)
{
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2012-01-01 05:55:51 -0500

tfoote gravatar image

The tf::MessageFilter is based on the core message_filter package which can be used to do what you want.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2011-12-16 05:42:17 -0500

Seen: 1,366 times

Last updated: Jan 01 '12