Sumo vehicles to common-road dynamic obstacles

Hi, I am working on interfacing SUMO with commonroad and I’m using the repository commonroad-sumo-interface however, although the file inside the repository named as minimal_example.py is getting all data from sumo simulation I’m not able to understand how should I do this for a custom SUMO cfg file. I’m aware that I’ve to generate .net.xml and .rou.xml files however, even after generation both these files, I’m not getting any vehicle data in commonroad. After reading how the system (Sumo<=>OpenDRIVE<=>Commonroad) works I saw that there is no data for vehicles in openDRIVE itself, the .xodr file has empty <object> tag. To use that I put the --polygon-files flag however that’s not working as well and the tag is still empty.

Currently I’m able to retrieve the vehicle positions on respective lanes from Sumo using --ndump flag. However, unless I’m able to get a conversion from Sumo to Commonroad this data is useless for me.

Summarising: I’m not able to convert Sumo vehicle data into commonroad obstacles for any general scenario file generated using osm webwizard. Some insights on the problem and how exactly this conversion takes place will be helpful.

Thanks in advance.

The Sumo CommonRoad interface is an interface to connect to a running Sumo Simulation and provides obstacles from the simulation in Commonroad format. So it’s not possible to obtain a Commonroad XML with obstacles just via a direct conversion.

So in order to obtain a Commonroad scenario with obstacles, you first need to generate the required files https://gitlab.lrz.de/tum-cps/commonroad-sumo-interface/-/blob/master/example_scripts/create_scenario_files.py. The vehicle data is then contained in the .rou file. Afterwards, run a simulation as described in the example here https://gitlab.lrz.de/tum-cps/commonroad-sumo-interface/-/blob/master/example_scripts/minimal_example.py. At each time step of the simulation, you can obtain the current state of the simulation in commonroad format as done here https://gitlab.lrz.de/tum-cps/commonroad-sumo-interface/-/blob/master/example_scripts/minimal_example.py#L23

Best regards,
Moritz

@mklischat I’m generating .rou.xml file for my own .sumo.cfg file that i created. However, I’m not able to get any dynamic obstacles and I further want to perform motion planning on this. Something like the batch processing example. The .cr.xml file in batch processing example has both obstacle data and the lanelet data, so how should I get the vehicle data in this .cr.xml file of mine that I will generate using opendrive2lanelet converter by running on .rou.xml file that’ll be made by create_scenario_files.py?

If you mean this tutorial https://commonroad.in.tum.de/tutorial-batch-procesing, that’s not a tutorial on the sumo interface, but only using our standard commonroad xml files. However, in these files we only have predefined trajectories for all obstacles and they don’t react to the ego vehicle like in the Sumo simulation.

As I said, the sumo-interface doesn’t create our standard Commonroad files with obstacles, but provides an interface to the sumo simulation. It fetches the vehicles from the sumo simulation and provides them at every simulation step. How this works is described in the provided example script.

Perhaps a look at our paper makes the work flow clear http://mediatum.ub.tum.de/doc/1486856/344641.pdf

Yeah, sorry I should have mentioned on my behalf that I was trying to work with the two simultaneously. So, how do i generate these trajectories that I already have in SUMO for dynamic obstacles into common road format. Anyway possible? At the end I just need trajectories of these vehicles in commonroad for my testing.

In this line you obtain the scenario https://gitlab.lrz.de/tum-cps/commonroad-sumo-interface/-/blob/master/example_scripts/minimal_example.py#L23

1 Like

Thanks able to extract the states of obstacle vehicles from this.