{"id":22746008,"url":"https://github.com/tumftm/ethicaltrajectoryplanning","last_synced_at":"2025-04-13T06:37:33.495Z","repository":{"id":37449236,"uuid":"491550412","full_name":"TUMFTM/EthicalTrajectoryPlanning","owner":"TUMFTM","description":"An Ethical Trajectory Planning Algorithm for Autonomous Vehicles","archived":false,"fork":false,"pushed_at":"2023-07-27T08:00:20.000Z","size":1871,"stargazers_count":215,"open_issues_count":1,"forks_count":35,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-26T23:06:47.551Z","etag":null,"topics":["autonomous-driving","ethics","planning","risk","trajectory"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TUMFTM.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-05-12T14:35:01.000Z","updated_at":"2025-03-24T07:17:50.000Z","dependencies_parsed_at":"2023-02-10T10:15:48.423Z","dependency_job_id":"41a61a95-a88a-4018-af25-2598c038b073","html_url":"https://github.com/TUMFTM/EthicalTrajectoryPlanning","commit_stats":{"total_commits":17,"total_committers":2,"mean_commits":8.5,"dds":0.05882352941176472,"last_synced_commit":"bf1c52ab0414214224f9a1cfdcba577e743a32b5"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TUMFTM%2FEthicalTrajectoryPlanning","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TUMFTM%2FEthicalTrajectoryPlanning/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TUMFTM%2FEthicalTrajectoryPlanning/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TUMFTM%2FEthicalTrajectoryPlanning/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TUMFTM","download_url":"https://codeload.github.com/TUMFTM/EthicalTrajectoryPlanning/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248675352,"owners_count":21143763,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["autonomous-driving","ethics","planning","risk","trajectory"],"created_at":"2024-12-11T02:09:52.798Z","updated_at":"2025-04-13T06:37:33.463Z","avatar_url":"https://github.com/TUMFTM.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![DOI](https://zenodo.org/badge/491550412.svg)](https://zenodo.org/badge/latestdoi/491550412)\n[![Linux](https://img.shields.io/badge/os-linux-blue.svg)](https://www.linux.org/)\n[![Python 3.8](https://img.shields.io/badge/python-3.8-blue.svg)](https://www.python.org/downloads/release/python-380/)\n[![GPLv3 license](https://img.shields.io/badge/License-GPLv3-blue.svg)](http://perso.crans.org/besson/LICENSE.html)\n[![GitHub version](https://badge.fury.io/gh/TUMFTM%2FEthicalTrajectoryPlanning.svg)](https://badge.fury.io/gh/TUMFTM%2FEthicalTrajectoryPlanning)\n# An Ethical Trajectory Planning Algorithm for Autonomous Vehicles\n\n\u003cimg src=\"./readme/overview.png\" width=\"770\" height=\"300\"\u003e\n\n\nThis repository includes comprehensive ethical trajectory planning software. Its core consists of a quantification of risks in the motion planning of autonomous vehicles and a subsequent fair distribution of risk. The algorithm is compatible to the simulation environment [CommonRoad](https://commonroad.in.tum.de/) and can be evaluated and tested empirically. Further information can be found in the paper (see [References](#references)).\n\n## System Requirements\n* Operating System: Linux Ubuntu (tested on 20.04)\n* Programming Language: Python \u003e= 3.7 (tested on 3.8)\n* [Software Dependencies](/requirements.txt)\n\n## Installation\n\nThe installation of this repository takes around 10 min and consists of three steps.\nWe recommend using an isolated [virtual environment](https://pypi.org/project/virtualenv/) for installation.\n\n1. Clone this repository with:\n\n    `git clone https://github.com/TUMFTM/EthicalTrajectoryPlanning.git`\n\n2. Navigate to the root folder of the repository (`[..]/EthicalTrajectoryPlanning`) and install requirements:\n\n    `pip install -r requirements.txt`\n\n3. Download [CommonRoad scenarios](https://gitlab.lrz.de/tum-cps/commonroad-scenarios) by cloning the scneario repository next to this repository:\n\n    `git clone https://gitlab.lrz.de/tum-cps/commonroad-scenarios`\n\n    so that you have the following folder structure:\n\n    ```\n    ├── EthicalTrajectoryPlanning (This repository)\n    ├── commonroad-scenarios\n    ```\n\n    [Results](#how-to-reproduce-results) were obtained with commonroad-scenarios at commit `35b9cfb5b89d33249ea0d5507b9465650ebeb289`.\n    Instead of cloning you can download and unpack this commit directly with:\n    \n    `wget -c  https://gitlab.lrz.de/tum-cps/commonroad-scenarios/-/archive/35b9cfb5b89d33249ea0d5507b9465650ebeb289/commonroad-scenarios-35b9cfb5b89d33249ea0d5507b9465650ebeb289.tar.gz -O - | tar -xz`\n\n## Quick Start Demo\n\nTo run the ethical planner on an exemplary default scenario, execute the following command from the root directory of this repository:\n    \n* `python planner/Frenet/frenet_planner.py`\n\n![Exemplary Result](readme/running_sample.gif)\n\nYou will see a live visualization of the scenario being solved by the planner.\nNow you can start with your own experiments by changing the [configs](/planner/Frenet/configs/README.md) or selecting another scenario by adding\n\n* `--scenario \u003cpath-to-scenario\u003e`\n\nto the command.\n\nBy default logs are saved and can be analyzed afterwards by running:\n\n* `python planner/Frenet/analyze_tools/analyze_log.py`\n\n\n[\u003cimg src=\"./readme/log_analysis.png\" width=\"450\" height=\"250\"\u003e](/readme/log_analysis.png)\n\n\n## How to reproduce results\n\nThe idea and basic principles of this algorithm are presented in Geisslinger et al. 2023\u003csup\u003e1\u003c/sup\u003e. The following describes how the results from the paper can be reproduced. To evaluate the planning algorithm on multiple scenarios execute:\n\n* `python planner/Frenet/plannertools/evaluatefrenet.py`\n\nBy default a single scenario from all available scenarios is randomly chosen. The number of evaluation scenarios can be changed with the `limit_scenarios` variable in the script or by adding `--all` to the command to evaluate on all available scenarios.\n\nTo evaluate with the according config settings of [ethical](/planner/Frenet/configs/weights_ethical.json), [ego](/planner/Frenet/configs/weights_ego.json) and [standard](/planner/Frenet/configs/weights_standard.json), add an according argument, for example:\n\n* `python planner/Frenet/plannertools/evaluatefrenet.py --weights ethical --all`\n\nTo evaluate on all 2000 scenarios, make sure to have at least 200 GB space left on your device for saving the log files. For better runtime, we recommend using [multiprocessing](/planner/Frenet/plannertools/evaluatefrenet.py#L46) and a [GPU](planner/Frenet/configs/prediction.json#L4) for the prediction network. Evaluating all scenarios in 10 parallel threads with a GPU takes around 48 hours. Results and logfiles for each run are stored in `planner/Frenet/results`.\n\nStandard evaluation metrics such as cummulated harm on all scenarios are provided within the results (e.g. `results/eval/harm.json`). `planner/Frenet/analyze_tools/analyze_risk_dist.py` helps to extract risk values out of multiple logfiles. Boxplots with risk distribtuions as in Geisslinger et al. 2023\u003csup\u003e1\u003c/sup\u003e can be generated using `planner/Frenet/plot_tools/boxplots_risks.py`.\n\n\n## References\n\n1. Geisslinger, M., Poszler, F. \u0026 Lienkamp, M. An ethical trajectory planning algorithm for autonomous vehicles. Nat Mach Intell (2023). https://doi.org/10.1038/s42256-022-00607-z\n2. Geisslinger, M., Trauth, R., Kaljavesi G. \u0026 Lienkamp M. Maximum Acceptable Risk as Criterion for Decision-Making in Autonomous Vehicle Trajectory Planning. IEEE Open Journal of Intelligent Transportation Systems (2023). DOI:10.1109/OJITS.2023.3298973\n\n## Contributions\n* Maximilian Geisslinger (Main Contributor, [maximilian.geisslinger@tum.de](mailto:maximilian.geisslinger@tum.de?subject=[GitHub]%20Ethical%20Trajectory%20Planning))\n* Rainer Trauth (Computing Performance)\n* Florian Pfab (Master Thesis: *Motion Planning with Risk Assessment for Automated Vehicles*)\n* Simon Sagmeister (Master Thesis: *Neural Networks: Real-time Capable Trajectory Planning through Supervised Learning*)\n* Tobias Geissenberger (Bachelor Thesis: *Harm Prediction for Risk-Aware Motion Planning of Automated Vehicles*)\n* Clemens Krispler (Bachelor Thesis: *Motion Planning for Autonomous Vehicles: Developing a Principle of Responsibility for Ethical Decision-Making*)\n* Zhi Zheng (Semester Thesis: *Parallelization of a Planning Algorithm in the Field of Autonomous Driving* supervised by Rainer Trauth)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftumftm%2Fethicaltrajectoryplanning","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftumftm%2Fethicaltrajectoryplanning","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftumftm%2Fethicaltrajectoryplanning/lists"}