Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:CARLA simulator Carla OpenDriveParser

From Leeroopedia
Knowledge Sources
Domains Road Network, Map Parsing
Last Updated 2026-02-15 05:00 GMT

Overview

The OpenDriveParser class provides a single static method to parse an OpenDRIVE XML string and produce a complete road network Map object.

Description

carla::opendrive::OpenDriveParser contains the Load() static method which orchestrates the full OpenDRIVE parsing pipeline:

1. Parses the XML string using pugixml 2. Creates a MapBuilder instance 3. Invokes 10 specialized sub-parsers in sequence:

    • GeoReferenceParser -- coordinate system reference
    • RoadParser -- road structure and attributes
    • JunctionParser -- junction definitions
    • GeometryParser -- road geometry (lines, arcs, spirals, polynomials)
    • LaneParser -- lane definitions and widths
    • ProfilesParser -- elevation and superelevation profiles
    • TrafficGroupParser -- traffic group definitions
    • SignalParser -- traffic signals and signs
    • ObjectParser -- road objects
    • ControllerParser -- signal controllers

4. Calls map_builder.Build() to produce the final road::Map

Returns std::optional<road::Map> which is empty if XML parsing fails.

Usage

Use this class as the entry point for converting an OpenDRIVE XML string (typically received from the CARLA server) into a queryable road network Map.

Code Reference

Source Location

  • Repository: CARLA
  • File: LibCarla/source/carla/opendrive/OpenDriveParser.cpp

Signature

class OpenDriveParser {
public:
  static std::optional<road::Map> Load(const std::string &opendrive);
};

Import

#include "carla/opendrive/OpenDriveParser.h"

I/O Contract

Input Type Description
const std::string & | OpenDRIVE XML content as a string
Output Type Description
std::optional<road::Map> | Parsed road network map, or empty on parse failure

Usage Examples

std::string opendrive_xml = client.GetMap()->GetOpenDrive();
auto map = carla::opendrive::OpenDriveParser::Load(opendrive_xml);
if (map) {
  auto waypoints = map->GenerateWaypoints(2.0);
}

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment