Main Content

Autonomous Emergency Braking with Vehicle Variants

This example shows how to simulate an autonomous emergency braking application by varying the fidelity of an ego vehicle using 3DOF and 14DOF variants of a vehicle dynamics model. The example also shows how to test these variants in a closed-loop environment that includes probabilistic camera and radar sensor models.

Introduction

Autonomous emergency braking (AEB) is an advanced active safety system that helps drivers avoid or mitigate collisions with other vehicles. In an AEB system, an AEB controller specifies commands for required steering and acceleration (or braking) controls. The vehicle dynamics model receives these commands from the controller. For AEB applications, high-fidelity vehicle dynamics are very important for matching virtual simulation test results to real-world test results. In this example, you study the interactions between an AEB controller and two vehicle dynamics models with different fidelity. You separately integrate each vehicle dynamics model with the AEB system, and analyze the test behavior for each case. For more details on vehicle dynamics models, see Passenger Vehicle Dynamics Models (Vehicle Dynamics Blockset).

In this example, you:

  1. Explore the test bench model — The model contains the sensors and environment, sensor fusion and tracking, decision logic, controls, and a subsystem for selecting between a 3DOF and a 14DOF vehicle dynamics model.

  2. Visualize test scenario — In the test scenario, a pedestrian is crossing a road at an intersection when an ego vehicle is taking a left turn through the intersection.

  3. Simulate with the 3DOF vehicle dynamics model — Configure the test bench model with 3DOF vehicle dynamics and simulate the test bench model.

  4. Simulate with the 14DOF vehicle dynamics model — Configure the test bench model with 14DOF vehicle dynamics and simulate the test bench model.

  5. Explore another test scenario — This test scenario contains an ego vehicle, a child pedestrian, and two obstructing vehicles.

Explore Test Bench Model

In this example, you use a system-level simulation test bench model to explore and analyze the interactions between the AEB controller and the behavior of the vehicle dynamics model for AEB system.

To explore the test bench model, load the autonomous emenrgency braking with vehicle variants project.

openProject("AEBWithVehicleVariants");

To reduce Command Window output, turn off MPC update messages.

mpcverbosity("off");

Open the system-level simulation test bench model.

open_system("AEBWithVehicleVariantsTestBench");

Opening this model runs the helperSLAEBWithVehicleVariantsSetup function that initializes the scenario using the drivingScenario object in the base workspace. The setup function runs the default test scenario scenario_02_AEB_PedestrianChild_Nearside, which contains an ego vehicle and a child pedestrian crossing the road. It also selects the default vehicle dynamics variant 14DOF. This setup function also configures the controller design parameters, vehicle model parameters, and Simulink® bus signals required for defining the inputs and outputs for the AEBWithVehicleVariantsTestBench model.

The test bench model contains these subsystems:

  • Sensors and Environment — Subsystem that specifies the road, actors, camera, and radar sensor used for simulation.

  • Sensor Fusion and Tracking — Algorithm model to fuse vehicle detections from the camera and radar sensors.

  • AEB Decision Logic — Algorithm model to specify 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 uses the nonlinear model predictive controller (NLMPC) to specify the steering angle and acceleration controls.

  • Vehicle Dynamics — Variant subsystem that specifies the dynamics model of the ego vehicle.

  • Metrics Assessment — Subsystem that assesses system-level behavior.

  • MIO Track — Subsystem that prepares the MIO track for display in the Bird's-Eye Scope.

To plot synthetic sensor detections, tracked objects and ground truth data, use the Bird's-Eye Scope. The Bird's-Eye Scope is a model-level visualization tool that you can open from the Simulink model toolbar. On the Simulation tab, under Review Results, click Bird's-Eye Scope. After opening the scope, click Update Signals to set up the signals. The dashboard panel displays these ego vehicle parameters: velocity, acceleration, AEB status, forward collision warning (FCW) status, and safety status.

The Sensors and Environment and Metrics Assessment subsystems, as well as the Sensor Fusion and Tracking, AEB Decision Logic, and AEB Controller reference models, are reused from the Autonomous Emergency Braking with Sensor Fusion example. The Vehicle Dynamics variant subsystem contains two vehicle variants.

  • Vehicle Dynamics 3DOF

  • Vehicle Dynamics 14DOF (default)

Each of these variants takes the Steering Angle and Acceleration commands from the AEB controller as input and outputs the Pose, Longitudinal Velocity, and Lateral Velocity of the ego vehicle. Open the Vehicle Dynamics variant subsystem.

open_system("AEBWithVehicleVariantsTestBench/Vehicle Dynamics");

You can configure the desired variant using the helperSLAEBWithVehicleVariantsSetup function. The default variant is Vehicle Dynamics 14DOF.

Explore 3DOF Variant

The Vehicle Dynamics 3DOF variant uses a Bicycle Model - Force Input block that implements a Bicycle Model single-track, 3DOF, rigid vehicle body to calculate longitudinal, lateral, and yaw motion. Open the Vehicle Dynamics 3DOF variant.

helperSLAEBWithVehicleVariantsSetup(...
    scenarioFcnName="scenario_01_AEB_Pedestrian_Intersection", ...
    vehicleVariantName="3DOF");
pause(3)
open_system( ...
    "AEBWithVehicleVariantsTestBench/Vehicle Dynamics/Vehicle Dynamics 3DOF");

The Bicycle Model - Force Input block accounts for body mass, aerodynamic drag, and weight distribution between the axles due to longitudinal acceleration. The block is configured to use the external longitudinal force to accelerate or brake the vehicle. This block calculates lateral forces using the tire slip angles and linear cornering stiffness.

Explore 14DOF Variant

The Vehicle Dynamics 14DOF variant implements transmission controls, tires, load transfer, braking, and powertrain response for a vehicle. Open the Vehicle Dynamics 14DOF variant.

helperSLAEBWithVehicleVariantsSetup(...
    scenarioFcnName="scenario_01_AEB_Pedestrian_Intersection", ...
    vehicleVariantName="14DOF");
pause(3)
open_system( ...
    "AEBWithVehicleVariantsTestBench/Vehicle Dynamics/Vehicle Dynamics 14DOF");

The Vehicle Dynamics 14DOF variant subsystem contains the VehDyn14DOF reference model, which has the Input Routing, Driver Commands, Controllers, and Environment subsystems. Open the VehDyn14DOF reference model.

open_system("VehDyn14DOF");

The VehDyn14DOF reference model has a Passenger Vehicle subsystem that contains the Engine, Steering and Driveline, Pedal cluster and Cabin, and Chassis and Tires subsystems. Open the Passenger Vehicle subsystem.

open_system("VehDyn14DOF/Passenger Vehicle");

The Passenger Vehicle subsystem contains these subsystems:

  • Engine — The Engine subsystem contains a Mapped SI Engine block to model a spark-ignition engine by using power, air mass flow, fuel flow, exhaust temperature, efficiency, and emission performance lookup tables. For more details, see Mapped SI Engine (Vehicle Dynamics Blockset).

  • Steering and Driveline — The Steering and Driveline subsystem uses a Kinematic Steering block with the Type parameter set to Ackerman. For more details, see Kinematic Steering (Vehicle Dynamics Blockset). The transmission is modelled using the Ideal Fixed Gear Transmission block. For more details on the transmission, see Ideal Fixed Gear Transmission (Vehicle Dynamics Blockset). The Driveline Model is a variant subsystem that contains four variants: Rear Wheel Drive, Front Wheel Drive, All Wheel Drive, and the default Rear Wheel Drive Active Differential. The Brake Hydraulics subsystem converts the brake command to the actual brake pressure on the pedal.

  • Pedal Cluster and Cabin — The Pedal Cluster and Cabin subsystem is a placeholder for introducing faults, detailed actuator behavior, and interactions of other systems with a human interface, such as changes in power steering and braking assistance.

  • Chassis and Tires — The Chassis and Tires subsystem has the Vehicle subsystem, Wheels and Tires subsystem, and Suspension variant subsystem. The Vehicle subsystem has a variant subsystem to select between a 3DOF and a 6DOF vehicle body. The Wheels and Tires subsystem has a VDBS subsystem containing the variant subsystem Tires, which selects between the Magic Formula Tires, Fiala Tires, default Magic Formula Vector Tires, and Fiala Tires Vector variants. The Suspension variant subsystem has six variants of suspension models: Double Wishbone Suspension that uses Independent Suspension - Double Wishbone (Vehicle Dynamics Blockset), Independent Mapped Front Suspension Mapped Solid Axle Rear Suspension that uses Independent Suspension - Mapped (Vehicle Dynamics Blockset) for front suspension and Solid Axle Suspension - Mapped (Vehicle Dynamics Blockset) for rear suspension, MacPherson Front Suspension Solid Axle Rear Suspension uses the Independent Suspension - MacPherson (Vehicle Dynamics Blockset) for front suspension and solid axle for rear suspension, MacPherson Suspension uses independent MacPherson suspension, Mapped Suspension uses the independent Mapped suspension, Kinematics and Compliance Independent Suspension uses the Independent Suspension - K and C (Vehicle Dynamics Blockset) (default).

Visualize Test Scenario

The scenario_01_AEB_Pedestrian_Intersection scenario generates a cuboid scenario that is compatible with the AEBWithVehicleVariantsTestBench model. This is an open-loop scenario containing an ego vehicle and a pedestrian actor. In this scenario, the pedestrian actor crosses the road at the intersection when the ego vehicle takes a left turn at the intersection.

Plot the open-loop scenario to see the interactions of the ego vehicle and the pedestrian actor.

hFigScenario = helperPlotScenario("scenario_01_AEB_Pedestrian_Intersection");

The ego vehicle is not under closed-loop control, so a collision occurs with the pedestrian actor that is crossing the road at the intersection. The goal of the closed-loop simulation is to avoid the collision with the pedestrian actor. Using this scenario, you can analyze the lateral controls with both the vehicle variants in a closed loop.

Close the figure.

close(hFigScenario);

Simulate with 3DOF Vehicle Dynamics Model

In this section, you configure and assess the simulation results of the 3DOF vehicle variant using the scenario_01_AEB_Pedestrian_Intersection test scenario.

Configure the AEBWithVehicleVariantsTestBench model to use the scenario_01_AEB_Pedestrian_Intersection scenario and 3DOF vehicle model variant.

helperSLAEBWithVehicleVariantsSetup(...
    scenarioFcnName="scenario_01_AEB_Pedestrian_Intersection", ...
    vehicleVariantName="3DOF");

Simulate the test bench model. Use the Bird's-Eye Scope visualization to view the results while the simulation is running.

Simulate the model and analyze the plots.

sim("AEBWithVehicleVariantsTestBench");

helperPlotAEBResults(logsout,scenarioFcnName);

  • TTC vs. Stopping Time — Shows a comparison between time-to-collision (TTC) and the stopping times for the FCW, first stage partial brake, second stage partial brake, and full brake respectively.

  • FCW and AEB Status — Shows how the AEB state machine determines the activations for the FCW and AEB based on the comparison results from the first plot.

  • Ego Car Acceleration — Shows the longitudinal and lateral acceleration of the ego vehicle.

  • Ego Car Yaw and Yaw Rate — Shows the yaw and yaw rate of the ego vehicle.

  • Ego Car Velocity — Shows the longitudinal velocity of the ego vehicle.

  • Headway — Shows the headway distance between the ego vehicle and the MIO.

Simulate with 14DOF Vehicle Dynamics Model

In this section, you configure and assess the simulation results of the 14DOF vehicle variant using the scenario_01_AEB_Pedestrian_Intersection test scenario. The higher order 14DOF vehicle model enables you to more realistically reflect nonlinear dynamics and effects including transmission controls, tires, load transfer, braking, and powertrain response.

Configure the AEBWithVehicleVariantsTestBench model to use the scenario_01_AEB_Pedestrian_Intersection scenario and 14DOF vehicle model variant.

helperSLAEBWithVehicleVariantsSetup(...
    scenarioFcnName="scenario_01_AEB_Pedestrian_Intersection", ...
    vehicleVariantName="14DOF");

Simulate the test bench model. Use the Bird's-Eye Scope visualization to view the results while the simulation is running.

Simulate the model and analyze the plots.

sim("AEBWithVehicleVariantsTestBench");

[hFigLongResults,hFigLatResults] = helperPlot14DOFVehicleResults(logsout,scenarioFcnName);
### Searching for referenced models in model 'AEBWithVehicleVariantsTestBench'.
### Found 1 model reference targets to update.
### Starting serial model reference simulation build.
### Successfully updated the model reference simulation target for: VehDyn14DOF

Build Summary

Model reference simulation targets:

Model        Build Reason                                    Status                        Build Duration
=========================================================================================================
VehDyn14DOF  Target (VehDyn14DOF_msf.mexa64) did not exist.  Code generated and compiled.  0h 3m 11.711s 

1 of 1 models built (0 models already up to date)
Build duration: 0h 3m 19.633s

  • From the Longitudinal Results plots, you can observe the acceleration and deceleration input commands and corresponding outputs from the high-fidelity vehicle dynamics model, such as the ego car velocity, longitudinal acceleration, and brake pressures at the four wheels. These plots enable you to analyze the longitudinal behavior of the vehicle.

  • From the Lateral Results plots, you can observe the steering input commands and corresponding outputs such as yaw rate, lateral acceleration, and gear commands. These plots enable you to analyze the lateral behavior of the vehicle.

For an ego vehicle traveling at higher speeds, you can also plot tire forces, suspension forces, engine speed, and tire speeds for a more in-depth analysis.

close(hFigLongResults);
close(hFigLatResults);

This example also provides an additional scenario, scenario_02_AEB_PedestrianChild_Nearside, which is compatible with the AEBWithVehicleVariantsTestBench model. This scenario has been created using the Driving Scenario Designer app and exported to a scenario file. You can configure the AEBWithVehicleVariantsTestBench model and workspace to simulate with this scenario using the helperSLAEBWithVehicleVariantsSetup function.

To configure the test bench to simulate the scenario_02_AEB_PedestrianChild_Nearside scenario using the 14DOF vehicle variant, enter this command.

helperSLAEBWithVehicleVariantsSetup(scenarioFcnName="scenario_02_AEB_PedestrianChild_Nearside",vehicleVariantName="14DOF");

To configure the test bench to simulate the scenario_02_AEB_PedestrianChild_Nearside scenario using the 3DOF vehicle variant, enter this command.

helperSLAEBWithVehicleVariantsSetup(scenarioFcnName="scenario_02_AEB_PedestrianChild_Nearside",vehicleVariantName="3DOF");

This scenario enables you to analyze the longitudinal dynamics of the selected vehicle model. You can simulate and plot the signals for analysis using the helperPlotAEBResults function for a 3DOF simulation or the helperPlot14DOFVehicleResults function for a 14DOF simulation.

For new scenarios, you must specify the initial gear value for the transmission controller that provides inputs to the Passenger Vehicle subsystem. To set the initial gear to 0, enter this command.

set_param("VehDyn14DOF/Controllers/Transmission Controller/PRNDL Controller/Transmission Controller PRNDL","GearInit","0");

When you are done with this example, enable MPC update messages.

mpcverbosity("on");

See Also

Blocks

Related Topics