Skip to content

Commit 3a36674

Browse files
committed
added waitForTransform to mapper
1 parent ef35ddf commit 3a36674

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pointcloud_tools/src/pointcloud_mapper.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class PointCloudMapper
3131
nh_priv_.param("voxel_size", voxel_size_, 0.1);
3232
nh_priv_.param("filter_map", filter_map_, false);
3333

34-
cloud_sub_ = nh_.subscribe<PointCloud>("input", 10, &PointCloudMapper::callback, this);
34+
cloud_sub_ = nh_.subscribe<PointCloud>("input", 15, &PointCloudMapper::callback, this);
3535
bool latched = true;
3636
cloud_pub_ = nh_priv_.advertise<PointCloud>("output", 1, latched);
3737
pub_timer_ = nh_.createTimer(ros::Duration(10.0), &PointCloudMapper::publishCallback, this);
@@ -41,6 +41,9 @@ class PointCloudMapper
4141
{
4242
ROS_INFO_STREAM("received cloud with " << cloud->points.size() << " points.");
4343
PointCloud transformed_cloud;
44+
ros::Time points_time;
45+
points_time.fromNSec((*cloud).header.stamp);
46+
tf_listener_.waitForTransform(fixed_frame_, (*cloud).header.frame_id, points_time, ros::Duration(5.0));
4447
bool success = pcl_ros::transformPointCloud(fixed_frame_, *cloud, transformed_cloud, tf_listener_);
4548
if (success)
4649
{

0 commit comments

Comments
 (0)