identifyActorOfInterest
Syntax
Description
identifies the IDs of the ego and target actors in the specified scenario descriptor,
actorIDs
= identifyActorOfInterest(descriptor
)descriptor
.
specifies options using one or more name-value arguments. For example,
actorIDs
= identifyActorOfInterest(descriptor
,Name=Value
)ListMotionStatus="On"
returns lists of which actors are moving and
which are stationary in the scenario, identified by actor ID.
Note
This function requires the Automated Driving Toolbox™ Test Suite for Euro NCAP® Protocols support package. You can install Automated Driving Toolbox Test Suite for Euro NCAP Protocols from the Add-On Explorer. For more information about installing add-ons, see Get and Manage Add-Ons.
Examples
Identify Ego and Target Actors in RoadRunner Scenario
Specify the path to your local RoadRunner installation folder. This code shows the path for the default installation location on Windows®.
appPath = "C:\Program Files\RoadRunner R2023b\bin\win64";
Specify the path to your RoadRunner project. This code shows the path for a sample project folder location in Windows.
projectPath = "C:\RR\MyProject";
Specify the filename of the RoadRunner scenario.
fileName = "TrajectoryCutIn.rrscenario";
Set up the environment to open the scenario in RoadRunner. Update the settings group.
To update the MATLAB® path for the RoadRunner installation folder, get the root object within the settings hierarchical tree, and update the TemporaryValue
for the RoadRunner installation folder property. For more information, see SettingsGroup
.
s = settings; s.roadrunner.application.InstallationFolder.TemporaryValue = appPath;
Open RoadRunner using the specified path to your project. The rrApp
RoadRunner object enables you to interact with RoadRunner from the MATLAB workspace.
rrApp = roadrunner(projectPath);
Open the scenario in RoadRunner.
openScenario(rrApp,fileName)
Create a RoadRunner Scenario simulation.
rrSim = createSimulation(rrApp);
Create a structure to store RoadRunner simulation information.
scenario.SimulatorInstance = rrApp; scenario.SimulationInstance = rrSim;
Create a RoadRunner scenario descriptor.
seedScenarioDescriptorRR = getScenarioDescriptor(scenario,Simulator="RoadRunner");
Stop the RoadRunner simulation.
close(scenario.SimulatorInstance)
Identify the ego, primary target, and secondary target actors in seedScenarioDescriptorRR
.
actorIDs = identifyActorOfInterest(seedScenarioDescriptorRR);
Extract the ego, primary target, and secondary target actor IDs from the actorIDs
structure, and display them.
egoID = actorIDs.EgoID
egoID = 2
primaryTargetID = actorIDs.TargetIDs(1)
primaryTargetID = 1
Identify Ego and Target Actor IDs in Driving Scenario
Load a driving scenario into the workspace.
load("scenarioWithMultipleCollisions.mat")
Create a ScenarioDescriptor
object using the loaded driving scenario scenario
.
seedScenarioDescriptor = getScenarioDescriptor(scenario,Simulator="DrivingScenario");
Specify patterns to identify the ego, primary target, and secondary target actors in seedScenarioDescriptor
.
actorIDs = identifyActorOfInterest(seedScenarioDescriptor, ... EgoPattern="go",PrimaryTargetPattern="ped", ... SecondaryTargetPatterns="uck",ListMotionStatus="On");
Extract the ego, primary target, and secondary target actor IDs from the actorIDs
structure, and display them.
egoID = actorIDs.EgoID
egoID = 1
primaryTargetID = actorIDs.TargetIDs(1)
primaryTargetID = 2
secondaryTargetID = actorIDs.TargetIDs(2:end)
secondaryTargetID = 3
Input Arguments
descriptor
— Scenario descriptor
ScenarioDescriptor
object
Scenario descriptor, specified as a ScenarioDescriptor
object. The
ScenarioDescriptor
object stores scene, actor, and vehicle
information extracted from a seed scenario, and uses this information to generate
scenario variants. You can use these scenario variants to perform safety assessments for
various automated driving applications.
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Example: identifyActorOfInterest(descriptor,ListMotionStatus="On")
returns lists of which actors are moving and which are stationary in the scenario,
identified by actor ID.
EgoPattern
— Name pattern to identify ego actor
string scalar | character vector
Name pattern to identify an ego actor in a scenario, specified as a string scalar or a character vector. An ego actor is a vehicle with an installed autonomous driving system.
Data Types: char
| string
PrimaryTargetPattern
— Name pattern to identify primary target actor
string scalar | character vector
Name pattern to identify a primary target actor in a scenario, specified as a string scalar or a character vector. A primary target actor is a road user or vehicle other than an ego vehicle that is vulnerable to potential on-road accidents.
Data Types: char
| string
SecondaryTargetPatterns
— Name pattern to identify secondary target actor
string scalar | character vector | cell array of character vectors
Name pattern to identify a secondary target actor in a scenario, specified as a string scalar, character vector, or a cell array of character vectors. A secondary target actor is a road user or vehicle, other than the ego and primary target actors, which is traveling on-road or parked along the route of the ego vehicle. A scenario can contain more than one secondary target actor, and you can specify multiple name patterns by which to identify them by using a cell array of character vectors.
Data Types: char
| string
| cell
ListMotionStatus
— List actor motion status option
"Off"
(default) | "On"
List actor motion status option, specified as "On"
or
"Off"
.
On
— Computes the motion status of actors in the scenario. The function outputs the IDs of the moving actors and the stationary actors to the fieldsMovingActorIDs
andStationaryActorIDs
, respectively, of the output structureactorIDs
.Off
— The function does not compute the motion status of actors in the scenario, and theactorIDs
structure does not contain theMovingActorIDs
andStationaryActorIDs
fields.
Data Types: char
| string
Output Arguments
actorIDs
— Ego and target actor IDs
structure
Ego and target actor IDs, returned as a structure containing these fields.
Field | Description |
---|---|
EgoID | ID of the ego actor, returned as a positive integer. |
TargetIDs | IDs of the primary target and secondary targets, returned as a row vector of positive integers. The value of the first element in the vector specifies the primary target ID, and the rest of the values specify the secondary target IDs. |
MovingActorIDs | IDs of the moving actors, returned as a row vector of positive integers. To enable this field, you must specify
|
StationaryActorIDs | IDs of the stationary actors, returned as a row vector of positive integers. To enable this field, you must specify
|
Version History
Introduced in R2023b
Commande MATLAB
Vous avez cliqué sur un lien qui correspond à cette commande MATLAB :
Pour exécuter la commande, saisissez-la dans la fenêtre de commande de MATLAB. Les navigateurs web ne supportent pas les commandes MATLAB.
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)