Skip to content

Add road_predecessor_id and road_successor_id properties to Waypoint Python API#9572

Draft
Copilot wants to merge 2 commits intoue4-devfrom
copilot/add-road-and-lane-info
Draft

Add road_predecessor_id and road_successor_id properties to Waypoint Python API#9572
Copilot wants to merge 2 commits intoue4-devfrom
copilot/add-road-and-lane-info

Conversation

Copy link

Copilot AI commented Mar 6, 2026

The Python API lacked access to OpenDRIVE road-level connectivity (predecessor/successor road IDs), forcing users to rely solely on waypoint-based navigation without the ability to query the underlying road graph structure.

Changes

  • LibCarla/source/carla/client/Waypoint.h/.cpp: Added GetRoadSuccessor() and GetRoadPredecessor() methods, delegating to the existing carla::road::Road::GetSuccessor/Predecessor() via the lane→road chain.
  • PythonAPI/carla/source/libcarla/Map.cpp: Exposed the new methods as road_predecessor_id and road_successor_id read-only properties on the Python Waypoint class.

Usage

waypoint = world.get_map().get_waypoint(vehicle.get_location())
print(waypoint.road_id)             # current road ID (already existed)
print(waypoint.road_predecessor_id) # OpenDRIVE predecessor road ID
print(waypoint.road_successor_id)   # OpenDRIVE successor road ID

Description

Exposes OpenDRIVE road predecessor/successor IDs to the Python API via two new Waypoint properties: road_predecessor_id and road_successor_id.

Where has this been tested?

  • Platform(s): Linux
  • Python version(s): N/A (C++ bridge only)
  • Unreal Engine version(s): UE4

Possible Drawbacks

None. Read-only accessors with no side effects, delegating to already-existing carla::road::Road methods.

Original prompt

This section details on the original issue you should resolve

<issue_title>How could I get Road infomation or Lane information from carla?</issue_title>
<issue_description><!--

Thanks for contributing to CARLA!

If you are reporting an issue, please use the following outline:

CARLA version:0.9.13
Platform/OS:Linux
Problem you have experienced:
I want to obtain road network, such as road information and lane information which are stored in .oxdr file.
For example, the predecessor or successor road id of current road.
However, According to the python API, it seems cannot do this. Since it uses Waypoint to organize road network.
What you expected to happen:
Steps to reproduce:
Other information (documentation you consulted, workarounds you tried):

If you are asking a question please make sure your question was not asked before
by searching among the existing issues and checking the CARLA forum https://github.com/carla-simulator/carla/discussions. Also make sure you have read ourdocumentation and FAQ at http://carla.readthedocs.io.

If your question is about creating content (assets, levels) you'll most likely
have all the info you need in the Unreal Engine's documentation
https://docs.unrealengine.com

Please, keep the threads focused and single-themed. Make them easy to find
for everyone.

-->

Thanks for contributing to CARLA!

If you are reporting an issue, please use the following outline:

CARLA version:0.9.13
Platform/OS:Linux
Problem you have experienced:
I want to obtain road network, such as road information and lane information which are stored in .oxdr file.
For example, the predecessor or successor road id of current road.
However, According to the python API, it seems cannot do this. Since it uses Waypoint to organize road network.</issue_description>

<agent_instructions>You can access map structure using;
https://github.com/carla-simulator/carla/blob/ue4-dev/LibCarla/source/carla/road/Map.h
Mainly in github, if he wants to access it in python he will need to add it to the bridge
</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.


This change is Reviewable

@update-docs
Copy link

update-docs bot commented Mar 6, 2026

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would update our CHANGELOG.md based on your changes.

…Python API

Co-authored-by: Blyron <53337103+Blyron@users.noreply.github.com>
Copilot AI changed the title [WIP] Add method to obtain road and lane information Add road_predecessor_id and road_successor_id properties to Waypoint Python API Mar 6, 2026
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.

2 participants