Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Solver ¶
type Solver struct{}
Solver encapsulates the position solving logic for Time-of-Flight (ToF) calculations. It uses a least-squares optimization approach to determine the position of a tag based on distances from known anchor points.
func (*Solver) Solve ¶
Solve calculates the 3D position of a tag based on anchor coordinates and measured distances.
Parameters:
- anchors: A slice of Point representing the known positions of the anchors.
- distances: A slice of float64 representing the measured distances from each anchor to the tag.
Returns:
- Point: The calculated 3D position of the tag.
- error: An error if the inputs are invalid (e.g., mismatched lengths or insufficient anchors).
The solver uses the Nelder-Mead simplex method to minimize the sum of squared residuals. It uses the centroid of the anchors as the initial guess to speed up convergence.
Click to show internal directories.
Click to hide internal directories.