9

We want to implement some kind of indoor position determination using iBeacons. This article seems really interesting, in which the author implemented the Non-linear Least Squares Triangulation, using the Eigen C++ library and the Levenberg Marquardt algorithm. Since Eigen is written in C++, I tried to use JNI and Android NDK in order to use it but it throws a lot of errors that I have no idea how to solve and I couldn´t find anything online. I also tried to use Jeigen, but it does not have all the functions that we need.

So, my questions are:

  1. Has someone ever implemented some kind of Trilateration using beacons in Android?

  2. Do you think that using Eigen+JNI+NDK is a good solution? If yes, have you ever implemented Levenberg Marquardt using that combination?

  3. Are there better options than the Levenberg Marquardt algorithm for calculating the trilateration in a Android application?

Community
  • 1
  • 1
Lucas Coelho
  • 583
  • 6
  • 11
  • Did you try http://altbeacon.github.io/android-beacon-library/download.html ? – Rikki Tikki Tavi Feb 26 '15 at 17:13
  • I gave an example of how to implement some Eigen funtions with Java [here](https://stackoverflow.com/questions/17046585/cholmod-in-java/30526005#30526005). – Z boson May 29 '15 at 09:41

1 Answers1

4

Take a look at this library: https://github.com/lemmingapex/Trilateration

uses Levenberg-Marquardt algorithm from Apache Commons Math.

For example.. into the TrilaterationTest.java

you can see:

double[][] positions = new double[][] { { 1.0, 1.0 }, { 2.0, 1.0 } };
double[] distances = new double[] { 0.0, 1.0 };

TrilaterationFunction trilaterationFunction = new TrilaterationFunction(positions, distances);
NonLinearLeastSquaresSolver solver = new NonLinearLeastSquaresSolver(trilaterationFunction, new LevenbergMarquardtOptimizer());

double[] expectedPosition = new double[] { 1.0, 1.0 };
Optimum optimum = solver.solve();
testResults(expectedPosition, 0.0001, optimum);

but if you see the objectivec example https://github.com/RGADigital/indoor_navigation_iBeacons/blob/show-work/ios/Group5iBeacons/Debug/Managers/Location/NonLinear/NonLinear.mm you can note that the accuracy is used as an assessment parameter and not the distance.

HybrisHelp
  • 5,518
  • 2
  • 27
  • 65
  • Works great! When using the trilateration algorithm, make sure to convert (lat, long, alt) into Cartesian coordinates (x, y, z) as required by the library. – Scott Wiedemann Jan 02 '17 at 18:54