trilateration

package
v0.0.0-...-19f75ae Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 25, 2020 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

The package 'trilateration' provides utilities to perform trilateration (also known as true range multilateration), to determine the location in a 3D space of a target point, given the distances from "station" points whose location is already known.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Distance

func Distance(p1, p2 Point) float64

Computes the distance between two points in a 3D space.

func SumOfResidualSquares

func SumOfResidualSquares(observations []Range, current_guess Point) (sum_of_squares float64)

Returns the sum of the squares of the residuals.

Types

type Point

type Point struct {
	X float64
	Y float64
	Z float64
}

Cartesian coordinates of a Point in a 3D space.

func GaussNetwonIteration

func GaussNetwonIteration(observations []Range, current_guess Point) Point

Implements one iteration of the Gauss–Newton algorithm (https://en.wikipedia.org/wiki/Gauss%E2%80%93Newton_algorithm), as applied to true range multilateration. Returns the new guess.

func SelectRandomPointInCubicRange

func SelectRandomPointInCubicRange(center Point, distance float64) Point

Select a random point from the cubic space identified by these properties: * its center is the provided Point * its edges are parallel to the 3d coordinate axes; * its edges are 2*distance units long.

Please note that this function re-seeds the global random pool at each invocation.

func SelectRandomPointOnSphere

func SelectRandomPointOnSphere(center Point, radius float64) Point

Select a random point on the sphere whose center and radius are provided.

Please note that this function re-seeds the global random pool at each invocation.

func Trilaterate

func Trilaterate(observations []Range, initial_guess Point, max_iterations int, min_sum_of_residual_squares float64) (Point, error)

Performs trilateration on the provides observations, using initial_guess as the starting point of the algorithm. The algoritm will run iteratively, until either the maximum number of iterations has been reached, or the sum of the squares of the residuals fell under the provided value. Provide max_iterations=0 or a negative min_sum_of_residual_squares to disable either check.

Returns the result of the algorithm, that matches the best estimate of the solution when the algorithm converged. Please note that, for some combinations of the input parameters, the algorithm might not converge; in that case, the returned error is non-nil.

The choice of the initial guess is very important for the convergence of the algorithm. Some choices might render the problem ill-conditioned. As such, this library provides some helper APIs that can help randomize the choice of the initial guess; please refer to space.go for more details.

type Range

type Range struct {
	Station  Point
	Distance float64
}

Representation of a range, as distance from a given starting point (called 'station').

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL