getCollisionData
Syntax
Description
collisionInfo = getCollisionData(descriptor)descriptor.
collisionInfo = getCollisionData(descriptor,Name=Value)Actor1ID=2 checks for collision between the actor with the ID 2, and
        all other actors in the scenario.
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
Load a driving scenario containing actor collision into the workspace.
load("scenarioWithSingleCollision.mat")Create a scenarioDescriptor object using the loaded driving scenario.
scenarioDescriptor = getScenarioDescriptor(sc,Simulator="DrivingScenario");Extract collision information from the scenarioDescriptor object.
collisionsInScenario = getCollisionData(scenarioDescriptor);
Display the extracted collision information.
disp(collisionsInScenario.Collision)
  collision with properties:
          Time: 0.4981
         Point: [28.4345 4.0853]
    Actor1Info: [1×1 struct]
    Actor2Info: [1×1 struct]
Load a driving scenario containing multiple actor collisions into the workspace.
load("scenarioWithMultipleCollisions.mat")Create a scenarioDescriptor object using the loaded driving scenario.
scenarioDescriptor = getScenarioDescriptor(sc,Simulator="DrivingScenario");Extract collision information from the scenarioDescriptor object.
collisionsInScenario = getCollisionData(scenarioDescriptor);
Display the extracted information of first collision.
disp(collisionsInScenario(1).Collision)
  collision with properties:
          Time: 3.0102
         Point: [30.5809 -1.0907]
    Actor1Info: [1×1 struct]
    Actor2Info: [1×1 struct]
Display the extracted information of second collision.
disp(collisionsInScenario(2).Collision)
  collision with properties:
          Time: 1.6756
         Point: [1.1088 -1.1493]
    Actor1Info: [1×1 struct]
    Actor2Info: [1×1 struct]
Input Arguments
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 the
            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: getCollisionData(D,Actor1ID=[2 3],Actor2ID=[5 6]) checks for
        collisions of all possible pairs of the actors with IDs 2 and 3 and those with IDs 5 and
        6.
First actor ID, specified as a positive integer or a row vector of positive integers.
If you do not specify Actor2ID, the function checks for
              collision between each actor specified by Actor1ID and all other
              actors in the scenario.
 If you specify Actor2ID, the function checks collision for
              all possible pairs between the actors specified by Actor1ID and
              those specified by Actor2ID.
Data Types: single | double | uint8
Second actor ID, specified as a positive integer or a row vector of positive integers.
If you do not specify Actor1ID, the function checks for
              collision between each actor specified by Actor2ID and all other
              actors in the scenario.
 If you specify Actor1ID, the function checks collision for
              all possible pairs between the actors specified by Actor2ID and
              those specified by Actor1ID.
Data Types: single | double | uint8
Output Arguments
Collision information between pairs of colliding actors, returned as an array of structures. Each structure in the array contains these fields:
- Actor1ID— ID of the first colliding actor in the pair, returned as a positive integer.
- Actor2ID— ID of the second colliding actor in the pair, returned as a positive integer.
- Collision— Collision information, returned as a- collisionobject. The- collisionobject has these properties:- Property - Description - Time- Simulation time at which collision occurs. - Units are in seconds. - Point- Coordinates of the collision point in the world frame. - Units are in meters - Actor1Info- Information about the first actor in the collision pair, returned as a structure. - Actor2Info- Information about the second actor in the collision pair, returned as a structure. - Each - Actor1Infoand- Actor2Infostructure contains these fields:- Field - Description - ID- ID of the corresponding actor, returned as a positive integer. - Position- Position of the actor at the time of collision, returned as a three-element numeric row vector of the form [latitude longitude altitude]. - Units are in meters. - Speed- Speed of the actor at the time of collision, returned as a scalar. - Units are in meters per second. - Yaw(since R2024a)- Yaw angle of the actor at the time of collision, returned as a scalar. Units are in radians. - CollisionFraction- Point of collision relative to the collision side of the actor, returned as a fraction in the range [0, 1]. For more information, see Collision Fraction. - CollisionSide- Side of the actor at which collision occurs, returned as - Front,- Left,- Back, or- Right.
Note
If the input scenario contains no collisions, or no collisions between the
                specified pairs of actors Actor1ID and
                  Actor2ID, the function returns
                  collisionInfo as an empty array,
                [].
More About
The collision fraction specifies the relative position on the
        collision side of a vehicle at which the collision occurs. For example, if the center of the
        front edge of the ego vehicle Actor-1 collides with the left corner on
        the front edge of the target vehicle Actor-2, then the collision fraction
        of Actor-1 is 0.5. 

Collision fraction is defined by the equation
where Exl and Eyl are the x- and y-coordinates of the left corner of the ego vehicle collision side, Txl and Tyl are the x- and y-coordinates of the collision point on the target vehicle, and WE is the width of the collision side of the ego vehicle.
Version History
Introduced in R2023aThe output Actor1Info and Actor2Info structure now
        includes an additional Yaw field, specifying the yaw angles of the actor
        at the time of collision.
See Also
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.
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- 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)