# Automatic Emergency Braking

This is actually a more important problem and hard problem than it seems.

If you draw your confusion matrix, you have two bad scenarios:

- Too loose threshold: You don’t need to break, but AEB is toggled anyways $→$ False Positives
- Too strict threshold:
**REALLY BAD**. You have to break, but your AEB doesn’t toggle (you kill a pedestrian) $→$ False Negatives

Good AEB systems are really tuned well to find the perfect balance. https://docs.google.com/presentation/d/1HQSLPLE-fZ3EN-9PyqMd7-ti7JSLKL7qlrouGFEprU0/edit#slide=id.p11

Nowadays, AEB systems in cars are mandatory to promote safety.

### Simple AEB using TTC

The simplest way to do AEB is calculating TTC (Time-to-Collision), where $TTC_{i}(t)=[−r˙_{i}(t)]_{+}r_{i}(t) $

where $r_{i}$ is the instantaneous range measurements and $r˙$ is the current range rates. The operator $[x]_{+}$ is defined as $max(x,0)$.

We obtain:

- $r_{i}$ by using the current measurements from the
`LaserScan`

message - $r˙_{i}$ by mapping the vehicle’s current longitudinal velocity onto each scan beam’s angle by using $v_{x}cos(θ_{i})$, where $v_{x}$ is the forward speed in the vehicle’s frame of reference (obtained from
`Odometry`

message), and $θ_{i}$ is the beam angle obtained from`LaserScan`

messages