Triangulate example for iBeacons

后端 未结 13 2319
梦毁少年i
梦毁少年i 2020-11-28 17:14

I am looking into the possibility to use multiple iBeacons to do a \'rough\' indoor position location. The application is a kind of \'museum\' setting, and it would be easie

13条回答
  •  眼角桃花
    2020-11-28 18:02

    Here is an open source java library that will perform the trilateration/multilateration: https://github.com/lemmingapex/Trilateration

    It uses a popular nonlinear least squares optimizer, the Levenberg-Marquardt algorithm, from Apache Commons Math.

    double[][] positions = new double[][] { { 5.0, -6.0 }, { 13.0, -15.0 }, { 21.0, -3.0 }, { 12.42, -21.2 } };
    double[] distances = new double[] { 8.06, 13.97, 23.32, 15.31 };
    
    NonLinearLeastSquaresSolver solver = new NonLinearLeastSquaresSolver(new TrilaterationFunction(positions, distances), new LevenbergMarquardtOptimizer());
    Optimum optimum = solver.solve();
    
    // the answer
    double[] calculatedPosition = optimum.getPoint().toArray();
    
    // error and geometry information
    RealVector standardDeviation = optimum.getSigma(0);
    RealMatrix covarianceMatrix = optimum.getCovariances(0);
    

    Most scholarly examples, like the one on wikipedia, deal with exactly three circles and assume perfectly accurate information. These circumstances allow for much simpler problem formulations with exact answers, and are usually not satisfactory for practical situations.

    The problem in R2 or R3 euclidean space with distances that contain measurement error, an area (ellipse) or volume (ellipsoid) of interest is usually obtained instead of a point. If a point estimate is desired instead of a region, the area centroid or volume centroid should be used. R2 space requires at least 3 non-degenerate points and distances to obtain a unique region; and similarly R3 space requires at least 4 non-degenerate points and distances to obtain a unique region.

提交回复
热议问题