I've been trying to employ message_filters package to subscribe and synchronize multiple messages that are coming in. At this moment, I've been doing it for synchronizing only 2 topics. Nevertheless, the messages that are expected to come in do not appear to do so. I've tried to watch the string output(if it succeeds) via both console and rxconsole. I receive neither a single error nor warning for the time being.
Below, is my code snippet for it:
message_filters::Subscriber<sensor_msgs::LaserScan> scan_sub_(n, "/scan", 1);
message_filters::Subscriber<geometry_msgs::PoseStamped> poseLD_sub(n, "/pose3D_LD", 1);
TimeSynchronizer<sensor_msgs::LaserScan, geometry_msgs::PoseStamped> sync(scan_sub_, poseLD_sub, 10);
sync.registerCallback(boost::bind(&PointCloudBuilder::callback, this, _1, _2));
void PointCloudBuilder::callback(const sensor_msgs::LaserScanConstPtr& scan_ptr, const geometry_msgs::PoseStampedConstPtr& poseLD_ptr)
{
ROS_INFO("The data is coming in :-");
std::cout << "The data is coming in :-)" << std::endl;
std::cout << poseLD_ptr->pose.position.x << std::endl;
}
What could be the fix or how to debug it?
Thanks in advance.
EDIT
Should the published/incoming messages timestamps set as number 1 or 2, I'm a bit confused about this:
1. scan.header.stamp = ros::Time::now();
pose3D_LD.header.stamp = scan.header.stamp;
2. scan.header.stamp = ros::Time::now();
pose3D_LD.header.stamp = ros::Time::now();
Originally posted by alfa_80 on ROS Answers with karma: 1053 on 2012-01-29
Post score: 0
Original comments
Comment by alfa_80 on 2012-01-29:
Strange, after retrying "1.", it still doesn't work.
Comment by dornhege on 2012-01-29:\
- should work, 2. would give similar but not the same timestamps. But, if you can do 1., you already have the messages synched at this spot and could call the funciton from here.