メインコンテンツ

catalogOptions

Set catalog reference options for scenarios exported to ASAM OpenSCENARIO XML formats

Since R2024b

    Description

    The catalogOptions object enables you to specify for RoadRunner Scenario to reference a catalog when exporting your scenario to an ASAM OpenSCENARIO® XML format. Catalogs are separate files that contain scenario components, such as vehicles, that enable you to reuse certain ASAM OpenSCENARIO XML elements. Catalog references reduce the number of duplicate lines in the exported .xosc file and enable you to share elements, and changes you make to those elements, across multiple scenarios. For information on how to export a catalog file, see Export ASAM OpenSCENARIO XML Catalogs (RoadRunner Scenario).

    Creation

    Description

    catOps = catalogOptions creates a default catalog options configuration object.

    catOps = catalogOptions(PropertyName=Value) specifies properties using one or more name-value arguments.

    example

    Properties

    expand all

    Option to reference a catalog file when exporting a scenario to an ASAM OpenSCENARIO XML format, specified as one of these options:

    • "None" — The exported ASAM OpenSCENARIO XML file does not reference a catalog.

    • "Reference" — The exported ASAM OpenSCENARIO XML file references the catalog in the folder specified by CatalogRootDirectory.

    Root directory for the catalog file referenced by the exported scenario file, specified as a string scalar or character vector. You can specify an absolute path or a path relative to the filename argument specified to the exportScenario function.

    If you set ExportType to "Reference", you must specify a path for the CatalogRootDirectory property.

    Example: myCatalog = catalogOptions(CatalogRootDirectory="C:/RR/MyProject/Exports/Catalogs",ExportType="Reference"); specifies for RoadRunner to reference a catalog located at C:/RR/MyProject/Exports/Catalogs when exporting a scenario to an ASAM OpenSCENARIO XML format.

    Examples

    collapse all

    When you export your RoadRunner scenario to an ASAM OpenSCENARIO XML format, you can use a catalogOptions object to specify for the exported .xosc file to reference a catalog.

    Create a roadrunner object, specifying the path to an existing project. For example, this code shows the path to a project, on a Windows® machine, located at "C:\RR\MyProject". This code assumes that RoadRunner is installed in the default location, and returns an object, rrApp, that provides functions for performing basic tasks such as opening, closing, and saving scenes and projects.

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

    Open an existing scenario in RoadRunner Scenario by using the openScenario function with the roadrunner object rrApp and the filename of the scenario that you want to open.

    filename = "TrajectoryCutIn.rrscenario";
    openScenario(rrApp,filename)

    To reference a catalog in a scenario exported to an ASAM OpenSCENARIO XML format, you must first export a catalog file interactively using the RoadRunner Scenario user interface.

    To export a catalog, from the RoadRunner Scenario File menu, select Export. Then, select ASAM OpenScenario XML Catalogs (.xosc).

    Option to export an ASAM OpenSCENARIO XML Catalog from the RoadRunner Scenario File menu

    In the Export ASAM OpenSCENARIO XML Catalogs window, specify Folder path as the folder in which to save your catalog file. You can also specify additional options for your catalog, such as the ASAM OpenSCENARIO XML version and type of catalog to export. For more information on the Export ASAM OpenSCENARIO XML Catalogs settings, see Export ASAM OpenSCENARIO XML Catalogs (RoadRunner Scenario).

    ASAM OpenSCENARIO Catalog export settings window

    To reference the catalog when exporting your scenario, create a catalogOptions object by specifying the root directory of the catalog and setting ExportType to "Reference". Then, create an openScenarioXMLExportOptions object and specify the CatalogOptions property as the catalogOptions object catOps.

    catOps = catalogOptions(CatalogRootDirectory="C:/RR/MyProject/Exports/Catalogs",ExportType="Reference");
    oscOptions = openScenarioXMLExportOptions(OpenScenarioVersion=1.0,CatalogOptions=catOps);

    To export your scenario, use the exportScenario function, specifying the filename and format name of the exported file, and the openScenarioXMLExportOptions object oscOptions, as input.

    For more information on exporting your scenario with MATLAB®, see exportScenario.

    filename = "TrajectoryCutIn.rrscenario.xosc";
    formatname = "OpenSCENARIO XML";
    exportScenario(rrApp,filename,formatname,oscOptions)

    Version History

    Introduced in R2024b