Main Content

Generate Variants for Testing AEB Car-to-Car Scenarios

Since R2024a

This example shows how to generate variants of a seed scenario that you can use for testing automatic emergency braking (AEB) systems per the European New Car Assessment (Euro NCAP®) test protocols.

Automatic emergency braking is an advanced driver assistance system (ADAS) that aids a driver in performing emergency braking to avoid a collision. Simulated testing of AEB scenarios is essential for enhancing the safety and reliability of these systems in real-world situations.

In this example, you:

  • Create a seed scenario specific to the Euro NCAP standards for AEB Car-to-Car testing.

  • Vary actor and collision parameters.

  • Generate variants for the input scenario.

  • Visualize the generated scenario variants.

  • Export the scenario variants to the ASAM OpenSCENARIO® file format.

Using this example, you can generate variants for various types of Euro NCAP test scenarios containing car-to-car collisions. For more information on these scenarios, see the Further Exploration section.

Create Seed Scenario

This example requires Automated Driving Toolbox™ Test Suite for Euro NCAP® Protocols support package. Check if the support package is installed.

helperCheckSupportPackageInstalled

Create a seed scenario to test the AEB Car-to-Car Front Turn-Across-Path (CCFtap) Euro NCAP scenario. In this scenario, the ego vehicle turns across the path of an oncoming target vehicle that is traveling at a constant speed, which results in a head-on collision.

Specify the type of AEB test scenario, and generate a scenario descriptor for it by using the ncapScenario function.

testType = "CCFtap";
AEBTestType = "SA AEB " + testType;
seedScenarioDescriptor = ncapScenario(AEBTestType)
seedScenarioDescriptor = 
  ScenarioDescriptor with properties:

    Status: "DescriptorCreated"

Vary Parameters

Extract the Euro NCAP variation parameters for your AEB test scenario by using the helperGetNCAPVariationProperties helper function. The function creates an array of objects to store the variation parameter values by using the variationProperties object.

variationProperties = helperGetNCAPVariationProperties(AEBTestType);

Generate Scenario Variants

Generate an array of variant ScenarioDescriptor objects by using the generateVariants function.

[variantDescriptors,info] = generateVariants(seedScenarioDescriptor,variationProperties);

Get an array of drivingScenario objects containing scenario variants from the ScenarioDescriptor objects by using the getScenario function.

variantScenarios = getScenario(variantDescriptors,Simulator="DrivingScenario");

Visualize Generated Variants

Get the visualization parameters for the AEB test scenario by using the helperGetVisualizationPropertiesForAEBC2C helper function. By default, this helper function only returns visualization parameters for a subset of the generated variants. To visualize all the variants, set the VisualizeAllVariants name-value pair to "true".

visualizationInfo = helperGetVisualizationPropertiesForAEBC2C(AEBTestType,VisualizeAllVariants="false");

Visualize the seed scenario and the generated scenario variants by using the helperVisualizeVariants helper function. Note the variations in the speed values of the ego and the target vehicles.

seedScenario = getScenario(seedScenarioDescriptor,Simulator="DrivingScenario");
helperVisualizeVariants(seedScenario,variantScenarios(visualizationInfo.VariantIndex), ...
    Title=visualizationInfo.figureTitle,VariantTitles=visualizationInfo.variantTitles, ...
    SeedTitle=visualizationInfo.seedTitle,StopAtCollision="on", ...
    GridDimension=visualizationInfo.gridDimensions,CropType=visualizationInfo.CropType,Waypoints="off");

Export to ASAM OpenSCENARIO

Export the generated scenario variants to ASAM OpenSCENARIO file format 1.0.

for iter = 1:length(variantScenarios)
    export(variantScenarios(iter),"OpenSCENARIO","variantScenario_" + AEBTestType + iter + ".xosc")
end

Further Exploration

You can visualize the scenario in a 3D simulation environment by using the Driving Scenario Designer app. For example, view the first variant scenario in a 3D simulation environment by following these steps:

  1. Enter this command to open the first variant scenario in the Driving Scenario Designer app: drivingScenarioDesigner(variantScenarios(1))

  2. On the app toolstrip, select 3D Display > View Simulation in 3D Display.

  3. After the app opens the Simulation 3D Viewer window, in the app toolstrip, click Run.

Simulation 3D Viewer window of Driving Scenario Designer app, displaying the variant scenario in 3D.

In this example, you have explored variant generation for the AEB CCFtap scenario.

To generate variants for other AEB Car-to-Car scenarios, you must change the value of testType to one of these test names. Then, follow the rest of the procedure in this example to generate a seed scenario and scenario variants. These seed scenario options are in accordance with the Euro NCAP test protocol standards.

  • Car-to-Car Front Turn-Across-Path (CCFtap) — The ego vehicle turns across the path of an oncoming target vehicle traveling at a constant speed, resulting in a head-on collision. To use this scenario, specify testType as "CCFtap".

  • Car-to-Car Rear Stationary (CCRs) — The ego vehicle moves forward toward a stationary target vehicle, resulting in a collision between the front side of the ego vehicle and the rear side of the target vehicle. To use this scenario, specify testType as "CCRs".

  • Car-to-Car Rear Moving (CCRm) — The ego vehicle moves forward toward a target vehicle traveling at a constant speed, resulting in a collision between the front side of the ego vehicle and the rear side of the target vehicle. To use this scenario, specify testType as "CCRm".

  • Car-to-Car Rear Braking (CCRb) — The ego vehicle moves forward toward a target vehicle traveling at a constant speed, collides, and then decelerates. The scenario results in a collision between the front side of the ego vehicle and the rear side of the target vehicle. To use this scenario, specify testType as "CCRb".

  • Car-to-Car Crossing Straight Crossing Path (CCCscp) — The ego and target vehicles move toward a junction on straight, perpendicular paths, resulting in a collision between the front side of the ego vehicle and one side of the target vehicle. To use this scenario, specify testType as "CCCscp".

  • Car-to-Car Front Head-on Straight (CCFhos) — The ego and target vehicles move toward each other in the same lane, resulting in a head-on collision. To use this scenario, specify testType as "CCFhos".

  • Car-to-Car Front Head-on Lane change (CCFhol) — The ego and target vehicles move toward each other, traveling on different lanes. The target vehicle performs a lane change into the ego lane, resulting in a head-on collision. To use this scenario, specify testType as "CCFhol".

For example, to generate a seed scenario descriptor and variations for an AEB Car-to-Car Rear Stationary scenario, enter this code.

testType = "CCRs";

In this example, you have generated variants for drivingScenario. To generate variants for RoadRunner, see the Generate RoadRunner Scenario Using Tabular Data for AEB Car-to-Car Testing example.

References

[1] European New Car Assessment Programme (Euro NCAP). Test Protocol – AEB Car-to-Car Systems, Version 4.2. Euro NCAP, June 2023. https://cdn.euroncap.com/media/77302/euro-ncap-aeb-c2c-test-protocol-v42.pdf.

See Also

Functions

Related Topics