Skip to main content

Lightweight Python Star Tracker With Rust Backend

Project description

Lightweight Python Star Tracker With Rust Backend

Based on the methodology used in https://github.com/nasa/COTS-Star-Tracker, with following improvements:

  • Reduced dependencies to opencv and numpy for lightweight usage in a Raspberry Pi.
  • Reimplemented computationally expensive parts in rust. This includes most parts that are not image processing related.
  • Added quadratic inter star angle index look up polynomial for faster triangle search.
  • Added spatial index to look up neighboring stars.

Features:

  • Attitude estimation from image and camera calibration parameters.
  • Attitude estimation from list of star observation coordinates.
  • Star catalog creation with temporal corrections.

Example

Rust

See examples/basic.rs

// Get catalog positions
let catalog: StarCatalog = StarCatalog::from_gaia(max_magnitude: ...).unwrap();
let stars_xyz: Vec<[f32; 3]> = catalog.normalized_positions(epoch: ..., observer_position: ...);
let stars_mag: Vec<f32> = catalog.magnitudes();

// Create StarTracker instance (reuse this)
let star_matcher = StarMatcher::new(
    stars_xyz,
    stars_mag,
    max_lookup_magnitude: ...
    max_inter_star_angle: ...,
    inter_star_angle_tolerance: ...,
    min_matches: ...,
    timeout: ...
);

// Normalized observation in the camera frame
let obs_xyz_camera: Vec<[f32; 3]> = ...

let result = star_matcher.find(&obs_xyz_camera);
println!("Result: {:?}", result);

Python

import ruststartracker

# Get catalog positions
catalog = ruststartracker.StarCatalog(max_magnitude=...)
star_catalog_vecs = catalog.normalized_positions(epoch=...)

# Define opencv camera parameters, see https://docs.opencv.org/4.x/dc/dbb/tutorial_py_calibration.html
camera_params = ruststartracker.CameraParameters(
    camera_matrix=...,
    cam_resolution=...,
    dist_coefs=...,
)

# Create StarTracker instance (reuse this)
st = ruststartracker.StarTracker(
    star_catalog_vecs,
    camera_params,
    max_inter_star_angle=...,
    inter_star_angle_tolerance=...,
    n_minimum_matches=...,
    timeout_secs=...,
)

# Obtain numpy array image
img = ...

# Find attitude from given image
result = st.process_image(img)

print(result)
# StarTrackerResult(quat=[-0.43977802991867065, -0.439766526222229, -0.4398997128009796, 0.6478340029716492], match_ids=[1435, 1272, 1140, 2035, 1070, 1438, 1338, 903, 260, 2141, 1771, 1727, 385, 1717, 2204, 2062, 1989, 1634, 708, 1357], n_matches=20, duration_s=0.0003700880042742938)

Installation

  • Install with pip install ruststartracker (Currently only ARM/x86 Linux wheels available).

Attributions

Gaia Data

This project includes data from the European Space Agency (ESA) mission Gaia, processed by the Gaia Data Processing and Analysis Consortium (DPAC). Funding for the DPAC has been provided by national institutions, in particular the institutions participating in the Gaia Multilateral Agreement.

Gaia DR3 data is © European Space Agency and is released under the Creative Commons Attribution 4.0 International License (CC BY 4.0).

Gaia Collaboration, Vallenari et al. (2022), A&A 674, A1. DOI: 10.1051/0004-6361/202243940

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ruststartracker-0.2.3.tar.gz (14.6 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

ruststartracker-0.2.3-cp312-cp312-manylinux_2_35_x86_64.whl (2.7 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.35+ x86-64

ruststartracker-0.2.3-cp312-cp312-manylinux_2_35_aarch64.whl (2.7 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.35+ ARM64

ruststartracker-0.2.3-cp311-cp311-manylinux_2_35_x86_64.whl (2.7 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.35+ x86-64

ruststartracker-0.2.3-cp311-cp311-manylinux_2_35_aarch64.whl (2.7 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.35+ ARM64

ruststartracker-0.2.3-cp310-cp310-manylinux_2_35_x86_64.whl (2.7 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.35+ x86-64

ruststartracker-0.2.3-cp310-cp310-manylinux_2_35_aarch64.whl (2.7 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.35+ ARM64

File details

Details for the file ruststartracker-0.2.3.tar.gz.

File metadata

  • Download URL: ruststartracker-0.2.3.tar.gz
  • Upload date:
  • Size: 14.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ruststartracker-0.2.3.tar.gz
Algorithm Hash digest
SHA256 e3281c3d999efe51da44c5ad5215a4b2b7201a1832b6b30d39a60c74cc4b612c
MD5 3b0d6996d7505d5afe9facf323787906
BLAKE2b-256 1d509fc5cf0f8d9a7b5024d9e1374a552ff8a41651912809fadc4dba0f5f7f82

See more details on using hashes here.

File details

Details for the file ruststartracker-0.2.3-cp312-cp312-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for ruststartracker-0.2.3-cp312-cp312-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 4fb7a868135c8a752b93eee205e73a326820323333ee5d4febe68bb333d660aa
MD5 a89f5b0c37f7682b72a0174442229627
BLAKE2b-256 669b1976f0f37b8ff92ded2d418ba03cad84945300a65dd93c8aaca83eb857e8

See more details on using hashes here.

File details

Details for the file ruststartracker-0.2.3-cp312-cp312-manylinux_2_35_aarch64.whl.

File metadata

File hashes

Hashes for ruststartracker-0.2.3-cp312-cp312-manylinux_2_35_aarch64.whl
Algorithm Hash digest
SHA256 cf1ae0df37786eb6f389f3581ea1f49f2620b5b5996b87014eb4c4b6c8d8249e
MD5 44caa9028c6099065283d88febaa89c1
BLAKE2b-256 5e1efe00335f02bc31e37a38d95f691b0b5983c100ff5e8f03814334d9fef62f

See more details on using hashes here.

File details

Details for the file ruststartracker-0.2.3-cp311-cp311-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for ruststartracker-0.2.3-cp311-cp311-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 bc5aac97fa62b8e44127e45c34871ecdeb5f8ea5c93166a132703be5154d7a30
MD5 9320353429915d42cb2d39109268401d
BLAKE2b-256 b548215a5b8eccf9f93f8e6c4b4751907546bb229da9092084b6cecf11f3ea43

See more details on using hashes here.

File details

Details for the file ruststartracker-0.2.3-cp311-cp311-manylinux_2_35_aarch64.whl.

File metadata

File hashes

Hashes for ruststartracker-0.2.3-cp311-cp311-manylinux_2_35_aarch64.whl
Algorithm Hash digest
SHA256 777283e4b37c0c72652994b79944abc4aec0ba799fe7db982184edbffef2d60f
MD5 5cd6e9c6758d3551ec27ee427ce554d8
BLAKE2b-256 315397b0b5b27b5b681716b494093960753e93b0ffb6166df93f24a45088ce96

See more details on using hashes here.

File details

Details for the file ruststartracker-0.2.3-cp310-cp310-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for ruststartracker-0.2.3-cp310-cp310-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 d2f15d0c11bf56f848b4886b66fae5358d563fab311c76ca2e63f84bfc2e0ca9
MD5 ae596f120305f64090bc15a4646be6f1
BLAKE2b-256 59f1ce1f998a1f69d0b5b90f2fef1da94bfad69968f2049dd1443545809f1ef7

See more details on using hashes here.

File details

Details for the file ruststartracker-0.2.3-cp310-cp310-manylinux_2_35_aarch64.whl.

File metadata

File hashes

Hashes for ruststartracker-0.2.3-cp310-cp310-manylinux_2_35_aarch64.whl
Algorithm Hash digest
SHA256 5e7ce4715ca84525a400a5834e3afebb34f6f16bbba88a21afb0ced08b4228a7
MD5 b1ef37e0ad29d81f69bec9f08e2b9c40
BLAKE2b-256 f6bec2120f623518ba14a41b07491dd7833e0a9651286160aa307cc0631c6c15

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page