  With the rise of AI and automation, moral decisions are being put into the
hands of algorithms that were formerly the preserve of humans. In autonomous
driving, a variety of such decisions with ethical implications are made by
algorithms for behavior and trajectory planning. Therefore, we present an
ethical trajectory planning algorithm with a framework that aims at a fair
distribution of risk among road users. Our implementation incorporates a
combination of five essential ethical principles: minimization of the overall
risk, priority for the worst-off, equal treatment of people, responsibility,
and maximum acceptable risk. To the best of the authors' knowledge, this is the
first ethical algorithm for trajectory planning of autonomous vehicles in line
with the 20 recommendations from the EU Commission expert group and with
general applicability to various traffic situations. We showcase the ethical
behavior of our algorithm in selected scenarios and provide an empirical
analysis of the ethical principles in 2000 scenarios. The code used in this
research is available as open-source software.
