Skip to main content

A library providing performant NumPy & JAX implementations of an MPPI planner, along with implementation of related algorithms/tools.

Project description

faran

Primary repository: gitlab.com/risk-metrics/faran — the GitHub mirror exists for Colab notebook support.

Pipeline Status Coverage Benchmarks PyPI Python License

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 faran          # NumPy + JAX (CPU)
pip install faran[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 faran.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 faran.numpy to from faran.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.

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

faran-0.2.3.tar.gz (175.3 kB view details)

Uploaded Source

Built Distribution

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

faran-0.2.3-py3-none-any.whl (211.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: faran-0.2.3.tar.gz
  • Upload date:
  • Size: 175.3 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for faran-0.2.3.tar.gz
Algorithm Hash digest
SHA256 417f64c48390217a29f5e1352288e592392992c85f51f8db39cdb6563c82aee9
MD5 feb06078c75df0e3171f4c10515a1b84
BLAKE2b-256 4e37007c07e3528a740a19304cab8751a49a78ec5b49a8c70cd1dc14ce50e1d3

See more details on using hashes here.

File details

Details for the file faran-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: faran-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 211.2 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for faran-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ce9fdc4898694e97acc114569511f166238ed47ccfe6ea66d5d40fad3af7c21d
MD5 ad31b1ce0b7f3614226076146b78716a
BLAKE2b-256 1831a1c72e2bab8a75ab375dbfabf9be0d5721c51d45328ea40649f0e3560424

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