I've been having issues with using the OpenDRIVE standalone feature on OpenDRIVE files that have been converted from OpenStreetMap files (using SUMO netconvert). I am not entirely sure whether this is an issue with SUMO or with the OpenDRIVE standalone mode, but I wanted to document it in case anyone has run into similar issues. I also wonder if anyone has been able to successfully convert and deploy OpenStreetMaps files corresponding to real-world environments in CARLA.
OSM to OpenDRIVE conversion
I tested using both the OpenStreetMap export tool and the SUMO osmGet.py script to extract OSM maps, and then I used NETCONVERT to convert these OSM maps into OpenDRIVE maps. In both cases, I got the following warning:
Warning: Could not write OpenDRIVE geoReference. Only unshifted Coordinate systems are supported
OpenDRIVE standalone mode
I then tried to render the resulting xodr file with CARLA's OpenDRIVE standalone mode (in CARLA 0.9.9.4) using config.py, and as expected the CARLA server detected that the geoReference tag was missing and crashed:
WARNING: cannot parse georeference: ''. Using default values.
Signal 11 caught.
To get around this, I tried inserting a geoReference tag with fake lat/long coordinates into the xodr file, but the CARLA server still crashed.
Could it be that the OpenDRIVE files coming from NETCONVERT are just corrupt somehow? If so, is there a better way to generate OpenDRIVE files that correspond to real-world data that can be parsed by CARLA?
@Axel1092 could you take care of this?
Hi @rohanb2018,
Yes, as you say SUMO's netconvert generates corrupt OpenDRIVE files (a problem with the junction record).
We are currently working on providing a way to import OSM information into Carla integrated in our API for the next release.
This will allow you to convert OSM to OpenDRIVE and load it with the standalone mode.
About the WARNING: cannot parse georeference: ''. Using default values. warning, it only indicates that there is no global localization information in the OpenDRIVE file but Carla does not need this information to run the simulation.
How to Export .xodr from SUMO netconvert. Have imported OSM file but how to get xodr file for it?
@sp062 netconvert produces broken OpenDRIVE which will crash when loading into carla. If you compile Carla from source you will find a new feature to convert OSM to XODR files. You can also use the packages here: https://github.com/carla-simulator/carla/blob/master/Docs/download.md#pre-release-0910 which also have these feature enabled but you need additional dependencies in linux (sudo apt-get install libxerces-c-dev)
Hi @Axel1092 , I love the new feature. Unfortunalety if I follow the tutorial (https://carla.readthedocs.io/en/latest/tuto_G_openstreetmap/) a warning is thrown.
Warning: Could not write OpenDRIVE geoReference. Only unshifted Coordinate systems are supported (offset=10805307.92,-4140722.51)
How should the input data look like to generate a georeferenced OpenDRIVE file?
Hi @TKeutgens, right now that feature is not supported, we are working on expanding this feature to add new projections to include geolocation information. A workarround for now is to include the geolocation information yourself into the resulting opendrive file.
Hi @Axel1092 thanks very much for your support! Is there an example or step-by-step guide for the workarround? I tried adding the geoGeoreference tag into the ODR file. As lat_0 and lon_0 I added the minlon and minlat parameters of the OSM file. But the results don't match my georeferenced satellite image. It also seems like there is a roation error in the ODR file. Do you have any information on this?
Hi, I'm also working with conversion from OpenStreetMap to OpenDrive and to import it to Carla. How can I use this new feature? I've downloaded the pre-release version 9.9.10 but I don't know how to use python API from this pre-release, when I run a python code using carla lib I just get:
Traceback (most recent call last):
File "config.py", line 28, in <module>
import carla
File "/home/lucas/.local/lib/python3.7/site-packages/carla/__init__.py", line 8, in <module>
from .libcarla import *
ImportError: libjpeg.so.8: cannot open shared object file: No such file or directory
@lucasnmatias it seems like you are missing a specific library required for running carla in your system. Here are some of the libraries you may be missing: sudo apt-get install libpng-dev libtiff5-dev libjpeg-dev libxml2-dev libxerces-c-dev
so, I got this osm converter working, but when I use road-runner review the xodr file, seems like the map was
distorted, any suggestions?
@Hanjinchao, can you import the map in carla with the standalone mode? python3 config.py --osm-path=path/to/osm in the util folder and check if the map is still distorted please?
so....for some reason my carla0.9.10 build does not work properly, I tried on Linux build and win build, the windows carla unreal editor does not show up, it will go straight to crash. For Linux, the Carla unreal editor will crash if I play it, so I can't really test it with the later version, but with carla0.9.9 I try to use the config.py -x
also.....is there any support for left-hand model? I am located in Japan, the osm data is left-hand by default
@Hanjinchao Do any messages show up with the crash? If the unreal crash report pops up I would like to take a look at it in order to help you to solve this issue.
The OSM support is for 0.9.10 on. And we do support left-hand traffic at the moment.
I suspect I got something wrong when I build the 0.9.10 carla, but the same result showed after I rebuild Carla.
here is the message when I try to run unreal editor:
BuildCarlaUE4.sh: line 151: 10623 Killed ${GDB} ${UE4_ROOT}/Engine/Binaries/Linux/UE4Editor "${PWD}/CarlaUE4.uproject" ${RHI}
Util/BuildTools/Linux.mk:7: recipe for target 'launch' failed
make: * [launch] Error 137
That's strange, I got 0.9.9 version running on the same machine, and it's all fine.
@Hanjinchao It seems that the ue4 editor is crashing (I think it is due to not enough memory could you share the system specs?).
Could you share the rest of the console log from make launch command if possible in order to be sure of the problem?
I can confirm that I experience the same projection distortion that @Hanjinchao reported above even when I just load an OSM file into Carla directly using the Python script python config.py --osm-path=map.osm . I describe the issue in detail and include images in this Carla forum post.
Any insight into whether this issue can be worked around and specifically how to do it?
I am having a similar problem while trying to follow the tutorial here
for generating a map from OpenStreetMap for CARLA. I see a similar warning when converting the .osm file from OpenStreetMap to .xodr for CARLA with the sample code provided in the tutorial. I am using CARLA 0.9.10.1.
Warning: Could not write OpenDRIVE geoReference. Only unshifted Coordinate systems are supported (offset=7685454.90,-4019034.71)
I overlooked the warning at first, but the map does not load properly in the next step using python config.py --osm-path=map.osm. I receive the following output.
Converting OSM data to opendrive
No nodes loaded.
Any information would be greatly appreciated.
I have solved my problem. The solution is here in the CARLA Docs. My map is loaded properly when I use the -x which makes sense for the .xodr file. I may have misread the first tutorial I mentioned in my previous comment.
This command works for me.
python3 config.py -x opendrive/TownBig.xodr
I realize that this may have been off topic...
Now that my map is loading, I can confirm that I am also experiencing the map distortion. I tested today with carla:latest.
Update:@Krxtopher, I have found a work around the distortion issue by using osm2xodr to convert which you can find here on github.
Now that my map is loading, I can confirm that I am also experiencing the map distortion. I tested today with
carla:latest.Update:@Krxtopher, I have found a work around the distortion issue by using
osm2xodrto convert which you can find here on github.
Hi! I am also experiencing the map distortion. I have used the method you have recommended by running OSM2XODRconv.py. However, it shows "AttributeError: 'Namespace' object has no attribute 'xodr_pathen'".
I don't know if I get it right.
Waiting for your reply, thank you!
I do not recognize that error, but I do notice that your script is called OSM2XODRconv.py. I used a script from osm2xodr called main.py to convert the map instead. Have you tried using this?
@thillRobot , I tried the osm2xodr project that you mentioned, but the .xodr file it produces (for a very simple OSM file) crashes Carla when I try to load it into the running simulation using Carla's config.py script. I don't have this problem when loading other .xodr files this way. Do you have any insight into what might be wrong? I noticed that the output file that osm2xodr produces has no \ Would you be able to provide me with a sample OSM file that you know works with that converter tool so I can better troubleshoot the issue?
@Krxtopher, I would be happy to share. You can get the .osm and the resulting .xodr files I have tested here at my github. I recommend starting with map1 because it is smaller and it is easier to find the road in spectator view. In the larger map0, I had to fly around to find the map. It reminded me of flight simulator.
Let me know if you get it going.
@thillRobot, thanks a lot for your advice. I successfully realized your example in SUMO and no distortion appears. Also, I can use osm2xodr.py to convert my osm to xodr. But when I use CARLA's netconvert_carla.py to convert xodr to net, it shows the error below:
Error: invalid byte '?' at position 1 of a 1-byte sequence
In file 'D:\HHYtest\test.xodr'
At line/column 879/70.
But, after checking my file, it doesn't exist '?' at that position.
Also, I noticed that the 'topomap.png' in main.py seems specific for the example map. Whether should I renew the 'topomap.png' for my own osm, and by how.
Looking forward to your reply, thanks!
You are welcome. It is good to hear that you got it working. I admit I am learning this as I go, and I do not have any information about net files. I have not encountered this file type in my project.
Regarding topomap.png, for my tests I left the topographieKartenPfad = unaltered, and the script still ran without errors. I also want to add custom topography, but there are different ways to do this. Have you looked at josm? I am working on my documents for using these different map files this week. and you can see them in the github I shared above. I am writing those notes for me, so use them at your own risk.
I really appreciate your help. Good luck with your study!