Skip to content

OpenDRIVE import: support <object>/<repeat> placement - #94

Merged
kosuke55 merged 3 commits into
mainfrom
feat/opendrive-object-repeat
Aug 2, 2026
Merged

OpenDRIVE import: support <object>/<repeat> placement#94
kosuke55 merged 3 commits into
mainfrom
feat/opendrive-object-repeat

Conversation

@kosuke55

@kosuke55 kosuke55 commented Aug 2, 2026

Copy link
Copy Markdown
Owner

Summary

Parse <object>/<repeat> records and place repeated object instances along the road reference line, per ASAM OpenDRIVE 1.8 搂13.2 (validated against esmini's RMObject::GetRepeatInstances as the authoritative reference).

  • Attributes: s, length, distance, tStart/tEnd, zOffsetStart/End, widthStart/End, lengthStart/End, heightStart/End
  • distance > 0: instances every distance metres with linear start鈫抏nd interpolation of t / dimensions; heading includes the repeat-line tilt atan2(tEnd鈭抰Start, length)
  • distance = 0: single continuous swept footprint (no instancing)
  • Outlines: cornerLocal scaled and re-framed per instance; cornerRoad re-based to each instance station; plain objects fall back to an oriented rectangle
  • Road-end guard matches esmini (truncate when curS + instLen > road length)

Previously, objects declaring their lateral offset only via <repeat tStart/tEnd> (e.g. parking rows without <outlines>) collapsed onto the road centreline.

Not covered (follow-ups)

radiusStart/End interpolation for circular objects; exact curvature-following re-evaluation for cornerRoad outlines (approximated by station re-basing).

Tests

  • New: two parking rows (卤12.7 m separation, distance=2.5, 5 instances each), continuous repeat (distance=0)
  • Updated parking_demo fixtures: 62 polygons after expansion; objects 11/12 centroids 25.400 m apart
  • Fail-first verified (without the change, both rows collapse to t=0); full suite 305 passed / 4 skipped; tsc build clean

Add an OdrObjectRepeat type and parse every <repeat> child of an <object>
into it (s, length, distance, tStart/tEnd, zOffsetStart/End, and optional
width/length/height start/end). Optional start/end dimensions use a new
optNumAttr helper so 'attribute present' stays distinct from a zero value.
Re-exported from the exporter entry point.
odrToShapes now expands an object's <repeat> into discrete instances instead
of drawing a single footprint at the object's own t. Each instance's (s, t),
footprint length/width, and repeat-line heading tilt are interpolated from the
start values to the end values across the span, spaced by distance; instances
that would run past the road end are dropped. distance=0 (a continuous object)
collapses to one footprint at the span start. cornerLocal outlines are scaled
and re-placed per instance; cornerRoad outlines are re-based to each instance
station; objects without an outline fall back to the oriented-rectangle
footprint. Placement mirrors the ASAM OpenDRIVE 1.8 repeat model.
Add unit fixtures for two repeat rows offset to opposite sides (tStart=tEnd
=-12.7 / +12.7) and for a continuous distance=0 object, asserting instance
count, per-row spacing, and lateral separation. Update the parking_demo
fixture expectations for the now-expanded polygon count and assert the two
opposite rows land 25.4 m apart (they previously overlapped at the centre).
@kosuke55
kosuke55 merged commit f6a5bfd into main Aug 2, 2026
2 checks passed
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