hdl_localization_nodelet.cpp问题记录
Posted COCO_PEAK_NOODLE
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了hdl_localization_nodelet.cpp问题记录相关的知识,希望对你有一定的参考价值。
问题: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>
以上是关于hdl_localization_nodelet.cpp问题记录的主要内容,如果未能解决你的问题,请参考以下文章