exportScenario
Syntax
Description
exportScenario(
exports a scenario file to one of the file formats that RoadRunner supports.rrApp
,filename
,formatname
)
exportScenario(
sets options for export using rrApp
,filename
,formatname
,exportoptions
)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
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 'FreeDrive.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 = "FreeDrive.rrscenario";
openScenario(rrApp,scenarioname);
Before exporting the file, set export options by creating an openScenarioXMLExportOptions
object to enable export of signals and objects from the file.
options = openScenarioXMLExportOptions(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 = "FreeDrive.xosc"; formatname = "OpenSCENARIO XML"; exportScenario(rrApp,filename,formatname,options);
Input Arguments
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,"FreeDrive.xosc","OpenSCENARIO
XML",options)
, "FreeDrive.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 "OpenSCENARIO XML"
or
"OpenSCENARIO DSL"
. Format name options are case-insensitive. This
argument specifies the export format name corresponding to a valid RoadRunner export format. RoadRunner only supports ASAM OpenSCENARIO format.
"OpenSCENARIO XML"
— Export a scenario to an ASAM OpenSCENARIO XML file"OpenSCENARIO DSL"
— Export a scenario to an ASAM OpenSCENARIO DSL file
Example: While calling exportScenario(rrApp,"FreeDrive.xosc","OpenSCENARIO
XML",options)
, OpenSCENARIO XML
specifies that the file
will be exported to ASAM OpenSCENARIO XML 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 to use during export. The export options
configuration property supports these objects:
openScenarioXMLExportOptions
— Specify options for customizing files exported to the ASAM OpenSCENARIO XML 1.x format.openScenarioDSLExportOptions
— Specify options for customizing files exported to the ASAM OpenSCENARIO DSL format.
As of R2024a, if you specify exportoptions
as an
openScenarioXMLExportOptions
object, the
SceneGraphOptions
property must be a sceneGraphExportOptions
object.
Version History
Introduced in R2022aASAM has updated the names of the ASAM OpenSCENARIO standards. ASAM OpenSCENARIO 1.x is now referred to as ASAM OpenSCENARIO XML, and ASAM OpenSCENARIO 2.0 is now known as ASAM OpenSCENARIO DSL. Consequently, these formatname
argument values and
export option configuration objects have been renamed to align with this new naming convention.
"OpenSCENARIO"
renamed to"OpenSCENARIO XML"
"OpenSCENARIO 2.0"
renamed to"OpenSCENARIO DSL"
openScenarioExportOptions
export option configuration object renamed toopenScenarioXMLExportOptions
openScenario2ExportOptions
export option configuration object renamed toopenScenarioDSLExportOptions
Support for the old names will be removed in a future release. If your code uses these format names or option configuration objects, consider modifying it to use the new names. The functionality of the format names and option configuration objects remain the same.
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)