Main Content

identifyActorOfInterest

Identify ego and target actors in seed scenario descriptor

Since R2023b

Description

example

actorIDs = identifyActorOfInterest(descriptor) identifies the IDs of the ego and target actors in the specified scenario descriptor, descriptor.

example

actorIDs = identifyActorOfInterest(descriptor,Name=Value) specifies options using one or more name-value arguments. For example, 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

collapse all

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

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

collapse all

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.

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

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

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

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 fields MovingActorIDs and StationaryActorIDs, respectively, of the output structure actorIDs.

  • Off — The function does not compute the motion status of actors in the scenario, and the actorIDs structure does not contain the MovingActorIDs and StationaryActorIDs fields.

Data Types: char | string

Output Arguments

collapse all

Ego and target actor IDs, returned as a structure containing these fields.

FieldDescription
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 ListMotionStatus value as "On".

StationaryActorIDs

IDs of the stationary actors, returned as a row vector of positive integers.

To enable this field, you must specify ListMotionStatus value as "On".

Version History

Introduced in R2023b