Interface between CommonRoad and the traffic simulator SUMO.
It allows you to run non-interactive simulations to generate traffic on lanelet networks to create new CommonRoad scenarios. Additionally, you can run interactive simulations where a motion planner is executed in tandem with SUMO. The ego vehicle is controlled by the motion planner, while the behavior of the other vehicles is simulated by SUMO.
More about the interface can be found in the original paper:
Moritz Klischat, Octav Dragoi, Mostafa Eissa, and Matthias Althoff, Coupling SUMO with a Motion Planning Framework for Automated Vehicles, SUMO 2019: Simulating Connected Urban Mobility
The interface is available on PyPI and can be easily installed:
$ pip install commonroad-sumoSUMO itself is already included as a dependency, therefore no further steps are required to use the interface.
The following snippet will simulate random traffic on the lanelet network of a given CommonRoad scenario for 100 time steps and write the resulting CommonRoad scenario to /tmp/simulated_scenario.xml:
from commonroad.common.file_reader import CommonRoadFileReader
from commonroad_sumo import NonInteractiveSumoSimulation
scenario, _ = CommonRoadFileReader("<path to CommonRoad scenario>").open()
simulation_result = NonInteractiveSumoSimulation.from_scenario(scenario).run(simulation_steps=100)
simulation_result.write_to_file("/tmp/simulated_scenario.xml")The full documentation can be found at cps.pages.gitlab.lrz.de/commonroad/sumo-interface.