Exporting to OpenDRIVE

RoadRunner can export scenes to the OpenDRIVE® (.xodr) file format.

OpenDRIVE Overview

RoadRunner can export scenes to the OpenDRIVE® 1.4 format. The OpenDRIVE export option exports an OpenDRIVE (.xodr) file containing the layout of the scene and an optional MathWorks GeoJSON file.

Export to OpenDRIVE

From the menu, select File > Export > OpenDRIVE (.xodr).

To preview the OpenDRIVE export and explore exported data interactively, use the OpenDRIVE Export Preview Tool

Export Options

The OpenDRIVE export dialog box has several options to conform to various simulator needs.

Attribute Description
Database Version A user-defined identifier for the exported scene. Useful for versioning exports of the same scene.
Database Name (optional) A user-defined name for the exported scene.
Driving Side

A hint to the exporter for the driving side of the scene. Travel direction is explicitly defined in RoadRunner using the Lane Travel Direction.

The travel direction in OpenDRIVE is implicit based on the country and side of the road.

Export individual markings as <line> Export additional lane marking data (spacing, dash length, and individual paint strip widths).
Export signals

When this attribute is selected, all signals and signs mapped to junctions are exported as <signal> entries.

This selection applies only to signals and signs that have been associated with junctions (using the Signal Tool). Refer to the Traffic Signals and Signs section.

Export props When this attribute is selected, props are exported as <object> entries. Refer to the Props section.
Clamp distances

When this attribute is selected, the RoadRunner scene clamps distances to be a multiple of 1 cm to prevent very short roads.

Note: This clamping is performed on the scene itself, so it can cause very small changes to the roads in the scene.

Export Auxiliary Data

Exports a MathWorks GeoJSON file along with the exported OpenDRIVE file. For more details, see Exporting to GeoJSON.

OpenDRIVE Representations

This section describes how various types of RoadRunner objects are represented in OpenDRIVE.

Roads, Lanes, and Junctions

Roads, lanes, and junctions are exported to OpenDRIVE using the standard <road>, <lane>, and <junction> entries.

For each road in a scene, RoadRunner creates one or more <road> entries. Whenever a road ends or a junction begins or ends, RoadRunner creates a unique <road> entry. OpenDRIVE <road> entries cannot extend through a junction, so the geometry is cut and exported as separate roads.

Note: The <shape>, <crossfall>, <surface>, and <railroad> entries are not used.

For each lane in a scene, RoadRunner creates one or more <lane> entries. The resulting <lane> entry is placed on one side or the other of the center lane, depending on its travel direction or the travel direction of neighboring lanes and the selected Driving Side during export. Whenever a lane starts or ends, RoadRunner creates a new <laneSection> entry.

Note: The "level" flag in <lane> entries is not used. The <height>, <material>, <visibility>, and <access> entries are also not used.

For each junction in a scene, RoadRunner creates a <junction> entry. RoadRunner exports some junctions as one <junction> entry due to overlapping maneuver roads or corners. A connecting <road> entry is exported for each maneuver road in each junction. Where possible, the exporter prefers the geometry and lane markings of nonmaneuver roads that extend through the junction. The resulting geometry of each connecting road might be the combination of multiple maneuver and nonmaneuver roads.

Note: The <priority> entry is not used.

Props

Note: Prop polygons are not exported, but if you run the 'bake' operation to convert them to points, you can export them in point format.

With the exception of traffic signals and signs (see below), point props are exported as OpenDRIVE <object> instances. The exported prop includes sufficient information to identify the prop type and the oriented bounding box (OBB) of the prop model.

In OpenDRIVE, objects are stored on roads. The position and orientation of a given object depends on the geometry of the road it is assigned to. RoadRunner props are freely positioned in the world, so the export process must choose a road for each prop to export. In most cases, RoadRunner selects the road closest to the prop.

Note: In some cases, it is impossible to represent a prop's position in OpenDRIVE. In this image, the bush on the right is past the end of the road and there is no other road in the scene. In this case, the prop is not exported and a warning is displayed during export.

Prop Attributes

Exported props include the following attributes:

OpenDRIVE Attribute Description
name Name of the prop asset (for example, "Signal_Post_30ft")
s/t Inertial position of the prop point
hdg/roll/pitch Inertial rotations of the prop point
zOffset Relative height of the prop point
height/width/length Dimensions of the prop model's bounding box
type Object type, as defined by the configuration XML file for the point's asset (refer to OpenDRIVE User Asset Configuration)

Crosswalks and Marking Polygons

Crosswalks and marking polygons are exported as OpenDRIVE <outline> objects, similar to the crosswalk example in section 7.4 of the OpenDRIVE 1.5M specification.

Unlike that example, RoadRunner exports the polygon vertices as <cornerLocal> objects (rather than <cornerRoad> objects), which means that the vertices are defined relative to the pivot point specified in the attributes of the <object> parent.

This example code shows the representation of the crosswalk polygon in the previous image.

<object id="162" name="ContinentalCrosswalk" s="5.9095723267801631e+1" t="1.7834630409170869e+0" zOffset="1.9073486328125000e-6" hdg="1.3359605073928833e+0" roll="0.0000000000000000e+0" pitch="0.0000000000000000e+0" orientation="-" type="crosswalk" width="2.9256307177817877e+0" length="1.6163854233175169e+1">
    <outline>
        <cornerLocal u="-8.0157129245630365e+0" v="1.4628157932607735e+0" z="0.0000000000000000e+0"/>
        <cornerLocal u="8.0819274304890261e+0" v="1.0363072624453764e+0" z="-1.9073486328125000e-6"/>
        <cornerLocal u="8.0157129245556504e+0" v="-1.4628157932298933e+0" z="-1.9073486328125000e-6"/>
        <cornerLocal u="-8.0819274304964104e+0" v="-1.0363072624144962e+0" z="0.0000000000000000e+0"/>
        <cornerLocal u="-8.0157129245630365e+0" v="1.4628157932607735e+0" z="0.0000000000000000e+0"/>
    </outline>
</object>
Crosswalks and Marking Polygon Attributes

Exported crosswalks and marking polygons include the following attributes.

OpenDRIVE Attribute Description
name Name of the marking (for example, "ContinentalCrosswalk")
s/t Inertial position of the pivot point
hdg/roll/pitch Inertial rotations of the pivot point
zOffset Relative height of the pivot point
height/width/length Dimensions of an oriented bounding box fit to the polygon's vertices. The 'width' is treated as the dimension along the road, and the 'length' is treated as the dimension across the road.
type

Object type, as defined by the configuration XML file for the marking's asset (refer to OpenDRIVE User Asset Configuration)

Traffic Signals and Signs

RoadRunner exports traffic signals and signs as OpenDRIVE <signal> objects.

For optimal behavior, traffic signals and signs for controlled intersections should be mapped to junction gates by using the Signal Tool. Traffic signals are exported only if they are mapped to junction gates. Signs are exported regardless if they are mapped to junction gates and are automatically mapped to the nearest road if not explicitly mapped.

If you need to add a traffic signal outside of a controlled intersection (for example, for a freeway onramp or pedestrian crossing), you can use the  Custom Junction Tool  to create a junction along a single road.

Note: Traffic signals and signs within Prop Assembly Assets are not exported. To export signals or signs in an assembly, you must first expand the instance of the assembly.

Signals and Signal References

When a signal or sign is mapped to a junction gate, it appears in the OpenDRIVE export as a <signal> instance and one or more <signalReference> instances, where:

  • <signal> defines the physical location of the signal. Use <signal> to derive the 3D location of the signal, regardless of which roads or lanes are controlled by the signal. In most cases, the signal is mapped to the closest road (similar to the approach used for Props). This mapping might have no logical association to the signal (for example, the signal could be a nearby side street).
  • <signalReference> associates the signal to the roads and lanes that are controlled by the signal. Signal references indicate the semantic relationship between the signal and the road network (as opposed to <signal>, which is used purely for geometric positioning). Signal references are present for each maneuver road gate associated with the signal (through the Signal Tool). 

Signal Attributes

Exported signals and signs include the following attributes:

OpenDRIVE Attribute Description

name

s/t

hOffset/roll/pitch

zOffset

height/width/length

Refer to Prop Attributes.

"hOffset" is treated the same as the <object> "hdg" attribute.

type/subtype Signal type and subtype, as defined by the configuration XML file for the signal's asset (refer to OpenDRIVE User Asset Configuration)
country "OpenDRIVE" is always used.
dynamic

Specify "yes" for dynamic junction signalization and "no" for static signalization (for example, "All Go" or "All Stop")

value Unused (set to "-1" in all cases).
text Unused (set to empty string in all cases).

Parking Spaces

RoadRunner exports parking spaces as an <object> with type "parking" and an additional <parkingSpace> entry under the <object> following section 5.3.8.1.5 in the OpenDRIVE 1.4H specification. Markings on a parking space are exported as <marking> under the <parkingSpace> entry following section 5.3.8.1.6 in the OpenDRIVE 1.4H specification.

During export, parking spaces will be assigned to the <road> closest to the "entry point" of the parking space. The "entry point" of the parking space is drawn with blue arrows and corresponds to side="rear" for markings.

Parking Attributes

Exported parking spaces include the following attributes.

OpenDRIVE Attribute Description

name

s/t

hdg/roll/pitch

zOffset

height/width/length

Refer to Prop Attributes.

type Always set to "parking".
side (attribute for <marking> entries under <parkingSpace>) Side of the marking (left, right, front, or rear), where the rear is the entry point of the parking space.
type/width/color (attributes for <marking> entries under <parkingSpace>)

Same properties as <roadMark> entries for <lane>.

OpenDRIVE User Asset Configuration

The OpenDRIVE exporter uses a configuration XML file to map RoadRunner props, signals, signs, and markings to the appropriate <object> or <signal> "id" and "subtype". This configuration file is also used to define the correlation during import.

Export a Custom Prop or Signal

  1. Copy the OpenDriveAssetData.xml file located in the RoadRunner install location under AssetsInstall/ResourceAssets to the "Project" folder in your project (next to the "Project.rrproj" file).
  2. Open the new OpenDriveAssetData.xml file in a text editor.
  3. Add entries for new objects, markings, or signals.
  4. Save your file and export an OpenDRIVE file.

You do not need to restart RoadRunner after creating or modifying the OpenDriveAssetData.xml file.

Here is the definition of the format of the OpenDriveAssetData.xml file:

<?xml version="1.0"?>
<OpenDriveAssetData>
    <Objects>
        <Object>   
            <Type> OpenDRIVE "type" </Type> (Required)
            <Id> OpenDRIVE object "id" </Id> (Optional - only used for Import)
            <Name> OpenDRIVE object "name" </Name> (Optional - only used for Import)
            <FilePath> Relative Asset file path to RoadRunner asset </FilePath> (Required)
        </Object>
    </Objects>
    <Markings>
        <RoadMark>
            <Type> OpenDRIVE "type" </Type> (Required)
            <Color> OpenDRIVE "color" </Color> (Optional)
            <FilePath> Relative Asset file path to RoadRunner asset </FilePath> (Required)
        </RoadMark>
    </Markings>
    <Signals>
        <Signal>
            <Type> OpenDRIVE "type" </Type> (Required)
            <SubType> OpenDRIVE "subtype" </SubType> (Optional)
            <Id> OpenDRIVE signal "id" </Id> (Optional - only used for Import)
            <Name> OpenDRIVE signal "name" </Name> (Optional - only used for Import)
            <Country> OpenDRIVE signal "country" </Country> (Optional - only used for Import)
            <FilePath> File path to RoadRunner asset </FilePath> (Required)
            <Variant> Variant of RoadRunner signal/sign asset (integer, where 0 is the first variant, 1 is the second, etc.)<FilePath>
        </Signal>
    </Signals>
</OpenDriveAssetData>

Limitations

Here is a list of features that are not exported from RoadRunner to OpenDRIVE.

  • Prop polygons (these polygons can be exported only if you run the 'bake' operation to convert them to points)
  • Lateral profile (overall road banking is exported, but the full cross section profile is not exported)
  • Lane height
  • Road surface heightfield (CRG)