Main Content

Generate Variants of ACC Target Cut-In Scenario

This example shows how to generate scenario variants from a seed scenario in which a target vehicle cuts into the ego lane. Using this example, you can test the adaptive cruise control (ACC) application.

Create Seed Scenario

In this example, you create a seed scenario containing the ego vehicle and a target vehicle in which the target vehicle cuts into the ego lane. The seed scenario specifies the positions, dimensions, speed values, and trajectories of both vehicles per the European New Car Assessment Programme (Euro NCAP®) test protocols. This example assumes that the ego vehicle collides with the target actor in the seed scenario. You generate variants of a seed scenario by varying the ego speed but keeping the collision point constant.

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 for ACC target cut-in and fetch the ActorID value of the actors in the seed scenario using the helperCreateNCAPScenario helper function.

ACCTestType = "ACCTargetCutIn";
[seedScenario, actorOfInterest] = helperCreateNCAPScenario(ACCTestType);

Display the returned drivingScenario object seedScenario.

seedScenario
seedScenario = 
  drivingScenario with properties:

        SampleTime: 0.0100
          StopTime: Inf
    SimulationTime: 0
         IsRunning: 1
            Actors: [1×2 driving.scenario.Vehicle]
          Barriers: [0×0 driving.scenario.Barrier]
       ParkingLots: [0×0 driving.scenario.ParkingLot]

Display the IDs of actors returned in the actorOfInterest structure.

actorOfInterest
actorOfInterest = struct with fields:
       egoID: 1
    targetID: 2

Set Up Parameters for Scenario Variant Generation

Get the predefined parameters for the Euro NCAP ACC cut-in test scenario by using the helperGetNCAPParameters helper function. The function retrieves data for one variation that complies with the parameters.

ACCParams = helperGetNCAPParameters(ACCTestType)
ACCParams = struct with fields:
       scenarioName: "ACCTargetCutIn"
    radiusOfTurning: 250
       changeLength: 60
           egoSpeed: 33.3333
        targetSpeed: 19.4444
    timeToCollision: 1.5000

Generate Scenario Variants

Create ScenarioDescriptor object as the scenario variant using the helperGenerateVariant helper function. Additionally, this helper function returns the title to use when visualizing the variant scenario. The function generates the scenario variant by varying the actor and event parameters of the seed scenario.

[variantDescriptors,gridPlotTitles] = helperGenerateVariant(...
    ACCTestType,seedScenario,ACCParams,actorOfInterest);

Get drivingScenario object that contains a scenario variant from the ScenarioDescriptor object by using the getScenario function.

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

Visualize Generated Variant

Visualize the seed scenario and the generated variants by using the helperVisualizeVariants helper function.

helperVisualizeVariants(seedScenario,variantScenarios, ...
    Title=gridPlotTitles.figureTitle, ...
    SeedTitle=gridPlotTitles.seedTitle, ...
    VariantTitles=gridPlotTitles.variantTitles, ...
    Waypoints="off",StopAtCollision="on");

Figure Variant Visualization contains 2 axes objects and other objects of type subplottext, uipanel. Axes object 1 with title Ego Speed 13.89 m/s, Target Speed 2.78 m/s contains 5 objects of type patch, line. Axes object 2 with title Ego Speed 33.33 m/s, Target Speed 19.44 m/s contains 5 objects of type patch, line.

Export to ASAM OpenSCENARIO

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

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

Further Exploration

You can visualize the scenario in a 3D simulation environment by following these steps:

  1. Enter this command to open the 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, click Run.

Visualization of ACC Cut-In scenario in 3D simulation environment.

In this example, you have explored the scenario variant generation for the ACC testing wherein which a target vehicle cuts into the ego lane.

You can use the same steps to generate variants for other types of seed scenarios by specifying different values of the ACCTestType variable. This example supports these additional values for the ACCTestType variable:

  • ACCTargetCutInModified — Generate five sets of scenario variants of the ACC target cut-in scenario.

  • ACCLeadCutOut — Generate scenario variants of the ACC cut-out scenario in which a lead vehicle cuts out of the ego lane to avoid collision with a stationary target vehicle.

For example, to configure the example to generate variants for the ACC cut-out scenario, enter this code:

ACCTestType = "ACCLeadCutOut";

seedScenario = helperCreateNCAPScenario(ACCTestType);

You can use the same example steps to generate variants for the Euro NCAP Safety Assist Automatic Emergency Braking Car-to-Car (SA AEB CC) tests. Specify one of these values for the ACCTestType variable:

  • SA AEB CCRb — Safety Assist Automatic Emergency Braking Car-to-Car Rear braking

  • SA AEB CCRm — Safety Assist Automatic Emergency Braking Car-to-Car Rear moving

  • SA AEB CCRs — Safety Assist Automatic Emergency Braking Car-to-Car Rear stationary

  • SA AEB CCFhos — Safety Assist Automatic Emergency Braking Car-to-Car Front head-on straight

  • SA AEB CCFhol — Safety Assist Automatic Emergency Braking Car-to-Car Front head-on lane change

  • SA AEB CCFtap — Safety Assist Automatic Emergency Braking Car-to-Car Front turn across path

  • SA AEB CCCscp — Safety Assist Automatic Emergency Braking Car-to-Car Crossing straight crossing path

References

[1] European New Car Assessment Programme (Euro NCAP). Assisted Driving Highway Assist Systems Test & Assessment Protocol, Version 1.0. Euro NCAP, September 2020. https://cdn.euroncap.com/media/58813/euro-ncap-ad-test-and-assessment-protocol-v10.pdf

[2] 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