Main Content

exportScenario

Export scenario from RoadRunner Scenario using MATLAB

    Description

    exportScenario(rrApp,filename,formatname) exports a scenario file to one of the file formats that RoadRunner supports.

    example

    exportScenario(rrApp,filename,formatname,exportoptions) sets options for export using exportoptions. The export options configuration is specified as one of the export options objects compatible with the format name specified in the formatname argument. You can export only ASAM OpenSCENARIO® files.

    Examples

    collapse all

    Export a scenario from 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 scenario in the project by calling the openScenario function. You must pass the rrApp object and the RoadRunner scenario you wish to open as input arguments while calling the openScenario function. This example uses the 'FourWaySignal.rrscenario' scenario, which is one of the scenario included by default in RoadRunner projects and is located in the Scenarios folder of the project.

    scenarioname = "MyScenario.rrscenario";
    openScenario(rrApp,scenarioname);

    Before exporting the file, set export options by creating an openScenarioExportOptions object to enable export of signals and objects from the file.

    options = openScenarioExportOptions(OpenDriveOptions=openDriveExportOptions(OpenDriveVersion = 1.5,ExportSignals = true,ExportObjects = true));

    Once the scenario opens successfully, call the exportScenario function to export the scenario to ASAM OpenSCENARIO®. Pass rrApp, the scenario filename of the scenario, the export format, and the export options as input arguments to the function.

    filename = "FourWaySignal.xosc";
    formatname = "OpenSCENARIO";
    exportScenario(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.

    File path to the exported file, specified as a character vector or string scalar. filename is absolute or relative to the exported file. If you specify a relative path, then the exported file is saved relative to the Exports folder of the current project. If any folders in the path are missing, RoadRunner tries to create them. filename can include the extension for the exported file or have no extension. If it has no extension, then RoadRunner appends the extension of the format specified by the formatname to the file name before exporting the scenario.

    Example: While calling exportScenario(rrApp,"FourWaySignal.xosc","OpenSCENARIO",options), "FourWaySignal.xosc" represents the file name of the exported file, which is relative to the Exports folder of the current project.

    Data Types: char | string

    Export format name, specified as a character vector or string scalar. This argument specifies the export format name corresponding to a valid RoadRunner export format. Format name options are case-insensitive. RoadRunner only supports ASAM OpenSCENARIO format.

    Example: While calling exportScenario(rrApp,"FourWaySignal.xosc","OpenSCENARIO",options), OpenSCENARIO specifies that the file will be exported to ASAM OpenSCENARIO format.

    Data Types: char | string

    Export options configuration, specified as one of the export options objects compatible with the format name specified in the formatname argument. This argument specifies the options that can be used with export. Only openScenarioExportOptions object is supported.

    Export Format Options ObjectDescription Properties
    openScenarioExportOptions

    Specifies options for exporting RoadRunner scene and scenario to ASAM OpenSCENARIO.

    openScenarioExportOptions (Name=Value) creates an export 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.

    SceneGraphFormatName

    Format of scene graph file to export, specified as a string or character vector. Only OpenSceneGraph format is supported. Specify this option to export a new scene graph file for the scenario. To reuse an existing scene graph file, specify the file in the SceneGraphFileName property.

    Default: "auto"

    SceneGraphFileName

    Name of previously exported scene graph file, specified as a string or character vector. Specify this option to reuse an existing scene, which can speed up the export process. If SceneGraphFormatName is specified, then this property is ignored and a new scene graph file is generated.

    Default: "auto"

    OpenSceneGraphOptions

    Export options for the OpenSceneGraph file, specified as an openScenarioExportOptions object.

    Default: "auto"

    OpenDriveOptions

    Export options for the ASAM OpenDRIVE® file, specified as an openDriveExportOptions object.

    Default: "auto".

    Example: options = openScenarioExportOptions(OpenDriveOptions = openDriveExportOptions(ExportObjects=true));

    Data Types: char | string

    Version History

    Introduced in R2022a