tetra3rs
A fast, robust lost-in-space star plate solver written in Rust.
Given a set of star centroids extracted from a camera image, tetra3rs identifies the stars against a catalog and returns the camera's pointing direction as a quaternion — no prior attitude estimate required.
Features
- Lost-in-space solving — determines attitude from star patterns with no initial guess
- Fast — geometric hashing of 4-star patterns with breadth-first (brightest-first) search
- Robust — statistical verification via binomial false-positive probability
- Multiscale — supports a range of field-of-view scales in a single database
- Proper motion — propagates Hipparcos catalog positions to any observation epoch
- Zero-copy deserialization — databases serialize with rkyv for instant loading
Quick start
Obtaining the Hipparcos catalog
Download hip2.dat from the Hipparcos, the New Reduction (I/311) and place it at data/hip2.dat:
Example
use ;
// Generate a database from the Hipparcos catalog
let config = GenerateDatabaseConfig ;
let db = generate_from_hipparcos?;
// Save the database to disk for fast loading later
db.save_to_file?;
// ... or load a previously saved database
let db = load_from_file?;
// Solve from image centroids (positions in radians from boresight)
let centroids = vec!;
let solve_config = SolveConfig ;
let result = db.solve_from_centroids;
if result.status == MatchFound
Algorithm overview
- Pattern generation — select combinations of 4 bright centroids; compute 6 pairwise angular separations and normalize into 5 edge ratios (a geometric invariant)
- Hash lookup — quantize the edge ratios into a key and probe a precomputed hash table for matching catalog patterns
- Attitude estimation — solve Wahba's problem via SVD to find the rotation from catalog (ICRS) to camera frame
- Verification — project nearby catalog stars into the camera frame, count matches, and accept only if the false-positive probability (binomial CDF) is below threshold
- Refinement — re-estimate the rotation using all matched star pairs
Catalog support
| Catalog | File | Notes |
|---|---|---|
| Hipparcos | data/hip2.dat |
Default; includes proper motion |
| Gaia | data/gaia_bright_stars.csv |
Requires --features gaia |
Credits
This project is a Rust implementation of the tetra3 / cedar-solve algorithm.
- cedar-solve — Steven Rosenthal's C++/Rust star plate solver, which this implementation closely follows (excellent work!)
- tetra3 — the original Python implementation by Gustav Pettersson at ESA
- Paper: G. Pettersson, "Tetra3: a fast and robust star identification algorithm," ESA GNC Conference, 2023
License
MIT License. See LICENSE for details.
This project is a derivative of tetra3 and cedar-solve, both licensed under Apache 2.0 (which in turn derive from Tetra by brownj4, MIT licensed). The upstream license notices are included in the LICENSE file.