lemmingapex / trilateration

Solves a formulation of n-D space trilateration problem using a nonlinear least squares optimizer
MIT License
398 stars 106 forks source link

Packaged JAR file for Processing #16

Closed werty37 closed 6 years ago

werty37 commented 6 years ago

Thanks for this amazing library. I was able to get good results with trilateration from UWB DWM1000 modules. I was wondering how to compile this library as a Jar file to be included in Processing.

Taking a quick look at the gradle.settings, i ran "gradle sourcesJar" and ended up with a "trilateration-1.0.2-sources.jar" in the build/libs folder. Can i use this as a include/library in processing. Please let me know.

werty37 commented 6 years ago

I was able to get the Jar from the releases page here: https://github.com/lemmingapex/trilateration/releases

To import as a library in Processing, i did the following:

  1. Created a folder named "trilateration" in the default processing libraries folder. This will depend on your platform/os.
  2. Created a sub-folder "library" inside the "trilateration" folder.
  3. Copied the "trilateration-1.0.2.jar" inside the library folder
  4. Renamed "trilateration-1.0.2.jar" as "trilateration.jar"
  5. Create "library.properties" file in the "trilateration" folder.
  6. Copied the following contents into "library.properties" file.
name=Lemmingapex Trilateration
category=Math
authors=[Scott Wiedemann](http://lemmingapex.com/)
url=https://github.com/lemmingapex/trilateration
sentence=Solves a formulation of n-D space trilateration problem using a nonlinear least squares optimizer
paragraph=Solves a formulation of n-D space trilateration problem using a nonlinear least squares optimizer. Input: positions, distances; Output: centroid with geometry and error. Uses Levenberg-Marquardt algorithm from Apache Commons Math.
version=01
prettyVersion=1.0.2
lastUpdated=0
minRevision=0
maxRevision=0

You will need to add the following as imports. This, i think might change depending on your use case.

import org.apache.commons.math3.fitting.leastsquares.*;
import org.apache.commons.math3.fitting.leastsquares.LeastSquaresOptimizer.Optimum;
import org.apache.commons.math3.linear.RealMatrix;
import org.apache.commons.math3.linear.RealVector;

import com.lemmingapex.trilateration.*;

You will also need Apache Commons Math library. Repeat the steps above to import Apache Commons Math as a library. I followed these instructions found on StackOverflow: https://stackoverflow.com/a/43007929/1577171

Is there any way if i can compile Apache Math Commons and Lemmingapex Trilateration in a single Jar file?

lemmingapex commented 6 years ago

Glad you were able to resolve your issue.