问题:error: no matching function for call to ‘transformPointCloud(std::__cxx11::string&, pcl::PointCloudpcl::PointXYZI&, pcl::PointCloudpcl::PointXYZI&, tf2_ros::Buffer&)’
问题原因:pcl_ros 不支持tf2,改成tf版本
/*old
if(!pcl_ros::transformPointCloud(odom_child_frame_id, *pcl_cloud, *cloud, this->tf_buffer)) {
NODELET_ERROR("point cloud cannot be transformed into target frame!!");
return;
*/
//below is new
if(!tf_listener.canTransform(odom_child_frame_id, pcl_cloud->header.frame_id, ros::Time(0))) {
std::cerr << "failed to find transform between " << odom_child_frame_id << " and " << pcl_cloud->header.frame_id << std::endl;
}
tf::StampedTransform transform;
tf_listener.waitForTransform(odom_child_frame_id, pcl_cloud->header.frame_id, ros::Time(0), ros::Duration(2.0));
tf_listener.lookupTransform(odom_child_frame_id, pcl_cloud->header.frame_id, ros::Time(0), transform);
//okagv
if(!pcl_ros::transformPointCloud(odom_child_frame_id,*pcl_cloud, *cloud, tf_listener)) {
NODELET_ERROR("point cloud cannot be transformed into target frame!!");
return;
}
另一个问题,加上头文件
#include <atomic>