Skip to content

Fix XML parser, geometry sampling, lane topology, and performance issues in ad_map_opendrive_reader - #263

Open
M-Colley wants to merge 2 commits into
carla-simulator:mainfrom
M-Colley:fix/opendrive-reader-bugs-and-perf
Open

M-Colley wants to merge 2 commits into
carla-simulator:mainfrom
M-Colley:fix/opendrive-reader-bugs-and-perf

Conversation

@M-Colley

@M-Colley M-Colley commented Nov 14, 2026 •

Copy link
Copy Markdown

Summary

Fixes XML attribute/element parsing bugs, geometry evaluation/sampling edge cases, lane contact topology defects, and quadratic/allocation hotspots in ad_map_opendrive_reader.

Note: Part 2 of 5 independent, modular PRs branched directly from main with strictly disjoint file sets (each builds, tests, and merges cleanly in any order).

Bug Fixes

  • XML Parsers (src/parser/*.cpp, ControllerParser.h, ObjectParser.h):
    • Fix copy-paste attribute reads and missing child element/attribute validations in LaneParser, ObjectParser, GeometryParser, GeoReferenceParser, JunctionParser, TrafficGroupParser, and TrafficSignalsParser.
    • Initialize POD fields in ControllerParser / ObjectParser structs and guard malformed numeric attributes.
  • Geometry & Sampling (Geometry.cpp, CenterLine.cpp, LaneSectionSampling.cpp, GeometryGenerator.cpp):
    • Fix arc/spiral/poly3/paramPoly3 evaluation and tangent heading math, guard zero-length roads/lane sections and invalid s clamping, and fix boundary sampling step logic so section endpoints are preserved without duplicate or out-of-range samples.
  • Lane Topology & Widths (LaneUtils.cpp, GeometryGenerator.cpp):
    • Fix lane contact linking, junction overlap/inversion handling, width profile bisection/interpolation bounds, and zero-width lane edge degeneration.

Performance Improvements

  • Replace repeated linear road/lane lookups and per-sample allocations with indexed lookups, reserve()d point buffers, and const & parameter passing across Geometry, CenterLine, GeometryGenerator, LaneSectionSampling, and LaneUtils.

This change is Reviewable

The build treats warnings as errors and enables -Wfloat-equal, so
comparing the `pj_inv` output with `HUGE_VAL` broke the build of
ad_map_opendrive_reader ("comparing floating-point with '==' or '!=' is
unsafe"). `pj_inv` signals an error with HUGE_VAL coordinates; checking
for finite values catches that case and also rejects NaN results, which
are not valid coordinates either.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch was successfully deployed

1 active (outdated) deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant