ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
The first major problem that I see is that your tfb.sendTransform()
method publishes a transform between "base_link" and "target_frame". This might not be a mistake if you actually have a frame named "target_frame".
Secondly, the function transformLaserScanToPointCloud()
transforms the points in the scan from the scan's frame_id to the target frame_id. As such, if your scan is coming in with a frame_id of "/" (which I think it is), this function will not work.
Also, you have to make sure that your tf exists before trying to use it. Before your call to transformLaserScanToPointCloud()
, I would add the line:
tfListener_.waitForTransform("/base_link", previous_scan_.header.frame_id.c_str(), ros::Time(0), ros::Duration(2.0));
This will wait until the transform exists before trying to look for it.