main content

automate testing for scenario variants of aeb system -凯发k8网页登录

this example shows how to assess the functionality of an autonomous emergency braking (aeb) application by varying the european new car assessment programme (euro ncap) car-to-pedestrian nearside child (cpnc) driving scenario. this example builds on the autonomous emergency braking with sensor fusion example.

introduction

autonomous emergency braking is an advanced active safety system that helps drivers avoid or mitigate collisions with other vehicles. the test space for autonomous driving functions is incredibly large, and it is not feasible to validate large numbers of scenarios with real-world driving tests. this example enables you to perform scenario-based testing of an aeb system by generating multiple scenario variants from a seed scenario.

the example shows how to vary ego speed and collision point parameters to generate multiple variants of the euro ncap cpnc test scenario. the example also shows how to use iterative testing methodology in simulink® test manager to test the generated variants. in this example, you:

  1. explore the test bench model — the model contains modules for the sensors and environment, sensor fusion and tracking, decision logic, controls, and vehicle dynamics.

  2. review seed scenario and generate variants — review the cpnc seed scenario and generate variants of the seed scenario by varying the ego speed and the collision point between the ego vehicle and pedestrian.

  3. perform iterative testing with scenario variants — configure test manager to simulate the aeb test bench model for each scenario variant using scripted iterative testing with simulink test™, assess success criteria, and report results.

  4. visualize the results and review the generated report — plot a grid-based visualization to review and analyze the results from iterative testing. you can also export the simulation results to a pdf and review the generated report.

explore test bench model

this example reuses the aebtestbench model from the autonomous emergency braking with sensor fusion example.

to explore the test bench model, open a working copy of the project example files. matlab® copies the files to an example folder so that you can edit them.

helperdrivingprojectsetup("autonomousemergencybraking.zip",workdir=pwd)

to reduce command window output, turn off model predictive controller (mpc) update messages.

mpcverbosity("off");

open the system-level simulation test bench model.

open_system("aebtestbench")

this test bench model has these modules:

  • sensors and environment — subsystem that specifies the road, actors, camera, and radar sensor used for simulation.

  • sensor fusion and tracking — algorithm model that fuses vehicle detections from the camera to those from the radar sensor.

  • aeb decision logic — algorithm model that specifies the lateral and longitudinal decision logic that provides most important object (mio) related information and ego vehicle reference path information to the controller.

  • aeb controller — algorithm model that specifies the steering angle and acceleration controls.

  • vehicle dynamics — subsystem that specifies the dynamic model of the ego vehicle.

  • metrics assessment — subsystem that assesses system-level behavior.

for more details on these components and simulating the test bench model, see the autonomous emergency braking with sensor fusion example.

in this example, your focus is on automating the simulation runs for multiple variants of a seed scenario. you create the seed scenario using the driving scenario designer app.

review seed scenario and generate variants

the helpercreateseedscenario function generates a cuboid scenario that is compatible with the aebtestbench model. this is an open-loop scenario containing two stationary target vehicles on a straight road and a child pedestrian. this is a euro ncap cpnc scenario, in which the ego vehicle collides with a pedestrian child who is running behind the obstruction from the nearside. the frontal structure of the vehicle hits the pedestrian.

plot the open-loop scenario to see the interactions of the ego vehicle and the pedestrian child target.

hfigseedscenario = helperplotscenario("helpercreateseedscenario");

the ego vehicle, which is not under closed-loop control, collides with the pedestrian child. the goal of the closed-loop system is to avoid or mitigate the collision with the pedestrian actor. in the aebtestbench model, the ego vehicle has the same initial speed and initial position as in the open-loop scenario.

close the figure.

close(hfigseedscenario)

generate variants of seed scenario

the helpercreateseedscenario function creates a seed scenario in which the speed of the ego vehicle is 60 km/h, and the collision point is at the front-left corner of the ego vehicle. to test this aeb cpnc scenario per euro ncap test protocols, you create multiple variants of the seed scenario by varying the ego speed and collision point. use the helpercreateseedscenario function to create the seed scenario.

[seedscenario,egovehicle] = helpercreateseedscenario;

use the function to create a scenariodescriptor object that has the properties of the seed scenario. you can modify the properties of this object to generate scenario variations.

% get the scenario descriptor from the seed scenario
scenariodescriptor = getscenariodescriptor(seedscenario,simulator="drivingscenario");

define the ids of the ego vehicle and the target actor that collides with the ego vehicle.

egoid = egovehicle.actorid;
targetid = 2;

to generate scenario variations, the ego vehicle in the seed scenario must satisfy these criteria:

  • the ego vehicle must collide with the target vehicle.

  • the ego vehicle must have consistent motion properties.

  • the ego trajectory must have at least three waypoints.

  • the ego vehicle must travel at a constant speed.

the helpercheckscenario function validates the seed scenario against these criteria. if any of the checks fail, the function returns a value of 0 indicating that you must modify the scenario before using it to generate variations variations.

the helperperformscenariocollision function modifies the scenario based on these conditions:

  • if the ego vehicle or target actor has only two waypoints, the helperperformscenariocollision function adds the third waypoint at the midpoint between them, and sets its speed value to that of the preceding waypoint.

  • if the ego vehicle or target actor does not travel with a constant speed starting from the first waypoint, the helperperformscenariocollision function sets their speed values to a constant value of 80 km/h and 10 km/h, respectively.

  • if the ego vehicle and the target actor do not collide, but have intersecting trajectories, helperperformscenariocollision checks if a collision is possible by modifying the wait time of the target actor. if possible, the function modifies the wait time of the target vehicle to create a collision event. otherwise, the function returns an error.

% validate the seed scenario information stored in scenariodescriptor.
checkstatus = helpercheckscenario(egoid,targetid,scenariodescriptor);
if ~checkstatus % if scenario check failed, modify the scenario according to requirements
    scenariodescriptor = helperperformscenariocollision(egoid,targetid,scenariodescriptor,method="waittime");
end

to generate variants of the seed scenario, use the helpergeneratescenariovariant function. the helpergeneratescenariovariant function uses these input arguments: the scenariodescriptor object, the ego vehicle id, the target actor id, a new speed for the ego vehicle, and a new collision point.

specify the new ego speed in m/s. to convert 20 km/h to m/s, divide by 3.6. this results in a speed value of approximately 5.5 m/s.

egonewspeed = 20 * 1/3.6; % m/s

define the new collision point, as specified in the example, which is required for scenario variant generation. for a collision point at the center of the front of the ego vehicle front, specify newcollisionpoint as 0.5.

newcollisionpoint = 0.5;

generate the variant, using the helpergeneratescenariovariant function, with the ego vehicle traveling at 20 km/h and hitting the pedestrian at the center of the front of the vehicle.

scenariovariant = helpergeneratescenariovariant(scenariodescriptor,egoid,targetid,egonewspeed,newcollisionpoint);

review the generated variant scenario using the driving scenario designer app.

drivingscenariodesigner(scenariovariant);

notice that the generated variant has an ego speed of 5.5 m/s, and the collision occurs at the center of the front of the ego vehicle. you can use this scenario with the aebtestbench model to perform closed-loop testing.

simulink test enables you to automate the generation and testing of scenario variants with the closed-loop model. using simulink test, you can generate a large number of variations from a seed scenario and catch the failures.

perform iterative testing with scenario variants

this example includes a test manager configuration for automating testing of the aeb application with the generated variants. open the aebscenariovariationtest.mldatx test file in the test manager.

sltestmgr
testfile = sltest.testmanager.load("aebscenariovariationtest");

the simulink scripted iteration framework enables you to automate scenario variant generation and closed-loop testing using the test bench model. the iterative testing script in the aebscenariovariationtest.mldatx file describes how to combine scenario variant generation and closed-loop testing of the aeb application.

the setvariable function sets these parameters for each iteration:

  • v_set — set velocity of the ego vehicle.

  • scenario — driving scenario object.

  • egovehdyn — initialization parameters for vehicle dynamics subsystem, specified as a structure.

the additeration function adds test iterations. for more information on creating scripted iterations, see the (simulink test).

after simulating the test case, the test manager uses the helperplotaebresults function from the cleanup callback to generate the post-simulation plots. for more information on these plots, see autonomous emergency braking with sensor fusion example.

run and explore results for cpnc scenario variants

to test the system-level model with the generated variants from simulink test, use this code:

resultset = run(testfile);
testfileresults = gettestfileresults(resultset);
testsuiteresults = gettestsuiteresults(testfileresults);
testcaseresults = gettestcaseresults(testsuiteresults);
testiterationresults = getiterationresults(testcaseresults);

visualize results and review generated report

the testiterationresults output contains the results for all the iterations. to plot the summary of results in the form of a color grid, use the helperplotaebvariantresults function. this helper function plots the grid results with specific colors for each cell that indicate the pass or fail status of closed-loop simulation of the aebtestbench model with the generated scenario variants.

helperplotaebvariantresults(testiterationresults,egonewspeeds,newcollisionpoints)

in the result grid, the columns represent the collision point values of 0.2, 0.3, 0.5, and 0.7. the rows represent nine ego speed values ranging from 10 km/h to 50 km/h in steps of 5 km/h. for each value of ego speed, there are four possible collision points, which results in a total of 36 variations. the right table in the figure shows the color lookup table for the vut test speed vs vut impact speed range. vut test speed is the initial speed of the ego vehicle and vut impact speed is the speed of the ego vehicle at the time of the collision. the difference between the test speed and the impact speed is known as speed reduction. this lookup table shows the speed reduction to infer aeb system performance at the time of the collision. the green column represents significant speed reduction and the red column represents lower speed reduction of the ego vehicle.

each cell of the grid shows the final ego speed using a color that corresponds to the amount of speed reduction. notice that all cells of the grid are green, which indicates that the algorithm in the aeb test bench passed all 36 variations of the cpnc scenario.

use this code to generate the report, for further analysis of specific iterations:

sltest.testmanager.report(testiterationresults,"report.pdf", ...
title="automate testing for cpnc scenario variants of aeb system", ...
includematlabfigures=true, ...
includeerrormessages=true, ...
includetestresults=0, ...
launchreport=true);

review generated report

examine report.pdf. observe that the test environment section shows the platform on which the test is run and the matlab version used for testing. the summary section shows the outcome of the test and duration of the simulation, in seconds. the results section shows pass or fail results based on the assessment criteria. this section also shows the plots logged from the helperplotaebresults function.

enable mpc update messages.

mpcverbosity("on");

see also

apps

objects

functions

  • |

blocks

  • (vehicle dynamics blockset) | |

related topics

网站地图