Main Content

importScene

Import scene into RoadRunner using MATLAB

    Description

    importScene(rrApp,filename,formatname) imports data from a file specified by filename into the currently open scene. The specified file must be in a format RoadRunner supports.

    example

    importScene(rrApp,filename,formatname,importoptions) sets options for import using the importoptions argument.

    Examples

    collapse all

    Open a project in RoadRunner using the roadrunner function by specifying the location in which to create a project. This example assumes that RoadRunner is installed in its default location in Windows.

    Specify the path to an existing project. For example, this code shows the path to a project located on C:\RR\MyProject. The function returns a roadrunner object, rrApp, that provides functions for performing basic workflow tasks such as opening, closing, and saving scenes and projects.

    projectFolder = "C:\RR\MyProject";
    rrApp = roadrunner(projectFolder);

    Open a new scene in the current project. The newScene function opens a blank scene in the currently open project.

    newScene(rrApp);

    Set import options by creating an openDriveImportOptions object that disables the import of signals and objects from the file.

    options = openDriveImportOptions(ImportSignals=false,ImportObjects=false);

    Specify the path to an ASAM OpenDRIVE file. Then, use the importScene function to import data from the specified ASAM OpenDRIVE file into the blank open scene.

    filename = "C:\RR\MyProject\Exports\FourWaySignal.xodr";
    formatname = "OpenDRIVE";
    importScene(rrApp,filename,formatname,options);

    Input Arguments

    collapse all

    RoadRunner application associated with a project, specified as a roadrunner object. This object provides functions for performing common workflow tasks such as opening, closing, and saving scenes and projects. rrApp provides functions that support importing data from files and exporting scenes to other formats from RoadRunner.

    Path of file to import into RoadRunner, specified as a character vector or string scalar . This argument specifies the absolute or relative file path of the file to import. If you specify a relative path, then the path is relative to the Assets folder of the current project.

    Example: importScene(rrApp,"C:\RR\MyProject\Exports\FourWaySignal.xodr","OpenDRIVE",options), "C:\RR\MyProject\Exports\FourWaySignal.xodr" represents the absolute file path of the file to be imported.

    Data Types: char | string

    Import format name, specified as a character vector or string scalar. This value must correspond to a valid import format supported by RoadRunner. Format name options are case-insensitive. RoadRunner supports only ASAM OpenDRIVE® format.

    Example: importScene(rrApp,"FourWaySignal.xodr","OpenDRIVE",options) "OpenDRIVE" specifies that the imported file FourWaySignal.xodr is in the ASAM OpenDRIVE format.

    Data Types: char | string

    Import options configuration, specified as an openDriveImportOptions object compatible with the file specified in the filename argument.

    Import FormatsDescription Properties
    openDriveImportOptions

    Options for importing ASAM OpenDRIVE files into RoadRunner scene.

    openDriveImportOptions(Name=Value) creates an import options configuration object for the ASAM OpenDRIVE format, with properties specified as one or more name-value arguments.

    If a default property value is "auto", the RoadRunner application determines what value to use and sets the property to that value.

    ImportObjects

    Map all <object> entries in the imported file to props or markings, specified as a logical 1 (true) or 0 (false).

    Default: 0

    ImportHeadingOffsetRelativeToOrientation

    Import the <hOffset> (heading offset) values of <signal> entries as being relative to <orientation>, which is the direction of travel of the road that the signal applies to. By default, the heading offset is relative to the heading of the road, regardless of the direction of travel, specified as a logical 1 (true) or 0 (false)

    Default: auto

    LaneOptions

    Lane import options specified as a laneImportOptions object.

    Offset

    Offset of the imported ASAM OpenDRIVE scene, relative to the center of the RoadRunner scene, specified as a three-element vector of form [x y z]. Values are in meters.

    Projection

    Projection of the imported ASAM OpenDRIVE scene, specified as a projectionImportOptions. If the file does not have projection information, then RoadRunner uses the projection of the scene. If both the scene and the file do not have projection information, then RoadRunner uses the Transverse Mercator projection centered at 0 degrees latitude and longitude.

    ImportSignals

    Map all <signal> entries in the imported file to signals or signs, specified as a logical 1 (true) or 0 (false).

    Default: "auto"

    ProjectionMode

    Projection mode, specified as : "Unspecified", "FullProjection", "TranslateOnly", "NoProjection".

    Example: options = openDriveImportOptions(ImportSignals=true);

    laneImportOptions

    laneImportOptions(Name=Value) creates an options configuration object, with properties specified as one or more name-value arguments.

    If a default property value is "auto", the RoadRunner application determines what value to use and sets the property to that value.

    ConvertShoulderToCurb

    Specify this property as logical 1 (true) to import lanes with "curb" markings and type "shoulder" as type "curb" if this option is enabled. Otherwise, the function imports these lanes as type "shoulder", specified as a logical 1 (true) or 0 (false)

    Default: "auto"

    ConvertLaneHeights

    Map all <height> entries to imported lanes, specified as a logical 1 (true) or 0 (false)

    Default: "auto"

    MedianLaneType

    Map all <lane> types as "median" or "raised median", specified as: "Unspecified", "Median", "RaisedMedian".

    Default: "auto"

    Example:

    options = laneImportOptions(MedianLaneType="RaisedMedian"); creates a lane import options object that maps all lanes as a raised median lane type.

    projectionImportOptions

    projectionImportOptions(Name=Value) creates an options configuration object for a map projection with properties specified as one or more name-value arguments.

    If a default property value is "auto", the RoadRunner application determines what value to use and sets the property to that value.

    Projection

    Geospatial projection and datum used to represent spatial coordinates in the map. This property supports valid WKT (including ESRI WKT) or PROJ.4 projection strings. Specified as a string scalar or character vector.

    Default: "auto"

    Example:

    options = projectionImportOptions(Projection="utm +zone=11 +datum=WGS84 + units=m +no_defs +ellps=WGS84 +towgs84=0,0,"); creates projection a projection import options object that uses a PROJ.4 projection string.

    Version History

    Introduced in R2022a