ROS与PCL:在setconditionfunciton时,无法使用std::bind

说明

在自己定义的类里面使用pcl::ConditionalEuclideanClustering::setConditionFunction 时,

cec.setConditionFunction (std::bind(&tube_detect::customRegionGrowing, this, _1, _2, _3));

报错:

no suitable conversion function from “std::_Bind<std::_Mem_fn<bool (tube_detect : : *)(const PointTypeFull &point_a, const PointTypeFull &point_b, float squared_distance)> (tube_detect , boost::arg<1>, boost::arg<2>, boost::arg<3>)>” to “bool ()(const PointTypeFull &, const PointTypeFull &, float)” exists

原因

与ROS-Kinetic对应的PCL版本是PCL 1.7

它的setConditionFunction is only defined as:

  inline void
  setConditionFunction (bool (*condition_function) (const PointT&, const PointT&, float)) 
  {
    condition_function_ = condition_function;
  }

因此, 不能使用std::bind.(与重载定义std::function相对应)

btw, 在ROS中,无法使用更高版本的pcl。
https://github.com/ros-perception/perception_pcl/issues/284#issuecomment-644246805

For each ROS distribution, per REP 103, we only officially support 1 PCL version.

对应版本查看:https://www.ros.org/reps/rep-0003.html

其他

另外,即使自己按照高版本添加了setConditionFunction 的重载,即使编译通过,在实际运行的时候,也无法运行自定义条件函数。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章