32 releases (20 breaking)

new 0.21.0 Mar 6, 2026
0.19.0 Jan 23, 2026
0.15.0 Dec 23, 2025
0.11.0 Nov 12, 2025
0.1.2 May 28, 2024

#9 in Simulation

Download history 2042/week @ 2025-11-14 4567/week @ 2025-11-21 4555/week @ 2025-11-28 8850/week @ 2025-12-05 13690/week @ 2025-12-12 7225/week @ 2025-12-19 1323/week @ 2025-12-26 13477/week @ 2026-01-02 11178/week @ 2026-01-09 9342/week @ 2026-01-16 10862/week @ 2026-01-23 11635/week @ 2026-01-30 11346/week @ 2026-02-06 4884/week @ 2026-02-13 5491/week @ 2026-02-20 4736/week @ 2026-02-27

28,945 downloads per month

BSD-3-Clause

405KB
6K SLoC

maliput

github crates.io docs.rs build status

Creates Rustacean API for maliput. It is implemented on top of maliput-sys package.

Note: What is maliput? Refer to https://maliput.readthedocs.org.

Description

maliput provides a Rust API implemented on top of FFI bindings provided by maliput-sys package.

Features

Backends are exposed as Cargo features:

Feature Default Description
maliput_malidrive OpenDRIVE (.xodr) backend
maliput_geopackage GeoPackage (.gpkg) backend
all Enables both backends

Only RoadNetworkBackend variants for enabled features are available. With default features, only MaliputMalidrive is compiled in.

# Default (maliput_malidrive only)
cargo build

# Both backends
cargo build --features all

# Only maliput_geopackage
cargo build --no-default-features --features maliput_geopackage

Usage

  use maliput::api::{RoadNetwork, RoadNetworkBackend};
  use std::collections::HashMap;

  fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Get location of odr resources
    let package_location = std::env::var("CARGO_MANIFEST_DIR").unwrap();
    let xodr_path = format!("{}/data/xodr/TShapeRoad.xodr", package_location);

    let road_network_properties = HashMap::from([
        ("road_geometry_id", "my_rg_from_rust"),
        ("opendrive_file", xodr_path.as_str()),
    ]);

    let road_network = RoadNetwork::new(RoadNetworkBackend::MaliputMalidrive, &road_network_properties)?;
    let road_geometry = road_network.road_geometry();

    // Exercise the RoadGeometry API.
    println!("linear_tolerance: {}", road_geometry.linear_tolerance());
    println!("angular_tolerance: {}", road_geometry.angular_tolerance());
    println!("num_junctions: {}", road_geometry.num_junctions());

    let lanes = road_geometry.get_lanes();
    println!("num_lanes: {}", lanes.len());
    println!("lanes: ");
    for lane in lanes {
        println!("\tlane id: {}", lane.id());
    }
    Ok(())
  }

Apps

  • maliput_query: A command-line tool for interactively querying a road network. It loads a road network using the available backends (depending on enabled features) and provides a set of commands to inspect its geometric properties and perform coordinate transformations.

    To run the application:

    cargo run --bin maliput_query -- <path_to_file>
    

    For example, using one of the provided XODR files (requires maliput_malidrive feature, enabled by default):

    cargo run --bin maliput_query -- data/xodr/TShapeRoad.xodr
    

Examples

  • Load maliput::api::RoadNetwork and perform some basic queries against the Road Geometry.
    cargo run --example 01_road_geometry
    

Benches

  • Evaluate the execution of maliput::api::RoadGeometry::to_road_position method.
    cargo bench to_road_position
    

License

Licensed under BSD 3-Clause.

Dependencies

~1.8–3.5MB
~57K SLoC