Crates.io | maliput |
lib.rs | maliput |
version | 0.1.3 |
source | src |
created_at | 2024-04-08 22:04:16.949359 |
updated_at | 2024-11-04 21:31:52.070907 |
description | Rust API for maliput |
homepage | |
repository | https://github.com/maliput/maliput-rs |
max_upload_size | |
id | 1201534 |
size | 748,669 |
Creates Rustacean API for maliput.
It is implemented on top of maliput-sys
package.
Note: What is maliput? Refer to https://maliput.readthedocs.org.
maliput
provides a Rust API implemented on top of FFI bindings provided by maliput-sys
package.
fn main() {
use maliput::api::RoadNetwork;
use std::collections::HashMap;
// 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("maliput_malidrive", &road_network_properties);
let road_geometry = road_network.road_geometry();
// Excercise 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());
}
}
maliput::api::RoadNetwork
and perform some basic queries against the Road Geometry.
cargo run --example road_geometry
maliput::api::RoadGeometry::to_road_position
method.
cargo bench to_road_position
Licensed under BSD 3-Clause.