CommonRoad / commonroad-scenario-designer

Toolbox for Map Conversion and Scenario Creation for Autonomous Vehicles.
https://commonroad.in.tum.de/tools/scenario-designer
GNU General Public License v3.0
27 stars 9 forks source link

Sumo to Lanelet2 Conversion Issue #17

Open RichardXIA001 opened 6 months ago

RichardXIA001 commented 6 months ago

Hi, Our objective is to convert a SUMO map to Lanelet2 map, usually it will need to go through a process of sumo->opendrive->commonroad->lanelet2 map. However, after utilizing your pipeline, we noticed that the lane width in the resulting lanelet2 map is narrower than expected.

In an attempt to address this, we experimented with removing all longitude and latitude information from the original SUMO map. While this did improve the lane width in the final lanelet2 map, it led to inaccuracies in the overall scaling of the map. For instance, the radius of roundabouts in the lanelet2 map appeared significantly larger compared to the original SUMO map. Upon inspection, the lane width in the OpenDrive map appears to be correct.

We suspect that the issue may be related to the projection parameters, particularly because our required map is based in Michigan, USA. Despite our efforts to adjust the projection parameters to "NAD83" or set the UTM zone code to 17, the resulting map remains inaccurate. Now we don't know how to address this issue, and we are looking forward to your suggestion.

Many thanks for your help.

smaierhofer commented 6 months ago

Can you share the code which you use to convert from OpenDRIVE to Lanelet2, i.e., the part where you set the projections?

RichardXIA001 commented 6 months ago

Thank you for your prompt response. Here are the codes we're using to convert the map from OpenDRIVE to Lanelet2:

from crdesigner.common.config.general_config import general_config
from crdesigner.common.config.lanelet2_config import lanelet2_config
from crdesigner.common.config.opendrive_config import open_drive_config

# define configs
opendrive_config = open_drive_config

# for Plymouth, MI
# opendrive_config.proj_string_odr = "+proj=utm +zone=17 +ellps=WGS84"
lanelet2_config = lanelet2_config

general_config = general_config

# conversion
opendrive_to_lanelet(
    input_file=input_path,
    output_file=str(output_path),
    odr_config=opendrive_config,
    general_config=general_config,
    lanelet2_config=lanelet2_config,
)

I've experimented with adjusting the opendrive_config, lanelet2_config, and odr_config separately, but none of these attempts proved successful. Since I need to convert a map in Michigan, US, could you please provide some advice on how to adapt the projections properly?

Thank you for your assistance.

smaierhofer commented 6 months ago

Can you send me the OpenDRIVE map then I could debug it? It might be that the lanelet2 conversion currently only supports projections within Europe.

RichardXIA001 commented 6 months ago

Sure, and here is the OpenDrive map: plymouth_standard.zip

Using the opendrive_to_lanelet function directly yields a lanelet2 map that is narrower than expected. Despite expecting a width of 3.2 meters, it measures only 2.3 meters. We used the measurement plugin in JOSM to check lane width, and it looks like this: img_v3_02ae_4ff5a64e-a1aa-42a8-bc71-4ac42d3c7f2h

smaierhofer commented 6 months ago

I have looked at the problem but do not yet know a solution, as the applied projections should be correct. Lanelet2 must be defined in ETRF89 (see here). Therefore, it is hard-corded in our conversion as target projection. As source projection EPSG:3857 is used which should also be correct in this case. The width in the CommonRoad map looks correct. Therefore, the cause for the conversion issue is somewhere in the CommonRoad to lanelet2 conversion.

RichardXIA001 commented 6 months ago

Thanks for your reply! We will look into the CommonRoad to Lanelet2 conversion process more thoroughly. If we make any progress, we'll be sure to let your know.

Once again, we really appreciate your help.