This project has been archived by its maintainers, and is no longer receiving any updates.
trajax
Primary repository: gitlab.com/risk-metrics/trajax — the GitHub mirror exists for Colab notebook support.
Sampling-based trajectory planning for autonomous systems. Provides composable building blocks — dynamics models, cost functions, samplers, and risk metrics — so you can assemble a complete MPPI planner in a few lines and iterate on the parts that matter for your problem.
Installation
pip install trajax # NumPy + JAX (CPU)
pip install trajax[cuda] # JAX with GPU support (Linux)
Requires Python ≥ 3.13.
Quick Start
MPPI planner with MPCC (Model Predictive Contouring Control) for path tracking, using a kinematic bicycle model:
from trajax.numpy import mppi, model, sampler, trajectory, types, extract
from numtypes import array
def position(states):
return types.positions(x=states.positions.x(), y=states.positions.y())
reference = trajectory.waypoints(
points=array([[0, 0], [10, 0], [20, 5], [30, 5]], shape=(4, 2)),
path_length=35.0,
)
planner, augmented_model, _, _ = mppi.mpcc(
model=model.bicycle.dynamical(
time_step_size=0.1, wheelbase=2.5,
speed_limits=(0.0, 15.0), steering_limits=(-0.5, 0.5),
acceleration_limits=(-3.0, 3.0),
),
sampler=sampler.gaussian(
standard_deviation=array([0.5, 0.2], shape=(2,)),
rollout_count=256,
to_batch=types.bicycle.control_input_batch.create, seed=42,
),
reference=reference,
position_extractor=extract.from_physical(position),
config={
"weights": {"contouring": 50.0, "lag": 100.0, "progress": 1000.0},
"virtual": {"velocity_limits": (0.0, 15.0)},
},
)
state = types.augmented.state.of(
physical=types.bicycle.state.create(x=0.0, y=0.0, heading=0.0, speed=0.0),
virtual=types.simple.state.zeroes(dimension=1),
)
nominal = types.augmented.control_input_sequence.of(
physical=types.bicycle.control_input_sequence.zeroes(horizon=30),
virtual=types.simple.control_input_sequence.zeroes(horizon=30, dimension=1),
)
for _ in range(200):
control = planner.step(temperature=50.0, nominal_input=nominal, initial_state=state)
state = augmented_model.step(inputs=control.optimal, state=state)
nominal = control.nominal
To use JAX (GPU), change from trajax.numpy to from trajax.jax. The API is identical.
Features
See the feature overview for the full list of supported components, backend coverage, and roadmap.
Documentation
| Getting Started | Installation, first planner, simulation loop |
| User Guide | MPPI concepts, cost design, obstacles, boundaries, risk metrics |
| Examples | Interactive visualizations of MPCC scenarios |
| API Reference | Factory functions and protocol documentation |
Contributing
See CONTRIBUTING.md.
License
MIT — see LICENSE.
Release files for trajax 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| trajax-0.2.2.tar.gz | 165.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| trajax-0.2.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 377.4 kB
Release files / trajax-0.2.2.tar.gz
| Download URL | trajax-0.2.2.tar.gz |
|---|---|
| Size | 165.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f891765afc82d73a19499d559b43cb710e4dc881623413aba2b37a1a3b40f41a
|
|
BLAKE2b-256 checksum How to use checksums |
08012fe511875b99975ac3b22d2d68789d4109d5e8e4dda9f7ad8e0508754058
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / trajax-0.2.2-py3-none-any.whl
| Download URL | trajax-0.2.2-py3-none-any.whl |
|---|---|
| Size | 211.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7ab328aa16f9aa885a7655382d9d4a99765b5f643fc1d828ae7393a9f5ce7d57
|
|
BLAKE2b-256 checksum How to use checksums |
2419d5ac6c7030ae71b940f9b033c7dd571bad37c1e9e2acc374aecb6eaa383c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|