Skip to content

A hybrid collision avoidance system combining Deep Reinforcement Learning with Model Predictive Control, designed for autonomous vehicles in CARLA to navigate scenarios with stationary obstacles.

License

Notifications You must be signed in to change notification settings

gustavomoers/CollisionAvoidance-Carla-DRL-MPC

Repository files navigation

Hybrid Collision Avoidance System for Autonomous Vehicles

Overview

This project develops a hybrid collision avoidance system for autonomous vehicles, combining Deep Reinforcement Learning (DRL) with a Model Predictive Control (MPC) approach. Utilizing the CARLA simulator, the system is designed to navigate scenarios where an ego car approaches a stationary vehicle. Essentialy, the RL agent works as a path planner module and the MPC controls the vehicle.

Model Description

The project employs Recurrent Proximal Policy Optimization (Recurrent PPO) from Stable Baselines3 for training the reinforcement learning model. The state space for the RL agent includes:

  • x_dist: Lateral distance from the parked car
  • y_dist: Longitudinal distance from the parked car
  • current_speed
  • current_acceleration
  • current_yaw

The action space consists of five continuous values (x1, y1, x2, y2, desired speed). These values are used to generate a cubic spline curve that defines the path for the MPC controller, which manages vehicle navigation based on the desired speed and path.

Results

The model demonstrates effective navigation and collision avoidance:

  • Generated Path Visualization: GIF showing the model's path planning in real-time at 90km/h with red markings to denote the RL-generated path at each timestep.

    Model Path Visualization

  • Performance Metrics: Graph depicting the reward received per timestep during training, indicating model performance and learning progress.

Reward vs. Timestep Graph

Dependencies

  • CARLA Simulator
  • Stable Baselines3
  • Additional dependencies as listed in requirements.txt

How to Run

To start the simulation and train the model:

  1. Adjust the parameters in train.py and other configuration files as needed.
  2. Run train.py to commence training and simulation.
  3. Monitor outputs and adjust parameters to optimize the training and path generation.

Contribution

Contributions to enhance the system or adapt it for different scenarios are welcome. Please fork the repository, propose changes via pull requests, or raise issues for discussion.

References

Special thanks to Carla-MPC by yangggzhang for the initial Model Predictive Control (MPC) implementation. This project uses a modified version of the Carla-MPC to integrate with our reinforcement learning model for enhanced path planning and control.

About

A hybrid collision avoidance system combining Deep Reinforcement Learning with Model Predictive Control, designed for autonomous vehicles in CARLA to navigate scenarios with stationary obstacles.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages