I have a couple of problems when trying to use crdesigner that I was hoping to get your guidance on.
I’m having issues with converting maps from OpenDRIVE to Lanelet2.
I have installed crdesigner and commoroad_dc using pip.
When loading crdesigner in my conda environment that is python 3.10 based, I get this warning:
/home/sofya/.local/lib/python3.10/site-packages/crdesigner/map_conversion/sumo_map/cr2sumo/converter.py:34: UserWarning: Unable to import commonroad_dc.pycrccosy, converting static scenario into interactive is not supported!
warnings.warn(
I believe this might be a sumo error, but I have also seen that I need commonroad_dc to resolve this warning. I have followed the tutorial and installed both packages. The warning still persists. When I convert OpenDRIVE map to CommonRoad, I get this message:
QObject::connect: Cannot queue arguments of type 'QTextCursor'
(Make sure 'QTextCursor' is registered using qRegisterMetaType().)
/home/sofya/.local/lib/python3.10/site-packages/shapely/linear.py:90: RuntimeWarning: invalid value encountered in line_locate_point
return lib.line_locate_point(line, other)
22-Jun-23 10:37:36 - INFO - update_max_step
22-Jun-23 10:37:36 - INFO - update_max_step
Conversion Ended
22-Jun-23 10:37:37 - INFO - update_max_step
22-Jun-23 10:37:37 - INFO - update_max_step
When converting from CommonRoad to Lanelet2, I get no messages.
The map seemed to have been transferred correctly into gui, but I’m suspecting that the conversion from CommonRoad to Lanelet2 is what is not working quite right.
Furthermore, when I do convert using crdesigner, I use TIER IV Account to check the map. I get error that map exists over multiple grid zones which is not true. That is not the case with regular Lanelet2 maps that were not converted.
I also created a python code from provided samples in CommonRoad.
# General Imports
import os
from lxml import etree
from commonroad.scenario.scenario import Tag
from commonroad.common.file_writer import CommonRoadFileWriter, OverwriteExistingFile
from commonroad.planning.planning_problem import PlanningProblemSet
from commonroad.common.file_reader import CommonRoadFileReader
#Chekcing dir
import os
print (os.getcwd())
#All code copied from https://commonroad.in.tum.de/tutorials/map-conversion
#FOR THE OpenDRIVE to Lanelet2
#input_path = "/home/sofya/Documents/OpenDrivetoCommonConverter" # replace empty string
name = "urban"
input_path = name+".xodr" #maybe sees from the terminal's dir?
output_path = name + ".osm"
#General API (OpenDRIVE to Common Road)
from crdesigner.map_conversion.map_conversion_interface import opendrive_to_commonroad
# load OpenDRIVE file, parse it, and convert it to a CommonRoad scenario
scenario = opendrive_to_commonroad(input_path)
# store converted file as CommonRoad scenario
writer = CommonRoadFileWriter(
scenario=scenario,
planning_problem_set=PlanningProblemSet(),
author="Sebastian Maierhofer",
affiliation="Technical University of Munich",
source="CommonRoad Scenario Designer",
tags={Tag.URBAN},
)
writer.write_to_file(os.path.dirname(os.path.realpath(__file__)) + "/" + "ZAM_OpenDRIVETest-1_1-T1.xml",
OverwriteExistingFile.ALWAYS)
#CommonRoad to Lanelet
input_path = "ZAM_OpenDRIVETest-1_1-T1.xml" # replace empty string
proj = "proj=utm +zone=32 +ellps=WGS84" # replace empty string
from crdesigner.map_conversion.map_conversion_interface import commonroad_to_lanelet
# load CommonRoad file and convert it to lanelet format
commonroad_to_lanelet(input_path, output_path, proj)
When I run it, I get this error
/home/sofya/Documents/hdmap_conversions
/home/sofya/.local/lib/python3.10/site-packages/crdesigner/map_conversion/opendrive/opendrive_parser/elements/roadLanes.py:607: UserWarning: Parser could not find value for road_mark.SOffset, 0 is used per default.
warnings.warn("Parser could not find value for road_mark.SOffset, 0 is used per default.")
Replace file /home/sofya/Documents/hdmap_conversions/ZAM_OpenDRIVETest-1_1-T1.xml
Traceback (most recent call last):
File "/home/sofya/Documents/hdmap_conversions/opendrive_to_lanelet.py", line 57, in <module>
commonroad_to_lanelet(input_path, output_path, proj)
File "/home/sofya/.local/lib/python3.10/site-packages/crdesigner/map_conversion/map_conversion_interface.py", line 77, in commonroad_to_lanelet
osm = l2osm(scenario)
File "/home/sofya/.local/lib/python3.10/site-packages/crdesigner/map_conversion/lanelet2/cr2lanelet.py", line 133, in __call__
self._convert_lanelet(lanelet)
File "/home/sofya/.local/lib/python3.10/site-packages/crdesigner/map_conversion/lanelet2/cr2lanelet.py", line 398, in _convert_lanelet
left_nodes, right_nodes = self._create_nodes(lanelet, left_way_id, right_way_id)
File "/home/sofya/.local/lib/python3.10/site-packages/crdesigner/map_conversion/lanelet2/cr2lanelet.py", line 467, in _create_nodes
left_nodes = self._create_nodes_from_vertices(lanelet.left_vertices[start_index:end_index])
File "/home/sofya/.local/lib/python3.10/site-packages/crdesigner/map_conversion/lanelet2/cr2lanelet.py", line 513, in _create_nodes_from_vertices
if self._config.use_local_coordinates:
AttributeError: 'str' object has no attribute 'use_local_coordinates'
I would prefer to use python script for the conversions, however, I can’t get either of the methods to work. Would someone be able to help me with this?
Furthermore, what tools do you guys use to check whether the map conversion is correct?
Also, my original OpenDRIVE map is an xodr export from RoadNetwork_Urban from dSPACE.