For reading OpenDRIVE networks, give netconvert the option --opendrive-files <FILE>[,<FILE>]* or --opendrive <FILE>[,<FILE>]* for short.
netconvert --opendrive myOpenDriveNetwork.xodr -o mySUMOnetwork.net.xml
netconvert can also write OpenDrive networks.
Defining Lane Types to Import#
OpenDRIVE allows to assign a lane to an abstract (not pre-defined) class. Some of the lanes can be used by vehicles, some represent non-usable building structures, such as curbs. When reading OpenDRIVE files, netconvert determines whether and how a lane shall be imported by looking into pre-defined and/or loaded edge types. Several known lane types are pre-defined, and shown in the following table together with their defaults. They can be overwritten using edge types of same name. The following attributes are retrieved from the edge types if not set explicitly by the lane within the read OpenDRIVE file:
- maximum allowed speed
- allowed vehicle classes
Lane types netconvert interprets as driving lanes
|type@lane||imported||default speed [km/h]||default width [m]||allowed vehicle classes|
All other types are not imported.
As a conclusion, if you wish to import lanes of type
border", you have to additionally load a
file like this:
<types> <type id="border" priority="0" numLanes="1" speed="1.39"/> </types>
Pre-Defined type maps#
The following edge-type files are available in /data/typemap for OpenDRIVE import:
- opendriveNetconvert.typ.xml: default typemap for importing automotive networks. This will be used if option --type-files is not set.
- opendriveNetconvertBicycle.typ.xml: can be combined with default typemap to also import bicycle lanes
- opendriveNetconvertPedestrians.typ.xml: can be combined with default typemap to also import sidewalks
Dealing with Lane Sections#
OpenDRIVE edges may contain one or more "lane sections". As OpenDRIVE
lane sections may differ in number of lanes for any of the directions,
the importer has to split the imported edge at all lane sections. The
resulting edges' IDs are built from the original edge ID and the offset
of the lane section within the edge (lane section's
s-value), divided by a dot ('.'). As an
example, the first lane section of the edge '100' is named '100.0.00'.
Assuming the edge has a further lane section starting at
s=100, a further edge named '100.100.00'
would be built.
The importer checks whether the lane sections are given in the right
s-value) and resorts them,
if not. Additionally, lane sections that are very short, this means the
s-value is near (POSITION_EPS, 0.1 m) to
the last one, are removed. We have seen this only in automatically
generated (scanned) networks.
Dealing with Speed Changes#
OpenDRIVE allows to define changes of the allowed velocity along a lane.
As SUMO road networks do not support such a feature, the imported
OpenDRIVE edge is split at the positions the speed of a lane changes.
Internally, this is handled by building additional lane section. As a
result, the IDs of the edges are built the same way it would be done for
lane sections - the
s-value of the new lane
section is composed by the original lane section's
s-value plus the speed change's
Handling of geometry#
Geometry in OpenDRIVE takes the form of parametric curves (arcs, spirals and splines). These are all sampled with a configurable precision (--opendrive.curve-resolution <FLOAT>) to produce polylines in the .net.xml. Junction shapes are not encoded in OpenDRIVE. They are generated based on points where the shapes of normal roads and connecting roads meet.
Referencing original IDs#
When using the option --output.original-names, each lane will receive a
<param origID="EDGE_ID LANE_INDEX"/> which can be used with
the TraCI function moveToVTD.
Furthermore, when exporting to OpenDrive with option --opendrive-output and using option --output.original-names,
<road>-element will get an additional element which references the
corresponding edge id in the .net.xml file:
By setting the option --polygon-output <FILE>, any road objects present in the input are exported as loadable shapes. If the option --proj.plain-geo true is set and the input network is geo-referenced, generated shapes will be written with geo-coordinate as well.
Supported Versions and Features#
netconvert aims to support as many features as possible across OpenDRIVE versions. Version 1.4 should generally be supported. You can check the feature support per version (and request new featuers) in our issue tracker: