Skip to content

TraCI: add 3D lane and junction shape retrieval - #18440

Open
NearCai wants to merge 4 commits into
eclipse-sumo:mainfrom
NearCai:pr/shape3d
Open

NearCai wants to merge 4 commits into
eclipse-sumo:mainfrom
NearCai:pr/shape3d

Conversation

@NearCai

@NearCai NearCai commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Fixes #4391

Motivation

lane.getShape and junction.getShape only return 2D positions; elevation is
dropped even though the simulation model and the net file contain it.
junction.getPosition(..., includeZ=True) already exists, but there was no way
to retrieve the 3D shape of a lane or junction.

Implementation

  • Add the POLYGON_3D (0x05) wire type and VAR_SHAPE3D (0x3f) variable.
  • Write and read three doubles per point for VAR_SHAPE3D; keep VAR_SHAPE 2D.
  • Support the new variable in libsumo and libtraci, including subscriptions.
  • Add lane.getShape3D, junction.getShape3D and the convenience alias
    junction.getPosition3D to the Python client.
  • Document the new protocol type and value retrieval APIs.
  • Add a complex test with a net that has elevation.

Because the change only adds a new variable and does not alter existing
payloads, TRACI_VERSION is not bumped. Old clients keep getting 2D shapes;
old servers will report VAR_SHAPE3D as unknown instead of silently returning
2D data.

Verification

The new complex test tests/complex/traci/misc/shape3D checks the 2D and 3D
lane/junction shapes, the getPosition3D alias, and a VAR_SHAPE3D
subscription. Existing 2D retrieval (including simulation.getNetBoundary)
still returns 2-tuples.

Fixes eclipse-sumo#4391.
Add POLYGON_3D (0x05) and VAR_SHAPE3D (0x3f), expose lane.getShape3D
and junction.getShape3D (plus junction.getPosition3D), and keep the
existing VAR_SHAPE payload unchanged.
Copilot AI balanced review requested due to automatic review settings October 27, 2026 15:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@behrisch

Copy link
Copy Markdown
Contributor

@NearCai Thanks for that one! Can you try to make your commits always under your "real" email address? If the commit shows something like @users.noreply.github.com the eclipse validation will fail

@NearCai

NearCai commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

Thanks! I rewrote the commit author/committer address to my real email (2094657017@qq.com) and force-pushed the branch; the PR commit now uses it. I will use this address for all future commits.

behrisch and others added 2 commits October 28, 2026 21:49
Refs eclipse-sumo#4391. The subscription test discovers public getters by
introspection; getShape3D now registers a VAR_SHAPE3D subscription.
Update the expected outputs for the traci, libsumo and libtraci runs.
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.

allow more 3D position retrieval

3 participants