Skip to main content

gri-trajectory

Platform and emitter motion models for geolocation simulation. A trajectory defines how an entity moves through space over time; all trajectories implement a common Trajectory protocol providing position, velocity, and combined state queries at any time instant.

This package was factored out of gri-geosim so the motion models can be reused without pulling in the full simulation stack (it depends only on gri-nsepoch, gri-pos, and gri-utils, plus numpy/scipy/sgp4).

Documentation

The wheel ships its documentation inside the package, in gri_trajectory/docs/, so it is available wherever the package is installed:

  • overview.md -- the protocol, each trajectory, legs, and traps
  • api_summary.md -- every public class, method, and signature (generated)

Print the directory with python -c "import gri_trajectory, pathlib; print(pathlib.Path(gri_trajectory.__file__).parent / 'docs')". Every example in those files is run by the test suite.

Install

uv add gri-trajectory

Import and use

from gri_trajectory import StationaryTrajectory, Sgp4Trajectory, WaypointTrajectory
from gri_pos import Pos

traj = StationaryTrajectory(Pos.LLA(38.0, -77.0, 100.0))
pos = traj.position_at(dt)      # dt: seconds from traj.epoch_unix_s
vel = traj.velocity_at(dt)      # [0, 0, 0]

Available trajectories

Trajectory Description
StationaryTrajectory Fixed position, zero velocity
LinearTrajectory Constant ECEF velocity from an initial Vel
CoordinatedTurnTrajectory Constant-rate level/climbing turn (local ENU tangent)
GreatCircleTrajectory Great-circle motion fixed in ECEF (aircraft, vehicles)
CircularOrbitTrajectory Circular orbit fixed in ECI (satellite approximation)
KeplerianTrajectory Two-body orbital mechanics (gri-utils backend)
Sgp4Trajectory SGP4/SDP4 TLE propagation (python-sgp4 backend)
WaypointTrajectory Interpolated path through waypoints (linear or cubic spline)
HermiteTrajectory Hermite spline interpolation through state vectors
SegmentedTrajectory Piecewise composition of sub-trajectories (C0-continuous)

Composing segmented paths

The legs submodule builds a SegmentedTrajectory from kinematic primitives (Straight, Turn, Climb, Hold):

from gri_trajectory import SegmentedTrajectory
from gri_trajectory.legs import Straight, Turn
from gri_pos import Vel

start = Vel.LLA(38.0, -77.0, 0.0, 10.0, 0.0, 0.0)   # east at 10 m/s
racetrack = SegmentedTrajectory.from_legs(
    start,
    [Straight(20.0), Turn(180.0, radius_m=50.0),
     Straight(20.0), Turn(180.0, radius_m=50.0)],
)

The placement submodule provides builders for positioning a point over a ground origin by look angle (sky_point, by slant range or target altitude) -- compose with the orbit constructors for an overhead collector.

Trajectory protocol

epoch_unix_s: float                                   # absolute time of dt = 0
def position_at(dt: float = 0.0) -> Pos
def velocity_at(dt: float = 0.0) -> NDArray[np.floating]   # shape (3,), ECEF m/s
def state_at(dt: float = 0.0) -> Vel                  # position and velocity

dt is seconds relative to the trajectory's own epoch_unix_s, not an absolute time: convert with dt = unix_s - traj.epoch_unix_s. state_at() returns both in one call, which is cheaper than separate queries for some trajectory types.

Notes

  • All positions are ECEF (XYZ) in meters; velocities are ECEF m/s, shape (3,).
  • Sgp4Trajectory converts TEME to ECEF internally.
  • KeplerianTrajectory is a two-body approximation (no J2, drag, or third-body); for high fidelity use Sgp4Trajectory with real TLE data.
  • Downstream, gri-geosim's Platform and Emitter accept a Pos directly and wrap it in a StationaryTrajectory internally.

License

MIT -- see LICENSE.

Release files for gri-trajectory 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gri-trajectory 0.1.2
File Size Uploaded
gri_trajectory-0.1.2.tar.gz 56.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gri-trajectory 0.1.2
File Interpreter ABI Platform
gri_trajectory-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 103.2 kB

Release files / gri_trajectory-0.1.2.tar.gz

Download URL gri_trajectory-0.1.2.tar.gz
Size 56.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c019cbbb622e21a765a2eec98f3b9b088bd9cdeef30f89effdb27401bdcb868d
BLAKE2b-256 checksum
How to use checksums
8b1366c7b8e025fb8da4161e22ca08abc977d04c2b6752fb19417135339e1755
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / gri_trajectory-0.1.2-py3-none-any.whl

Download URL gri_trajectory-0.1.2-py3-none-any.whl
Size 46.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9aa7808e3120d2ea4270c7f4b6e78ec323f1b3c6e96807a668ff8f6651cfbcc0
BLAKE2b-256 checksum
How to use checksums
42b9c25fbdf6ea33ded3cdcfb843d849f429dea6b08aea78de264fb3c0e67083
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page