38
1 © 2016 The MathWorks, Inc. ADAS Algorithm Design and Prototyping Forward Collision Warning Example Seo-Wook Park, Principal Application Engineer Mark Corless, Principal Application Engineer

ADAS Algorithm Design and Prototyping - MathWorks · •Horizontal FoV: 360 ... Sensor fusion algorithm for FCW Sensor Fusion Kalman Filter MIO: Most-Important Object Risk Assessment

  • Upload
    others

  • View
    16

  • Download
    0

Embed Size (px)

Citation preview

Page 1: ADAS Algorithm Design and Prototyping - MathWorks · •Horizontal FoV: 360 ... Sensor fusion algorithm for FCW Sensor Fusion Kalman Filter MIO: Most-Important Object Risk Assessment

1© 2016 The MathWorks, Inc.

ADAS Algorithm Design and PrototypingForward Collision Warning Example

Seo-Wook Park, Principal Application Engineer

Mark Corless, Principal Application Engineer

Page 2: ADAS Algorithm Design and Prototyping - MathWorks · •Horizontal FoV: 360 ... Sensor fusion algorithm for FCW Sensor Fusion Kalman Filter MIO: Most-Important Object Risk Assessment

2

•Worst-case

scenarios

•Scenarios identified

from real world test

drive data

How do I know my ADAS algorithm is robust enough?

• OEM specific

test scenarios

• Fail Operation

test scenarios

Page 3: ADAS Algorithm Design and Prototyping - MathWorks · •Horizontal FoV: 360 ... Sensor fusion algorithm for FCW Sensor Fusion Kalman Filter MIO: Most-Important Object Risk Assessment

3

Synthetic

data

Example workflow for ADAS algorithm development

Logged

vehicle

data

ADAS

algorithm

C Code

Create new traffic scenario or refine sensor model

Drive and collect more vehicle data

Refine algorithm

Generate code

Integrate

with embedded

environment

yes

no

Expected

behavior

?

Page 4: ADAS Algorithm Design and Prototyping - MathWorks · •Horizontal FoV: 360 ... Sensor fusion algorithm for FCW Sensor Fusion Kalman Filter MIO: Most-Important Object Risk Assessment

4

The MATLAB environment helps ADAS engineers …

Gain insight by replaying and visualizing logged vehicle data

Reduce time on the road by synthesizing data to test algorithms

Speed up prototyping of algorithms by generating code

Page 5: ADAS Algorithm Design and Prototyping - MathWorks · •Horizontal FoV: 360 ... Sensor fusion algorithm for FCW Sensor Fusion Kalman Filter MIO: Most-Important Object Risk Assessment

5

Gain insight by replaying and visualizing logged vehicle data

Synthetic

data

C Code

Create new traffic scenario or refine sensor model

Generate code

Integrate

with embedded

environment

Logged

vehicle

data

ADAS

algorithm

Drive and collect more vehicle data

Refine algorithm

yes

no

Expected

behavior

?

Page 6: ADAS Algorithm Design and Prototyping - MathWorks · •Horizontal FoV: 360 ... Sensor fusion algorithm for FCW Sensor Fusion Kalman Filter MIO: Most-Important Object Risk Assessment

6

Test vehicle equipped with sensors

Delphi ESR

• 76GHz electronically scanning radar

• Dual FoVs, 90x60m, 20x174m

• CAN interface

Mobileye 560

• FoV: 38x150m

• CAN interface

Mobileye

560

Delphi

ESR

Point Grey Blackfly

• Stand “ice cube” vision camera

• 800x600, 27FPS

• GigE interface

XSENS MTI-G-700

• Stable and sensitive

• MEMS-based AHRS

• USB interface

Velodyne LiDAR HDL-32E

• Horizontal FoV: 360

• Vertical FoV: +10..-30

• Range: 80..100m

• 100 Mbps Ethernet

Page 7: ADAS Algorithm Design and Prototyping - MathWorks · •Horizontal FoV: 360 ... Sensor fusion algorithm for FCW Sensor Fusion Kalman Filter MIO: Most-Important Object Risk Assessment

7

Example test scenarios in public road

01_city_c2s_fcw 02_city_stopngo 03_local_streetParking

04_highway_cornering 05_highway_lanechange 06_highway_cutin

Page 8: ADAS Algorithm Design and Prototyping - MathWorks · •Horizontal FoV: 360 ... Sensor fusion algorithm for FCW Sensor Fusion Kalman Filter MIO: Most-Important Object Risk Assessment

8

• Calculate Ground Speed

• Object classification

• Filtering

• Offset Compensation

Zoning

Path

Estimation

Vision

Object

Radar

Object

Vision

LD

Vehicle

CAN

Sensor fusion algorithm for FCW

Sensor

Fusion

Kalman

Filter

MIO: Most-Important Object

Risk

Assessment

Maneuver

Analysis

Zoning

Find

MIOFCW

Kalman

Filter

Data

Pre-processing

Path

Estimation

Sensor Fusion

& Tracking

Threat

Assessment

Page 9: ADAS Algorithm Design and Prototyping - MathWorks · •Horizontal FoV: 360 ... Sensor fusion algorithm for FCW Sensor Fusion Kalman Filter MIO: Most-Important Object Risk Assessment

9

• Calculate Ground Speed

• Object classification

• Filtering

• Offset Compensation

Data

Pre-processing

Zoning

Path

Estimation

Path

Estimation

Sensor fusion algorithm for FCW

Vision

Object

Radar

Object

Vision

LD

Vehicle

CAN

Sensor

Fusion

Kalman

Filter

Sensor Fusion

& Tracking

MIO: Most-Important Object

Threat

Assessment

Risk

Assessment

Maneuver

Analysis

Zoning

Find

MIOFCW

Kalman

Filter

Page 10: ADAS Algorithm Design and Prototyping - MathWorks · •Horizontal FoV: 360 ... Sensor fusion algorithm for FCW Sensor Fusion Kalman Filter MIO: Most-Important Object Risk Assessment

10

• Calculate Ground Speed

• Object classification

• Filtering

• Offset Compensation

Data

Pre-processing

Zoning

Path

Estimation

Path

Estimation

Sensor fusion algorithm for FCW

Vision

Object

Radar

Object

Vision

LD

Vehicle

CAN

Sensor

Fusion

Kalman

Filter

Sensor Fusion

& Tracking

MIO: Most-Important Object

Threat

Assessment

Risk

Assessment

Maneuver

Analysis

Zoning

Find

MIOFCW

Kalman

Filter

Page 11: ADAS Algorithm Design and Prototyping - MathWorks · •Horizontal FoV: 360 ... Sensor fusion algorithm for FCW Sensor Fusion Kalman Filter MIO: Most-Important Object Risk Assessment

11

Sensor fusion Sensor Fusion

Birds-Eye View object notations

Radar object (stationary)

Radar object (moving)

Vision object

Fused object (safe zone)

Fused object (warn zone)

Fused object (FCW zone)

Fused object (most important object)

Calculate Ground Speed

Object classification

Filtering

Offset Compensation

Data

Pre-processing

Zoning

Path

Estimation

Path

Estimation

Vision

Object

Radar

Object

Vision

LD

Vehicle

CAN

Sensor

Fusion

Kalman

Filter

Sensor Fusion

& Tracking

Kalman

Filter

Page 12: ADAS Algorithm Design and Prototyping - MathWorks · •Horizontal FoV: 360 ... Sensor fusion algorithm for FCW Sensor Fusion Kalman Filter MIO: Most-Important Object Risk Assessment

12

Sensor Fusion

Made Easy by MATLAB CVST

Vision

Object

Radar

Object

Radar

VisionR1 R2 Rm

V1

V2

Vn

Radar

costMatrix

Assignments

V1 + R2

V2 + R1

Vn + Rm

Fusion

𝑓(𝑉1) + 𝑓(𝑅2)𝑓(𝑉2) + 𝑓(𝑅1)

𝑓(𝑉𝑛) + 𝑓(𝑅𝑚)

Fused Object List

Computer Vision System Toolbox™

[assignments, unassignedVisions, unassignedRadars] = ...assignDetectionsToTracks(costMatrix, param.costOfNonAssignment);

Pairs of visions and

associated radars

Page 13: ADAS Algorithm Design and Prototyping - MathWorks · •Horizontal FoV: 360 ... Sensor fusion algorithm for FCW Sensor Fusion Kalman Filter MIO: Most-Important Object Risk Assessment

13

• Calculate Ground Speed

• Object classification

• Filtering

• Offset Compensation

Data

Pre-processing

Zoning

Path

Estimation

Path

Estimation

Object Tracking by Kalman Filter

Vision

Object

Radar

Object

Vision

LD

Vehicle

CAN

Sensor

Fusion

Kalman

Filter

Sensor Fusion

& Tracking

MIO: Most-Important Object

Threat

Assessment

Risk

Assessment

Maneuver

Analysis

Zoning

Find

MIOFCW

Kalman

Filter

Page 14: ADAS Algorithm Design and Prototyping - MathWorks · •Horizontal FoV: 360 ... Sensor fusion algorithm for FCW Sensor Fusion Kalman Filter MIO: Most-Important Object Risk Assessment

14

What is the Kalman Filter?

It is an iterative mathematical process that uses a set of equations and

consecutive data inputs to quickly estimate the true value, position, velocity,

etc. of the object being measured, when the measured values contain

random noise.

Estimated temperature

Actual temperature

Measured temperature

Page 15: ADAS Algorithm Design and Prototyping - MathWorks · •Horizontal FoV: 360 ... Sensor fusion algorithm for FCW Sensor Fusion Kalman Filter MIO: Most-Important Object Risk Assessment

15

Kalman Filter

0x̂

0P

Initial state

& covariance

kx

1kP

Previous state

& covariance

Pk

APk1A

TQ

(1) Predict state based on physical model and previous state

(2) Predict error covariance matrix

Time Update (“Predict”)

K k Pk

H

T(HPk

H

TR)

1(1) Compute Kalman gain

(2) Update estimate state with measurement

Measurement Update (“Correct”)

ˆ x k ˆ x kKk(zk Hˆ x k

)

(3) Update the error covariance matrix

Pk (IK kH) Pk

kkk vHxz

Measurementkx̂

kP

Output of

updated state

1 kk

Current becomes previous

R : Sensor noise covariance matrix (measurement error)

K : Kalman gain

uw

][ TE wwQ

: Control variable matrix

: Process (state) noise

][T

kkk E eeP kkk xxe ˆ

: Process (state)

covariance matrix

(estimation error)

: Process noise

covariance matrix

v

H

: Measurement noise

k minimize P

A : State matrix relates the state at the

previous, k-1 to the state at the current, k

: Output matrix relates the state to the

measurement

kkkk wBuxAx

1ˆˆ

From sensor spec or experiment

Page 16: ADAS Algorithm Design and Prototyping - MathWorks · •Horizontal FoV: 360 ... Sensor fusion algorithm for FCW Sensor Fusion Kalman Filter MIO: Most-Important Object Risk Assessment

16

Kalman Filter Made Easy by MATLAB CVST

0x̂

0P

Initial state

& covariance

kx

1kP

Previous state

& covariance Time Update (“Predict”)

Measurement Update (“Correct”) Current Measurement

Output of

updated state

1 kk

Current becomes previous

[z_pred,x_pred,P_pred] = predict(obj)

z_pred : prediction of measurementx_pred : prediction of stateP_pred : state estimation error covariance

at the next time step

[z_corr,x_corr,P_corr] = correct(obj,z)

z_corr : correction of measurementx_corr : correction of stateP_corr : state estimation error covariance

z

x_corrP_corr

Predicted state

x_pred

kalmanFilterSysObj = vision.KalmanFilter(A,H,'ProcessNoise',Q,'MeasurementNoise',R)

Computer Vision System Toolbox™

Page 17: ADAS Algorithm Design and Prototyping - MathWorks · •Horizontal FoV: 360 ... Sensor fusion algorithm for FCW Sensor Fusion Kalman Filter MIO: Most-Important Object Risk Assessment

17

FCW

• Calculate Ground Speed

• Object classification

• Filtering

• Offset Compensation

Data

Pre-processing

Zoning

Path

Estimation

Path

Estimation

Sensor fusion algorithm for FCW

Vision

Object

Radar

Object

Vision

LD

Vehicle

CAN

Sensor

Fusion

Kalman

Filter

Sensor Fusion

& Tracking

Risk

Assessment

Maneuver

Analysis

Zoning

Find

MIO

Threat

Assessment

Kalman

Filter

Page 18: ADAS Algorithm Design and Prototyping - MathWorks · •Horizontal FoV: 360 ... Sensor fusion algorithm for FCW Sensor Fusion Kalman Filter MIO: Most-Important Object Risk Assessment

18

Synthetic

data

Reduce time on the road by synthesizing data to test algorithms

Logged

vehicle

data

ADAS

algorithm

C Code

Create new traffic scenario or refine sensor model

Drive and collect more vehicle data

Refine algorithm

Generate code

Integrate

with embedded

environment

yes

no

Expected

behavior

?

Page 19: ADAS Algorithm Design and Prototyping - MathWorks · •Horizontal FoV: 360 ... Sensor fusion algorithm for FCW Sensor Fusion Kalman Filter MIO: Most-Important Object Risk Assessment

19

Example synthetic test scenarios – EuroNCAP

ENCAP – CCRs ENCAP – CCRm ENCAP – CCRb

stationary

50kph

50kph

20kph

50kph

50kph

@ -2m/s2

50kph

50kph

@ -6m/s2

ENCAP – CCRb

40m

12m

Ego car

Target car

Page 20: ADAS Algorithm Design and Prototyping - MathWorks · •Horizontal FoV: 360 ... Sensor fusion algorithm for FCW Sensor Fusion Kalman Filter MIO: Most-Important Object Risk Assessment

20

Example synthetic test scenarios – Fail Operation

FO1 – cornering FO2 – overtaking FO4 – lane change

60kph

30kph130kph

90kph

stationary

50kph

Ego car

Target car

Page 21: ADAS Algorithm Design and Prototyping - MathWorks · •Horizontal FoV: 360 ... Sensor fusion algorithm for FCW Sensor Fusion Kalman Filter MIO: Most-Important Object Risk Assessment

21

Example synthetic test scenarios – intersection and stop & go

Intersection – turning w/ braking Intersection – near crash Intersection – U-turn Stop & go @ 3020kph

50kph

Ego car

Target car

Page 22: ADAS Algorithm Design and Prototyping - MathWorks · •Horizontal FoV: 360 ... Sensor fusion algorithm for FCW Sensor Fusion Kalman Filter MIO: Most-Important Object Risk Assessment

22

Common approaches to synthesizing test data

“Buy It” Buying “Off the shelf” solutions

like PreScan and CarMaker

enable you to author traffic

scenarios and synthesize sensor

data

“Build It” Building it yourself enables

you to control the level of

fidelity/complexity appropriate

for your application

If building for multiple users, it

is important to select an

approach which is scalable,

maintainable, and testable

Page 23: ADAS Algorithm Design and Prototyping - MathWorks · •Horizontal FoV: 360 ... Sensor fusion algorithm for FCW Sensor Fusion Kalman Filter MIO: Most-Important Object Risk Assessment

23

Key components defining a Traffic Scenario

Define Road• Road type

• NumLanes

• LaneWidth

Define Vehicles• Ego vehicle

• Target vehicles

• NumTargetsDefine Trajectories

• Path type

• Waypoints

• Velocity, acceleration

• Heading angle, yawrate

Sensor Model• Vision, Radar

• Range, FoV

• Position, Velocity error

• NumCluster

Page 24: ADAS Algorithm Design and Prototyping - MathWorks · •Horizontal FoV: 360 ... Sensor fusion algorithm for FCW Sensor Fusion Kalman Filter MIO: Most-Important Object Risk Assessment

24

Example radar spec

Reference) Stanislas, Leo & Peynot, Thierry, “Characterisation of the Delphi Electronically Scanning Radar for robotics applications”. In Australasian Conference on

Robotics and Automation (ACRA 2015), 2-4 December 2015, Canberra, A.C.T.

Page 25: ADAS Algorithm Design and Prototyping - MathWorks · •Horizontal FoV: 360 ... Sensor fusion algorithm for FCW Sensor Fusion Kalman Filter MIO: Most-Important Object Risk Assessment

25

Architecture we selected to build a data synthesis tool

Synthesized

Data

Data Model

(Programmatic Interface)

Controls state of data

• Specifies scenario (i.e. road,

vehicles, waypoints, sensor models)

• Synthesizes data to test algorithm

• Enables automation

1

Page 26: ADAS Algorithm Design and Prototyping - MathWorks · •Horizontal FoV: 360 ... Sensor fusion algorithm for FCW Sensor Fusion Kalman Filter MIO: Most-Important Object Risk Assessment

26

Architecture we selected to build a data synthesis tool

Synthesized

Data

Data Model

(Programmatic Interface)

App

(Graphical Interface)

Controls state of data

• Specifies scenario (i.e. road,

vehicles, waypoints, sensor models)

• Synthesizes data to test algorithm

• Enables automation

1

Controls state of interface

• Reacts to user input

• Updates data model

• Draws user interface and

visualizations

• Simplifies interaction with

data

2

Page 27: ADAS Algorithm Design and Prototyping - MathWorks · •Horizontal FoV: 360 ... Sensor fusion algorithm for FCW Sensor Fusion Kalman Filter MIO: Most-Important Object Risk Assessment

27

Architecture we selected to build a data synthesis tool

Synthesized

Data

Data Model

(Programmatic Interface)

App

(Graphical Interface)

Unit Test

Controls state of data

• Specifies scenario (i.e. road,

vehicles, waypoints, sensor models)

• Synthesizes data to test algorithm

• Enables automation

1

Controls state of interface

• Reacts to user input

• Updates data model

• Draws user interface and

visualizations

• Simplifies interaction with

dataAutomates regression testing

• Increases likelihood of catching

issues introduced during iterations

• Facilitates collaboration

3

2

Page 28: ADAS Algorithm Design and Prototyping - MathWorks · •Horizontal FoV: 360 ... Sensor fusion algorithm for FCW Sensor Fusion Kalman Filter MIO: Most-Important Object Risk Assessment

28

Architecture we selected to build a data synthesis tool

Synthesized

Data

Data Model

(Programmatic Interface)

App

(Graphical Interface)

Unit Test

Controls state of data

• Specifies scenario (i.e. road,

vehicles, waypoints, sensor models)

• Synthesizes data to test algorithm

• Enables automation

1

Controls state of interface

• Reacts to user input

• Updates data model

• Draws user interface and

visualizations

• Simplifies interaction with

dataAutomates regression testing

• Increases likelihood of catching

issues introduced during iterations

• Facilitates collaboration

3

2

Page 29: ADAS Algorithm Design and Prototyping - MathWorks · •Horizontal FoV: 360 ... Sensor fusion algorithm for FCW Sensor Fusion Kalman Filter MIO: Most-Important Object Risk Assessment

29

Synthetic

data

Speed up prototyping of algorithms by generating code

Logged

vehicle

data

ADAS

algorithm

C Code

Create new traffic scenario or refine sensor model

Drive and collect more vehicle data

Refine algorithm

Generate code

Integrate

with embedded

environment

yes

no

Expected

behavior

?

Page 30: ADAS Algorithm Design and Prototyping - MathWorks · •Horizontal FoV: 360 ... Sensor fusion algorithm for FCW Sensor Fusion Kalman Filter MIO: Most-Important Object Risk Assessment

30

Generate C code for your algorithm with MATLAB Coder

Software in the loop &

Processor in the loop

enabled by

Embedded Coder

MATLAB

C

Page 31: ADAS Algorithm Design and Prototyping - MathWorks · •Horizontal FoV: 360 ... Sensor fusion algorithm for FCW Sensor Fusion Kalman Filter MIO: Most-Important Object Risk Assessment

31

Create components in MATLAB and reuse them in Simulink

Page 32: ADAS Algorithm Design and Prototyping - MathWorks · •Horizontal FoV: 360 ... Sensor fusion algorithm for FCW Sensor Fusion Kalman Filter MIO: Most-Important Object Risk Assessment

32

Enable coverage of MATLAB and C code with

Simulink Verification and Validation

Collects coverage on MATLAB code

in “Normal” mode

Collects coverage on generated C

code in “Software in the loop” mode

Page 33: ADAS Algorithm Design and Prototyping - MathWorks · •Horizontal FoV: 360 ... Sensor fusion algorithm for FCW Sensor Fusion Kalman Filter MIO: Most-Important Object Risk Assessment

33

Automate regression testing with Simulink Test

Specify tests and Interact with results

in the Test Manager

Generate a report to share results

Page 34: ADAS Algorithm Design and Prototyping - MathWorks · •Horizontal FoV: 360 ... Sensor fusion algorithm for FCW Sensor Fusion Kalman Filter MIO: Most-Important Object Risk Assessment

34

Prototype on hardware with Simulink Real-Timeas seen in today’s Test drive your ADAS algorithms presentation

Algorithm Models

Vehicle and

Environment

Models

Forward

Collision

Warning

Autonomous

Emergency

Braking

Page 35: ADAS Algorithm Design and Prototyping - MathWorks · •Horizontal FoV: 360 ... Sensor fusion algorithm for FCW Sensor Fusion Kalman Filter MIO: Most-Important Object Risk Assessment

35

Synthetic

data

Example workflow for ADAS algorithm development

Logged

vehicle

data

ADAS

algorithm

C Code

Create new traffic scenario or refine sensor model

Drive and collect more vehicle data

Refine algorithm

Generate code

Integrate

with embedded

environment

yes

no

Expected

behavior

?

Page 36: ADAS Algorithm Design and Prototyping - MathWorks · •Horizontal FoV: 360 ... Sensor fusion algorithm for FCW Sensor Fusion Kalman Filter MIO: Most-Important Object Risk Assessment

36

What key product features enabled this workflow?

Design Kalman filters with Computer Vision System Toolbox

Encapsulate data with MATLAB Classes

Test MATLAB code with MATLAB Unit Test

Generate C code from your algorithm with MATLAB Coder

Verify generated code using SIL with Embedded Coder

Collect model and code coverage with Simulink Verification and Validation

Automate regression testing and reporting with Simulink Test

Page 37: ADAS Algorithm Design and Prototyping - MathWorks · •Horizontal FoV: 360 ... Sensor fusion algorithm for FCW Sensor Fusion Kalman Filter MIO: Most-Important Object Risk Assessment

37

How can you get started?N

um

ber

of

Users

Complexity

Documentation and

Training Services can

help you learn how to use

product features

Consulting Services can help

you select and establish a

baseline architecture to meet the

needs of your application

Consulting helped us

select an architecture for

our Traffic Scenario App

Page 38: ADAS Algorithm Design and Prototyping - MathWorks · •Horizontal FoV: 360 ... Sensor fusion algorithm for FCW Sensor Fusion Kalman Filter MIO: Most-Important Object Risk Assessment

38

The MATLAB environment helps ADAS engineers …

Gain insight by replaying and visualizing logged vehicle data

Reduce time on the road by synthesizing data to test algorithms

Speed up prototyping of algorithms by generating code