lemmingapex / trilateration

Solves a formulation of n-D space trilateration problem using a nonlinear least squares optimizer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

3-Dimension Support?

msaiducar opened this issue · comments

Hi,

I'm wondering that this trilateration is support 3dimension? I tried with the below sample, but the result wasn't as I expected.

position points P1(1,1,1), P2(1,-1,1), P3(-1,-1,1) and the distances sqrt(3) to find location point P4(0,0,0) but the result was P4(-0.299678083,0.299678083, 1).

Hi @msaiducar,

There appear to be exactly two well formed roots to this situation, the one you listed, (0,0,0), and (0,0,2). The algorithm failed to find either, and got trapped in a local minimum when trying to optimize the result. This actually happens frequently in precisely symmetric well formed cases like yours.

I don't know how you are using the library, but if you were 'jitter' any of the positions or the distances, I would expect that you would get a more accurate answer. In situations where there may be no roots (no exact intersections), the library will still provide an answer. This allows for situations where there may be measurement error in position or distance.

Does this make sense to you?

Thanks,
Scott

Hi @lemmingapex ,

Your explanation is perfectly make sense. I just wanted to be sure that library works on 3-D and tried simplest points. So, normally, I don't have these kind of symmetric problems, so library will work.

Thank you for your response,
Said.

Hi again @lemmingapex ,

I'm working on the library and have a problem. Since it is related my old question, I don't wanted to open new issue. The problem is, I have 6 position points and the distances with measurement error. At some points, the library calculates exactly same points (and so wrong) for different input distances. When I remove the 3rd axis from calculation, library calculates more accurately. Is there a way to know that the calculated positions is reliable (by probability or something like that)? I know that library will provide always an answer, and sometimes this answer is not better than no answer. Is there a parameter or different Solver method (different from Levenberg–Marquardt) that I can trust the generated answer? If the library doesn't generate solution for some inputs, I can interpole the missing points which is better I think.

UPDATE: I noticed that, when I include 3rd axis (with 6 position and 6 distances), there is only one iteration done by library. If I remove, the number of iteration goes 6 to 10.

Any help would be great,
Thanks in advance,

Said.

Hey @msaiducar,

There is some error information that might tell you if the solution is reliable.

// the answer
double[] centroid = optimum.getPoint().toArray();

// error and geometry information; may throw SingularMatrixException depending the threshold argument provided
RealVector standardDeviation = optimum.getSigma(0);
RealMatrix covarianceMatrix = optimum.getCovariances(0);

Interpreting the standard deviation and covariance as meaningful depends on how you are using trilateration. You can read more about what these mean here and other information regarding least squares ideas here: http://commons.apache.org/proper/commons-math/javadocs/api-3.3/org/apache/commons/math3/fitting/leastsquares/LeastSquaresProblem.Evaluation.html

Hopefully that gives you somewhere to start.

Best,
Scott

@msaiducar Did you get something working? I'm going to close this ticket unless you have more questions, or are having more issues.

@lemmingapex , you can close the ticket, thanks again for your help. I'm will dig a little bit more.

Said.