필터 지우기
필터 지우기

ICP Complex Data Error

조회 수: 4 (최근 30일)
Jaden
Jaden 2012년 6월 18일
I'm working with scans of a single 2D plane of laser data, taken of a 190 degree area. I'm using ICP code (that I found on the matlab forums here: http://www.mathworks.com/matlabcentral/fileexchange/27804-iterative-closest-point) in order to match up the scans and from that, figure out how much the robot has moved. (I changed the original code from that link to fit 2D inputs.) In order to do this, I'm running the ICP in a while loop that updates a plot so that I can see the results.
Everything seems to be working, except that I keep getting this error when I run my code:
??? Error using ==> KDTreeSearcher.knnsearch at 165 Complex data is not allowed.
Error in ==> icp>match_kDtree at 335 [match mindist] = knnsearch(kdOBJ,transpose(p));
Error in ==> icp at 289 [~, mindist] = match_kDtree(q,pt,kdOBJ);
Error in ==> testing_icp_movie at 37 [Ricp Ticp ER t] = icp(M, D, 50,'Matching', 'kDtree', 'Extrapolation',true);
Error in ==> overallprogramming_Try2 at 39 testing_icp_movie;
This leads me to believe that somewhere, it's getting a imaginary number when it tries to compute a square root.
I also get this warning from the ICP code itself:
Warning: Polynomial is badly conditioned. Add points with distinct X values, reduce the degree of the polynomial, or try centering and scaling as described in HELP POLYFIT.
However, the thing that is tripping me up is that when I run the code, with the very same data, variables, and settings, I keep getting the error at different times -- and it hasn't happened in the same place twice. I've gotten this error when the when the while loop has completed 86 times, 102 times, 106 times, 109 times, and 107 times. Why wouldn't this error happen at the same place every time? Any suggestions?
Let me know if there is any other data/code that would help in answering this.

채택된 답변

Walter Roberson
Walter Roberson 2012년 6월 18일
Perhaps there is some amount of randomization involved? You could experiment with setting the random number generator to the same seed before each run. If you are using a very recent MATLAB version, see rng()
  댓글 수: 1
Jaden
Jaden 2012년 6월 20일
It does have randomization involved -- I input two sets of data, one already transformed, and one new scan. Then it has this line in the icp code:
% Add noise to model and data
Mtest = Mtest + 0.01*randn(3,width3);
Dtest = Dtest + 0.01*randn(3,width3);
Two follow up questions -- how do I make sure that this randomization doesn't make the data complex? also, why do I need to add noise to my model and data?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by