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.
git clone git@github.com:urbanAIthi/ROSA-RL.git
cd ROSA-RLUse 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-rlThis 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.
ROSA-RL is organized into two main components:
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.
cd occupancy_prediction
python main.pyThe prediction settings (model parameters, training options, etc.) can be modified in train_configs.yaml.
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
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.
cd trajectory_prediction
python main.pyThe prediction settings (model parameters, training options, etc.) can be modified in train_configs.yaml.
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
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.
Contains the preprocessed dataset (.pkl) used for occupancy and trajectory prediction.
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.
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.
cd speed_advisory
python run.pyThe 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.
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
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},
}This project is licensed under the MIT License. See the LICENSE file for details.