tpt-system-zero

Rust

First-principles spacecraft navigation & control library in Rust — orbital mechanics, J2-J4 perturbations, Extended Kalman Filter, multi-object tracking, Lambert trajectory solver & autonomous flight control.

0 stars0 forks0 watchersApache License 2.0
astrodynamicskalman-filternavigationopen-sourceorbital-mechanicsrustsimulationspacespacecrafttrajectory-optimization

Languages

Rust99.8%Dockerfile0.2%
README

TPT System Zero

A comprehensive first principles system for autonomous space navigation, tracking, and control.

Overview

TPT (Tracking, Propulsion, Trajectory) System Zero provides a complete stack for spacecraft autonomy, built from fundamental physics laws without reliance on external simulation suites. From orbital mechanics to sensor fusion, it enables end-to-end mission design.

Features

Core Dynamics

  • Newtonian gravity, J2–J4 perturbations, atmospheric drag, solar radiation pressure
  • Runge–Kutta integration with multi-body ephemerides
  • Support for controlled propulsion and disturbances

Estimation and Tracking

  • Multi-object Extended Kalman Filter (EKF) with full covariance propagation
  • Probabilistic Data Association (PDA) for measurement assignment
  • Conjunction assessment for collision avoidance
  • Scalable to 10,000+ space objects (via propagate_multiple_rk4)

Navigation and Control

  • Attitude control via quaternion kinematics (3-axis stabilization)
  • Optimal trajectory planning (Lambert problem, patched conics)
  • Fuel optimization (Tsiolkovsky with gimbal constraints)
  • Autonomous guidance: liftoff, interplanetary, landing, docking

Modules

The workspace is a Cargo workspace of eight crates, all published under the tpt-system-zero-* namespace. Rust imports use the underscore form (tpt_system_zero_dynamics, …).

  • tpt-system-zero-dynamics — orbital propagation and perturbations
  • tpt-system-zero-estimation — Kalman filtering and multi-object tracking
  • tpt-system-zero-navigation — guidance, control, trajectory optimization
  • tpt-system-zero-sensors — radar/optical/GPS models and fusion
  • tpt-system-zero-systems — integrated spacecraft subsystems
  • tpt-system-zero-simulation — mission simulation, Monte Carlo, scenario runner
  • tpt-system-zero-data — catalog, TLE, logging, telemetry
  • tpt-system-zero-safety — uncertainty, redundancy, verification

Getting Started

Installation

cd tpt-system-zero
cargo build --release

Example: Orbital Demonstration

use tpt_system_zero_dynamics::{StateVector, propagate_rk4, EARTH_MU, EARTH_RADIUS_EQUATOR};

// Create a circular LEO state from the local circular speed.
let altitude = 400.0e3; // 400 km
let radius = EARTH_RADIUS_EQUATOR + altitude;
let speed = (EARTH_MU / radius).sqrt();
let initial = StateVector::new(radius, 0.0, 0.0, 0.0, speed, 0.0);

let trajectory = propagate_rk4(initial, 10.0, 540, EARTH_MU);
println!("Trajectory points: {}", trajectory.len());

Multi-Object Tracking

use tpt_math_linalg_fixed::Vector6;
use tpt_system_zero_dynamics::{EARTH_MU, EARTH_RADIUS_EQUATOR, StateVector};
use tpt_system_zero_estimation::{Covariance, Measurement, TrackManager};

fn diagonal(v: f64) -> Covariance {
    Covariance::from_fn(|i, j| if i == j { v } else { 0.0 })
}

let mu = EARTH_MU;
let r = EARTH_RADIUS_EQUATOR + 500.0e3;
let speed = (mu / r).sqrt();

// Initialise a track a small distance from the truth.
let init = Vector6::new([r + 1000.0, 0.0, 0.0, 0.0, speed * 0.92, 0.0]);
let mut manager = TrackManager::new(5);
manager.init_track(init, diagonal(1.0e6), diagonal(1.0), 1.0e4, 1.0);

// Feed range/range-rate measurements (see examples/tracking.rs and
// tests/integration.rs for the full propagate → sense → track loop).
let meas = Measurement {
    time: 1.0,
    range: r,
    range_rate: 0.0,
    measurement_noise_range: 1.0e4,
    measurement_noise_rate: 1.0,
};
manager.predict_tracks(1.0, mu);
manager.update_tracks(&[meas]);

// Assess conjunctions once tracks are populated.
let _hits = manager.detect_conjunctions(1.0);

Config-Driven Scenarios

use tpt_system_zero_simulation::scenario::{Scenario, ObjectSpec, SensorSpec};

// Scenarios can also be loaded from JSON via `Scenario::from_json(...)`.
let scenario = Scenario {
    dt_sec: 1.0,
    duration_sec: 200.0,
    conjunction_radius_m: 100_000.0,
    sensor: SensorSpec { range_noise_m: 100.0, rate_noise_ms: 1.0 },
    ..Default::default()
};
// (populate `scenario.objects` with `ObjectSpec { .. }` Keplerian elements)
let _report = scenario.run();

API Reference

Core Dynamics (tpt_system_zero_dynamics)

  • StateVector::new(px, py, pz, vx, vy, vz) — ECI state (m, m/s)
  • propagate_rk4(initial, dt, steps, mu) — RK4 orbital simulation
  • propagate_rk4_opts(initial, dt, steps, mu, &PropagationOptions) — with perturbations
  • propagate_multiple_rk4(...) — parallel batch propagation (Rayon)
  • gravitational_acceleration(), j2_acceleration(), zonal_harmonics_j3_j4()
  • atmospheric_drag(), solar_radiation_pressure()
  • Constants: EARTH_MU, EARTH_RADIUS_EQUATOR, EARTH_J2, AU, SUN_MU, …

Estimation & Tracking (tpt_system_zero_estimation)

  • Ekf — 6-state range/range-rate Extended Kalman Filter
  • TrackManager — multi-object PDA tracking (init_track, predict_tracks, update_tracks)
  • Measurement { time, range, range_rate, measurement_noise_range, measurement_noise_rate }
  • conjunction_probability(track1, track2, combined_radius) — bounded [0,1]
  • detect_conjunctions(threshold)

Navigation & Control (tpt_system_zero_navigation)

  • PidController::new(kp, ki, kd) and .compute(error, dt)
  • AttitudeController — quaternion PD stabilization
  • hohmann_transfer_delta_v(r1, r2, mu) — (departure, arrival) burns
  • lambert_solver(r1, r2, tof, mu, long_way) — optimal transfer velocities
  • optimize_delta_v(mass, exhaust_v, target_dv, gimbal_loss)
  • gravity_turn_pitch(), powered_descent_acceleration(), docking_approach_velocity()

Sensors & Fusion (tpt_system_zero_sensors)

  • Radar::measure(...), OpticalTelescope::measure(...), GPSReceiver::measure(...)
  • SensorMeasurement with add_noise() (Gaussian + outliers on every channel)
  • SensorFusion::update(...) — complementary LOS fusion

Systems & Simulation (tpt_system_zero_systems, tpt_system_zero_simulation)

  • Spacecraft::new() — integrated ADCS / propulsion / power / thermal / comms / faults
  • MissionSimulator — stepwise lifecycle simulation with abort conditions
  • MonteCarloRunner — uncertainty propagation over repeated missions
  • ConstellationManager — multi-spacecraft coordination
  • scenario::Scenario — config-driven propagate → sense → track → conjunction runner

Data & Safety (tpt_system_zero_data, tpt_system_zero_safety)

  • state_to_keplerian(pos, vel, mu), keplerian_to_state(&elements, mu) (round-trips)
  • generate_tle(&elements, id) — simplified TLE subset
  • CatalogDb — SQLite catalog persistence
  • verify_altitude(), verify_velocity() — fallible safety contracts
  • SafetyMonitor, mc_uncertainty(...) — keep-out zones & Monte Carlo error bars

Architecture Diagram

[User/Sensors] --> [Dyn: Propagation] --> [Est: Filtering] --> [Nav: Control]
      ↓               ↓                        ↓                  ↓
[Sim: Monte Carlo] <-- [+ perturb]          [+ EKF]           [+ PID]
      ↓               ↓                        ↓                  ↓
[Data: TLE Export] <-- [Fuse Sensors] <-- [ safety_monitors ] --/
      ↓
[API: Telemetry] <-- [Logs/Replay] <-- [Fault Detect]

Status & Scope

The core physics, estimation, navigation, sensors, and simulation crates are implemented and tested (see tests/integration.rs and examples/). The following are planned / experimental, not production features:

  • GPU acceleration — dense-matrix compute-shader framework is a placeholder.
  • Distributed processing — Kubernetes/containerized scaling exists only as design notes.
  • CCSDS / full TLEgenerate_tle emits a simplified TLE subset; validate_tle_orbit (SGP4 comparison) is intentionally unimplemented and returns SafetyError::NotImplemented.

User Guides

Configuration

  • Edit Cargo.toml for feature flags (e.g., enable perturbations).
  • cargo build --release for an optimized binary.
  • Docker: docker build . -t tpt-system-zero

Mission Planning

  1. Define objects by Keplerian elements (see examples/scenarios/*.json).
  2. Run Scenario::from_json and Scenario::run for a full pipeline.
  3. Monitor conjunctions via TrackManager::detect_conjunctions.

Ready-to-use scenario templates live in examples/scenarios/:

  • leo_conjunction.json — two LEO objects screened for collision.
  • transfer_observation.json — LEO chaser vs. higher-altitude target.
  • rendezvous.json — close-proximity station/visitor pairing.

Each template is validated by tests/scenario_templates.rs, which parses the file, runs the full propagate → sense → track → conjunction pipeline, and asserts the tracks converge.

Examples

Runnable, compiling examples live in examples/:

  • leo_propagation.rs — circular LEO drift over ~90 min
  • hohmann.rs — LEO→GEO Hohmann and a Lambert arc
  • tracking.rs — single-object EKF/PDA tracking from range/range-rate
  • monte_carlo.rs — Monte Carlo mission campaign
  • scenario.rs — config-driven multi-object scenario

Philosophy

Built entirely from first principles:

  • Newton's laws for dynamics
  • Statistical filtering for estimation
  • Optimal control theory for navigation

No dependencies on legacy orbit catalogs or proprietary tools.

Contributing

See todo.md for the development roadmap. PRs welcome for enhancements.

License

Licensed under either of

at your option.