Skip to content

urbanAIthi/ROSA-RL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ROSA-RL: Uncertainty-aware Roundabout Optimized Speed Advisory with Reinforcement Learning

ROSA-RL enables safe and efficient roundabout entry for automated and human-driven vehicles in mixed traffic through probabilistic conflict forecasting. A Transformer-based model predicts conflict zone occupancy over a five-second horizon, capturing multi-agent interactions to anticipate upcoming conflicts and available gaps. The prediction outputs encode uncertainty in future motion and intent, and augment the state of a classical RL framework, enabling uncertainty-aware speed coordination. ROSA-RL is systematically evaluated by comparing RL-based and model-based speed advisory approaches across different prediction modalities, including ground-truth occupancy, occupancy prediction, and trajectory prediction with deterministic occupancy inference.

Installation

Prerequisites

Anaconda or Miniconda

Cloning the Repository

git clone git@github.com:urbanAIthi/ROSA-RL.git
cd ROSA-RL

Setting up the Conda Environment

Use the following command to create and activate the Conda environment based on the environment.yaml file:

conda env create -f environment.yaml --name rosa-rl
conda activate rosa-rl

Installing SUMO

This repository requires the Simulation of Urban MObility (SUMO) traffic simulator, version 1.25.0. For more information on how to install SUMO, please refer to https://sumo.dlr.de/docs/Installing/index.html. Simulation results may vary with other SUMO versions due to differences in the simulator.

Project Structure

ROSA-RL is organized into two main components:

1. prediction/ – Transformer-Based Prediction Models

occupancy_prediction/ - Zone-Centric Occupancy Prediction

Predicts conflict zone occupancy over a five-second horizon, modeling multi-agent interactions and uncertainty.

  • Model architecture: Shared Transformer Encoder → Five horizon-specific Transformer Encoders → Horizon-specific attention-based pooling → Horizon-specific MLP prediction head.
  • Input features: Position, velocity, acceleration (lateral/tangential), heading angle (sin/cos), and agent type.
  • Training: Supervised prediction over five-second horizon based on three-second history.
  • Output: Scalar occupancy scores per horizon step.
  • Evaluation: Binary classification of roundabout entry occupancy.
How to run
cd occupancy_prediction
python main.py

The prediction settings (model parameters, training options, etc.) can be modified in train_configs.yaml.

Structure
occupancy_prediction/  
  ├── configs/ # dir containing config files  
  ├── trained_models/ # dir containing the trained models  
  ├── utils/ # dir containing different utility functions  
  ├── generate_dataset_zone.py # file for dataset preprocessing  
  ├── models.py # file for model handling  
  ├── main.py # main file for starting the preprocessing-training-testing pipeline
  ├── trainer.py # file for training the prediction model
  ├── tester.py # file for testing the prediction model

trajectory_prediction/ - Agent-wise Trajectory Prediction

Predicts the trajectories of all agents at the roundabout over a five-second horizon.

  • Model architecture: Transformer Encoder with attention masking to capture agent dynamics and interactions.
  • Input features: Position, velocity, acceleration (lateral/tangential), heading angle (sin/cos), and agent type.
  • Training: Supervised single-step prediction based on three-second history.
  • Inference: Autoregressive prediction over a five-second horizon.
  • Output: Predicted trajectories including kinematic state (position, speed, acceleration, orientation).
  • Evaluation: ADE/FDE and binary classification of roundabout entry occupancy.
How to run
cd trajectory_prediction
python main.py

The prediction settings (model parameters, training options, etc.) can be modified in train_configs.yaml.

Structure
trajectory_prediction/  
  ├── configs/ # dir containing config files  
  ├── trained_models/ # dir containing the trained models  
  ├── utils/ # dir containing different utility functions  
  ├── generate_dataset_zone.py # file for dataset preprocessing  
  ├── models.py # file for model handling  
  ├── main.py # main file for starting the preprocessing-training-testing pipeline
  ├── trainer.py # file for training the prediction model
  ├── tester.py # file for testing the prediction model

rdb1/ - Dataset and Conflict Zone Definitions

Contains the original rdb1 dataset (.sqlite) from openDD used in this work (see https://l3pilot.eu/data/opendd.html), including conflict zone definitions and shapefiles for visualization.

rosa_datasets/ - Preprocessed Prediction Dataset

Contains the preprocessed dataset (.pkl) used for occupancy and trajectory prediction.

Note

Large files (.sqlite, .pkl in rdb1 and rosa_datasets) are managed with Git LFS. Ensure Git LFS is installed, or download the .sqlite file manually from openDD (placing it into the rdb1 folder).
If you prefer not to use the preprocessed .pkl file, it can simply be deleted. It will be automatically regenerated on code execution, though this may increase runtime.

2. speed_advisory/ – RL-based Speed Advisory and SUMO Simulation

Implements RL-based and model-based speed advisory algorithms and evaluates the approaches in real-world roundabout traffic scenarios modeled in SUMO.

  • Goal: Improve safety and efficiency by proactively adjusting vehicle speed based on probabilistic entry occupancy.
  • Functionality: RL-based or model-based calculation of optimal approach speed.
  • Evaluation: 6,600 real-world scenarios replicated from the test split of the openDD-based prediction dataset in SUMO. Evaluation metrics: fuel/energy consumption, emissions, travel time, waiting time, and stops.

How to run

cd speed_advisory
python run.py

The simulation settings (scenarios, vehicle type, etc.) and model settings (model-based vs. RL-based, ground-truth occupancy vs. trajectory prediction vs. occupancy prediction, uncertainty-aware or not) can be modified in config.ini.

Structure

speed_advisory/  
  ├── env/ # dir containing simulation environment files (evaluation, speed advisory)
  ├── runs/ # dir containing the trained RL agents  
  ├── sumo/ # dir containing sumo configuration files
  ├── utils/ # dir containing different utility functions  
  ├── config.ini # file for simulation settings
  ├── optimizable_scenarios.json # file containting optimizable scenarios (start times of the ego vehicle) across the test dataset
  ├── run.py # main file for starting the simulation

Citation

If you use this code in your research, please cite our paper:

@INPROCEEDINGS{ROSA-RL_Schlamp,
  author={Schlamp, Anna-Lena and Gerner, Jeremias and Bogenberger, Klaus and Huber, Werner and Schmidtner, Stefanie},
  booktitle={2026 IEEE International Conference on Intelligent Transportation Systems (ITSC)}, 
  title={ROSA-RL: Uncertainty-aware Roundabout Optimized Speed Advisory with Reinforcement Learning}, 
  year={2026},
}

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages