Main Content

importScenario

Import file into RoadRunner Scenario using MATLAB

    Description

    importScenario(rrApp,filename,formatname) imports a file that is in a format that RoadRunner supports into the currently opened scenario.

    example

    importScenario(rrApp,filename,formatname,importoptions) sets options for import using importoptions argument. You can import only ASAM OpenSCENARIO® files.

    Examples

    collapse all

    Import a scenario in RoadRunner Scenario using MATLAB.

    Call the roadrunner function and pass in the location where you want to create the 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 at "C:\RR\MyProject". This call returns an 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 scenario in the current project by calling the newScenario function and passing it the rrApp object. This call opens a blank scenario in the currently opened project.

    newScenario(rrApp);

    Before importing the ASAM OpenSCENARIO® file, set import options by creating an openScenarioImportOptions object to enable import of signals from the file.

    options = openScenarioImportOptions(OpenDriveOptions = openDriveImportOptions(ImportSignals=true));

    Call the importScenario function and pass the rrApp object, the filename, and the options object as input arguments. This function call imports data from the specified filename into the currently opened scenario.

    filename = "C:\RR\MyProject\Assets\FourWaySignal.xosc";
    formatname = "OpenSCENARIO";
    importScenario(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 which is to be imported, specified as a character vector or string scalar. filename is absolute or relative path to the file to be imported. If you specify a relative path, then you must specify a path to a file in the Assets folder of the current project.

    Example: While calling importScenario(rrApp,"C:\RR\MyProject\Assets\FourWaySignal.xosc","OpenSCENARIO",importoptions), "C:\RR\MyProject\Assets\FourWaySignal.xosc" represents the file path of the file to be imported, which is relative to the Assets folder of the current project.

    Data Types: char | string

    Import format name, specified as a character vector or string scalar. This argument specifies the format name corresponding to a valid import format that RoadRunner supports. Format name options are case-insensitive. You can import only ASAM OpenSCENARIO files.

    Example: While calling importScenario(rrApp,"C:\RR\MyProject\Assets\FourWaySignal.xosc","OpenSCENARIO",importoptions), OpenSCENARIO specifies that the file will be imported to ASAM OpenSCENARIO format.

    Data Types: char | string

    Import options configuration, specified as openScenarioImportOptions object compatible with the file specified in the filename argument. Only openScenarioImportOptions object for ASAM OpenSCENARIO file is supported.

    Import Format Options ObjectDescription Properties
    openScenarioImportOptions

    Specifies options for importing ASAM OpenSCENARIO file into RoadRunner scenario.

    openScenarioImportOptions (Name=Value) creates an import options configuration object for the ASAM OpenSCENARIO 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.

    OpenDriveOptions

    Options to import an ASAM OpenDRIVE® file, specified as an openDriveImportOptions object.

    Default: "auto".

    Example: options = openScenarioImportOptions(OpenDriveOptions = openDriveImportOptions(ImportSignals=true));

    Data Types: char | string

    Version History

    Introduced in R2022a