說明
在自己定義的類裏面使用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 的重載,即使編譯通過,在實際運行的時候,也無法運行自定義條件函數。