importScenario
Syntax
Description
importScenario(
imports an ASAM OpenSCENARIO® file or a trajectory in a CSV file into the currently opened scenario.rrApp
,filename
,formatname
)
importScenario(
sets additional import options using rrApp
,filename
,formatname
,importoptions
)importoptions
argument. This
syntax is valid only when importing an ASAM OpenSCENARIO file.
Examples
Import Scenario
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
rrApp
— RoadRunner application
roadrunner
object
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.
filename
— Path of file which is to be imported
character vector | string scalar
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
formatname
— Import format name
"OpenSCENARIO"
| "CSV Trajectory"
Import format name, specified as "OpenSCENARIO"
or "CSV
Trajectory"
. Format name options are case-insensitive.
"OpenSCENARIO"
— Import ASAM OpenSCENARIO file"CSV Trajectory"
— Import vehicle trajectory from a CSV file
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
importoptions
— Import options configuration
openScenarioImportOptions
object
Import options configuration, specified as an
openScenarioImportOptions
object compatible with the file specified
in the filename
argument. You can specify this argument only when the
value of formatname
is "OpenSCENARIO"
.
Import Format Options Object | Description | Properties | ||
---|---|---|---|---|
openScenarioImportOptions | Specifies options for importing ASAM OpenSCENARIO file into RoadRunner scenario.
|
Example: |
Version History
Introduced in R2022a
See Also
roadrunner
| exportScenario
| close
Topics
- RoadRunner Scenario Fundamentals (RoadRunner Scenario)
- Simulate a RoadRunner Scenario Using MATLAB Functions
Beispiel öffnen
Sie haben eine geänderte Version dieses Beispiels. Möchten Sie dieses Beispiel mit Ihren Änderungen öffnen?
MATLAB-Befehl
Sie haben auf einen Link geklickt, der diesem MATLAB-Befehl entspricht:
Führen Sie den Befehl durch Eingabe in das MATLAB-Befehlsfenster aus. Webbrowser unterstützen keine MATLAB-Befehle.
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)