Skip to content

This repository achieves an optimization-based unified decision-making and control for urban autonomous driving in Carla simulator.

Notifications You must be signed in to change notification settings

henryhcliu/udmc_carla

Repository files navigation

UDMC: Unified Decision-Making and Control Framework for Urban Autonomous Driving with Motion Prediction of Traffic Participants

License Version arXiv

This autonomous driving framework (named UDMC) is based on nonparametric Bayesian learning and optimization methods, so it is lightweight, interpretable, and adaptable to various driving scenarios.

Live demo: https://www.youtube.com/watch?v=jftTsf1jXjU.

Preprint: https://arxiv.org/abs/2501.02530.

Table of Contents

General Information

The Structure of the UDMC
  • This project contains the necessary code for our presented Unified Decision-Making and Control (UDMC) scheme for urban driving.
  • The purpose of this project is to build a uniformed, versatile and light-weighted autonomous driving framework for both decision-making and motion control.
  • This driving framework settles the complex traffic rule compliance problem using the artificial potential field (APF), rather than if-else commands in most current rule-based methods.
  • We tested it on varieties of scenarios (car following, overtaking, roundabout, intersection, T-junction, etc.) and CARLA Town05 Benchmark.

Technologies Used

  • Ubuntu 20.04
  • Python 3.8 with requirements.txt
  • CasADi 3.6.3
  • CARLA 0.9.14

Features

  • Lightweight Design
  • Interpretability
  • Broad Applicability for Urban Road Networks
  • Compliance with Traffic Regulations

Driving Demo

Driving Demo in the First-Person View

Roundabout Driving

Driving Demo in the Bird's-Eye View

Bird's-Eye View

Setup

Install anaconda

wget https://repo.anaconda.com/archive/Anaconda3-2020.11-Linux-x86_64.sh
bash Anaconda3-2020.11-Linux-x86_64.sh
source ~/.profile

Clone the repo and build the environment

git clone https://github.com/henryhcliu/udmc_carla.git
cd udmc_carla
conda create -n udmc_carla python=3.8
conda activate udmc_carla
pip3 install -r requirements.txt

Download and setup CARLA 0.9.14

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1AF1527DE64CB8D9
sudo add-apt-repository "deb [arch=amd64] http://dist.carla.org/carla $(lsb_release -sc) main"
sudo apt-get update # Update the Debian package index
sudo apt-get install carla-simulator=0.9.14 # Install the 0.9.14 CARLA version
cd /opt/carla-simulator # Open the folder where CARLA is installed
./CarlaUE4.sh

Usage

Before running the following codes, CARLA Simulator should be active.

cd /opt/carla-simulator # Open the folder where CARLA is installed
./CarlaUE4.sh

In another terminal:

cd udmc_carla # Open the folder where this repository exists

Run the UDMC with different driving scenario settings and surrounding vehicle spawn options

# Multilane ACC driving with randomly generated surrounding vehicles
python udmc_main.py multilaneACC True

# Roundabout driving with randomly generated surrounding vehicles
python udmc_main.py roundabout True

# Crossroad driving with randomly generated surrounding vehicles
python udmc_main.py crossroad True

# Unsignalized crossroad driving with randomly generated surrounding vehicles
python udmc_main.py unsig_crossroad True

# T-junction driving with pedestrians and randomly generated surrounding vehicles
python udmc_main.py mixed_traffic True

With runing the above command lines, the randomly generated initial spawn points of the traffic participants will be recorded in the folder spawnPoints. If you want to spawn surrounding vehicles with certain spawn points (to test the performance of different methods under the same condition), please change the last argument to False.

Run the Parameter Identification of the vehicle dynamics model

python param_est_using_slsqp.py

This program prints the estimated parameters to the terminal.

Run the Interpolation-based Gaussian Process Regression training process and store the GPR model to file

python IGPR_predict_sv_wps.py

Run the UDMC with CARLA Town05 Benchmark

Change to the branch of town05short, and then run the following command:

cd leaderboard/scripts
# Run the CARLA Town05 Benchmark automatically
./local_evaluation.sh 

Wait until the program is finished, and the evaluation result on the Town05 Short Benchmark can be inspected in the results folder.

File structure

If you want to modify this driving system to adapt to specific applications, please refer to the structure of this repository (main branch).

-data # contains the Potential Functions' value and the control input during autonomous driving
-images # contains the pictures captured by a camera mounted on the Ego Vehicle with T_s time step
-official # some official examples provided by CARLA (with our modification)
-scripts # core implementation of the UDMC
    - env.py # interact with CARLA, it includes spawn vehicles, initial visualization, and CARLA environment, etc.
    - others_agent.py # Be in charge of the behavior of other vehicles, like following the lane and changing lane
    - vehicle_obs.py # the UDMC core with traffic rules (lane keeping, not running to solid lane markings, not running a red light, etc)
    - x_v2x_agent.py # implement the main function, such as acc, overtaking, and parking
-spawnpoints # contains the spawn points for the surrounding vehicles when not using `random_spawn` mode
-utils # some third-party or commonly-used function
-fms_main.py # run this code to execute the same simulation in same surrounding conditions with udmc_main.py, but the Ego Vehicle uses Finite State Machine to control its motion
-IGPR_predict_sv_wps.py # use this code to train an IGPR model for surrounding vehicles' motion from 15 pieces of history state record to 10 pieces of future state prediction.
-udmc_main.py # main entrance of this paper, run it from the command line with an augment (crossroad, multilaneACC, roundabout,...), before that you need to launch CarlaUE4 following the instruction above.

Project Status

Project is: complete

Acknowledgements

Contact

Created by @henryhcliu - feel free to contact me!

License

This project is open source and available under the MIT License.

About

This repository achieves an optimization-based unified decision-making and control for urban autonomous driving in Carla simulator.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages