티스토리 뷰

conditional_filter: 
/build/pcl-OilVEB/pcl-1.8.1+dfsg1/search/include/pcl/search/impl/organized.hpp:57: 
int pcl::search::OrganizedNeighbor::radiusSearch(const PointT&, double, 
std::vector&, std::vector&, unsigned int) const [with PointT = pcl::PointXYZ]: 
Assertion `isFinite (query) && 
"Invalid (NaN, Inf) point coordinates given to nearestKSearch!"' failed.

conditional filter 튜토리얼을 돌리던 도중에 마주한 에러이다.

 

잘 읽어보면 Invalid NaN, Inf값을 가지는 포인트 클라우드가 K서치 알고리즘에 들어가면서 문제가 생겼다는 걸 알 수 있다.

이때는 포인트 클라우드 내부에 NaN값을 좌표로 가지는 포인트가 있어서 생기는 문제이기 때문에 NaN값을 가지는 좌표들을

지우면 된다. 해결책은 여기서 참고했다.

https://github.com/erik-nelson/blam/issues/26

 

PCL error? · Issue #26 · erik-nelson/blam

We're trying to run this code and encountered the following error as soon as the LIDAR started streaming data: blam_slam_node: /build/pcl-6_P28C/pcl-1.7.2/kdtree/include/pcl/kdtree_flann.hpp:13...

github.com

간단하게 is_dense 설정이 false로 되어있을 경우 NaN값이 있을 수있기에 아래 코드를 통해 nan을 지워주면 된다

dense 할 경우 nan값이 없어야 정상이다.

 

if (!cloud->is_dense)
{ 
	cloud->is_dense = false; std::vector<int> indices; 
	pcl::removeNaNFromPointCloud(*cloud,*cloud, indices); 
}

한가지 위 깃허브 링크에서 말해주지 않는 건 std::vector에 타입을 선언해줘야 돌아간다. 깃헙 코드대로 하면 안돌아간다.

nan 지우는건 단순히 removeNaNFromPointCloud 해주면 끝!

댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31