xodr
A pure-Rust OpenDRIVE (.xodr) importer. It turns a map into lanes, a lane
graph, and a mesh of the road surface. It also reads the OpenCRG (.crg)
files a map uses.
use ;
let net = load_file?;
// Where is the road under this point, and which way does it lean?
let sample = net.sample_near.expect;
println!;
// Where is that on its road, in OpenDRIVE's own s and t?
let at = net.road_position.expect;
println!;
// Drive somewhere.
let waypoints = net.route;
// Hand the surface to a collider or a renderer.
let mesh = net.surface_mesh;
mesh.validate?;
What it builds
Test maps in the viewer. Click a picture for details.
What it reads
Every element and attribute of the OpenDRIVE 1.9 schema. Of its 671 rows, 420 shape the network and 251 are kept as data. It also reads the crossfall of OpenDRIVE 1.4. docs/support.md says what it does with each element.
From that it builds:
- roads you can query in
(road, s, t)or(lane, s, offset), both ways; - lanes with widths, heights and layers, and a lane graph through default, direct and virtual junctions;
- speed limits from speed records, signs and default regulations;
- objects, signals and road marks, placed on the road;
- the road surface under a wheel, from elevation, shape and OpenCRG.
It loads any OpenDRIVE version. Provenance::warnings lists what it dropped,
what it ignores, and features newer than the header's version.
Warning::is_ignored tells ignored features from faults.
Viewer
The crate draws nothing. viewer/ is a three.js page that
runs the crate as WebAssembly. Open a .xodr and hover anything to see what
the crate knows about it.

OpenUSD
usd/ exports a map as an OpenUSD stage. It's a separate
tool, not part of the crate.
How it fits together
More
- docs/design.md: coordinates, mesh buffers,
serde, bad input, timings. - docs/support.md: what the crate does with each element.
- docs/comparison.md: each 1.9 element in this crate, esmini, libOpenDRIVE and CARLA.
- CHANGELOG.md
The published crate has no tests or maps. Run them from a git checkout.
MSRV is 1.85.
License
MIT or Apache-2.0, at your option.







