Main Content

exportScenario

Export scenario from RoadRunner Scenario using MATLAB

Since R2022a

    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 and openScenario2ExportOptions objects are 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.

    OpenScenarioVersion

    The version to export as ASAM OpenSCENARIO 1.0 or ASAM OpenSCENARIO 1.1, specified as a scalar double.

    Default: "auto"

    SceneGraphOptions (since R2024a)

    Options to export and customize scene graph files, specified as a sceneGraphExportOptions object.

    Default: "auto"

    OpenDriveFileName (since R2024a)

    Location to which to export the ASAM OpenDRIVE® file that accompanies the exported ASAM OpenSCENARIO file, specified as an absolute or relative file path. You must specify a path that ends in the .xodr file extension. If you specify a relative path, then RoadRunner saves the exported ASAM OpenDRIVE file relative to the ASAM OpenSCENARIO file path.

    If the specified filename, already exists at the specified location, then RoadRunner overwrites the data in the existing file.

    OpenDriveOptions

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

    Default: "auto"

    MoveNonInstantaneousInitActions (since R2024a)

    Option to move any non-instantaneous InitActions to stories upon export, specified as a logical 1 (true) or 0 (false).

    Default: "auto"

    NoOpsAction (since R2024a)

    No-ops (no operations) action type, specified as these options:

    • "Unspecified" — No no-ops action specified.

    • "UserDefined" — Use a user-defined action as a placeholder.

    • "Empty" — Use an empty action as a placeholder.

    No-ops actions do not have specific behaviors, but they impact scenario logic, serving as substitutes for RoadRunner-specific actions absent in ASAM OpenSCENARIO. Select the placeholder type used to reflect these actions in the exported data.

    Default: "auto"

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

    openScenario2ExportOptions

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

    openScenario2ExportOptions (Name=Value) creates an export options configuration object for the ASAM OpenSCENARIO 2.0 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

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

    Default: "auto".

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

    As of R2024a, if you specify exportoptions as an openScenarioExportOptions object, the SceneGraphOptions property must be a sceneGraphExportOptions object.

    Scene Graph Export Options ObjectDescription Properties
    sceneGraphExportOptions (since R2024a)

    Specifies options for customizing exported scene graph files.

    sceneGraphExportOptions(Name=Value) creates an export options configuration object for customizing scene graph export. If a default property value is "auto", the RoadRunner application determines what value to use and sets the property to that value.

    FormatName

    Format of the scene graph file to export, specified as "OpenSceneGraph". Specify this option to export a new scene graph file for the scenario. To reuse an existing scene graph file, specify the ExistingFileName property instead.

    Default: "auto"

    NewFileName

    Name of the new scene graph file to be generated, specified as a string scalar. By default, RoadRunner generates a new OpenSceneGraph file with the same name as the ASAM OpenSCENARIO file.

    Default: "auto"

    ExistingFileName

    Name of previously exported scene graph file, specified as a string scalar. Specify this option to reuse an existing scene, which can reduce export time. If you specify FormatName, then RoadRunner ignores this property and generates a new scene graph file.

    Default: "auto"

    ExportSceneGraph

    Option to export a scene graph file, specified as a logical 1 (true) or 0 (false).

    By default, RoadRunner exports a scene graph file. To skip the scene graph file when exporting to an ASAM OpenSCENARIO format, set this property to false.

    Default: "auto"

    OpenSceneGraphOptions

    Export options for the OpenSceneGraph file, specified as an openSceneGraphExportOptions object. Do not specify this property if you specify ExistingFileName, or if ExportSceneGraph is false.

    Default: "auto"

    Example: options = sceneGraphExportOptions(FormatName="OpenSceneGraph");

    Data Types: char | string

    Version History

    Introduced in R2022a

    expand all