2024-09-05
Exciting news! FREA is accepted by CoRL 2024 for Oral Presentation??!
2024-08-10
Explore our project page, now live here?!2024-08-10
Codes are now release!2024-06-05
Our paper is available on Arxiv?!This repository contains the implementation of the paper.
FREA: Feasibility-Guided Generation of Safety-Critical Scenarios with Reasonable Adversariality
Keyu Chen1 , Yuheng Lei2, Hao Cheng1, Haoran Wu1, Wenchao Sun1, Sifa Zheng1
1School of Vehicle and Mobility, Tsinghua University 2The University of Hong Kong
If you find our work useful, Please give us a star ?!
? FREA incorporates feasibility as guidance to generate adversarial yet AV-feasible, safety-critical scenarios.
Recommended system: Ubuntu 20.04 or 22.04
Step 1: Install Carla (0.9.13 recommended)
Step 2: Setup conda environment
conda create -n frea python=3.8
conda activate frea
Step 3: Clone this git repo in an appropriate folder
git clone [email protected]:CurryChen77/FREA.git
Step 4: Enter the repo root folder and install the packages:
cd FREA
pip install -r requirements.txt
pip install -e .
# Launch CARLA
./CarlaUE4.sh -prefernvidia -RenderOffScreen -carla-port=2000
# Launch in another terminal
python scripts/run.py --agent_cfg expert.yaml --scenario_cfg standard_train.yaml --mode collect_feasibility_data
# Merge data
python frea/feasibility/unify_offline_data.py
To use the offline dataset in our paper download from here put them into the feasibility
folder.
# Train optimal feasible value function of AV
python train_feasibility.py
# Launch CARLA
./CarlaUE4.sh -prefernvidia -RenderOffScreen -carla-port=2000
# Train FREA
python scripts/run.py --agent_cfg expert.yaml --scenario_cfg fppo_adv_train.yaml --mode train_scenario
# Launch CARLA
./CarlaUE4.sh -prefernvidia -RenderOffScreen -carla-port=2000
# Train FPPO-RS
python scripts/run.py --agent_cfg expert.yaml --scenario_cfg fppo_rs_train.yaml --mode train_scenario
# Launch CARLA
./CarlaUE4.sh -prefernvidia -RenderOffScreen -carla-port=2000
# Train PPO
python scripts/run.py --agent_cfg expert.yaml --scenario_cfg ppo_train.yaml --mode train_scenario
# Launch CARLA
./CarlaUE4.sh -prefernvidia -RenderOffScreen -carla-port=2000
# Train FREA
python scripts/run.py --agent_cfg ppo.yaml --scenario_cfg fppo_adv_train.yaml --mode train_agent
# Launch CARLA
./CarlaUE4.sh -prefernvidia -RenderOffScreen -carla-port=2000
# Train FREA
python scripts/run.py --agent_cfg ppo.yaml --scenario_cfg standard_train.yaml --mode train_agent
# Launch CARLA
./CarlaUE4.sh -prefernvidia -windowed -carla-port=2000
# Evaluation FREA
python scripts/run.py --agent_cfg expert.yaml --scenario_cfg FPPO_adv_eval.yaml --mode eval --eval_mode analysis
# Launch CARLA
./CarlaUE4.sh -prefernvidia -windowed -carla-port=2000
# Evaluation FREA
python scripts/run.py --agent_cfg expert.yaml --scenario_cfg FPPO_adv_eval.yaml --mode eval --eval_mode render
Make sure the Evaluation has finished and the result are saved in folder.
# Process the recorded data
python eval_analysis/process_data/process_all_data.py
# Plot the evaluation result
python eval_analysis/plot_data/plot_evaluation_result.py
# Launch CARLA
./CarlaUE4.sh -prefernvidia -windowed -carla-port=2000
# Set world spectator
python scripts/run.py --agent_cfg expert.yaml --scenario_cfg standard_eval.yaml --mode eval -sp
# Launch CARLA
./CarlaUE4.sh -prefernvidia -windowed -carla-port=2000
# Visualize AV route
python scripts/run.py --agent_cfg expert.yaml --scenario_cfg standard_eval.yaml --mode eval -viz_route
# Launch CARLA
./CarlaUE4.sh -prefernvidia -windowed -carla-port=2000
# Visualize BEV map
python scripts/run.py --agent_cfg expert.yaml --scenario_cfg FPPO_adv_eval.yaml --mode eval --eval_mode render
If you find our paper useful, please kindly cite us via:
@inproceedings{
chen2024frea,
title={{FREA}: Feasibility-Guided Generation of Safety-Critical Scenarios with Reasonable Adversariality},
author={Keyu Chen and Yuheng Lei and Hao Cheng and Haoran Wu and Wenchao Sun and Sifa Zheng},
booktitle={8th Annual Conference on Robot Learning},
year={2024},
url={https://openreview.net/forum?id=3bcujpPikC}
}
This implementation is based on code from several repositories. We sincerely thank the authors for their awesome work.