Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Opendrive Conversion of map1.xodr from CARLA #22

Open
ramdort opened this issue Nov 7, 2024 · 11 comments
Open

Opendrive Conversion of map1.xodr from CARLA #22

ramdort opened this issue Nov 7, 2024 · 11 comments

Comments

@ramdort
Copy link

ramdort commented Nov 7, 2024

I want to convert the Carla sample maps from opendrive to lanelets. By running this command crdesigner --input-file Town01.xodr --output-file Town01.osm odrlanelet2 i get this error.
CRSError: Invalid projection: +lat_0=4.9000000000000000e+1 +lon_0=8.0000000000000000e+0 +type=crs: (Internal Proj Error: proj_create: unrecognized format / unknown
name)
The map file can be found here
Could elaborate on that how to deal with ?
I have used other maps , I get always some warnings also related to projections from lanelet Default origin should not be used when writing into a format that uses georeferenced lat/lon coordinates. Will continue to write the map, but the data will be dislocated and deformed

@smaierhofer
Copy link
Contributor

If you use the Python script, setting
open_drive_config.proj_string_odr = None
should solve the problem.

It is currently not possible to do this from the command line.

@ramdort
Copy link
Author

ramdort commented Nov 8, 2024

I am trying to do it in a script

from crdesigner.common.config import opendrive_config 
config = opendrive_config
config.proj_string_odr = None;

note there are difference between your and what is available to me in the script however when I run it I got an error
image

Thanks again in advance

@smaierhofer
Copy link
Contributor

Are you using the function opendrive_to_commonroad in your script?
If not, please use this function.
Also provide as odr_conf argument the config object.

config = open_drive_config
config.proj_string_odr = None

scenario = opendrive_to_commonroad(input_path, odr_conf=config)

@ramdort
Copy link
Author

ramdort commented Nov 12, 2024

I do, see the figure
image

@smaierhofer
Copy link
Contributor

smaierhofer commented Nov 12, 2024

Which version of the scenario-designer do you have installed?

@ramdort
Copy link
Author

ramdort commented Nov 12, 2024

See pictures, I have reported a bug earlier and have been recommend to get the debugged version of commonroad-scenario-designer from the develop branch
image
image

@ramdort
Copy link
Author

ramdort commented Nov 12, 2024

I have edited the opendrive map and change the coordinates to other values as the following 2 lines

<geoReference><![CDATA[+proj=tmerc +lat_0=5.1000000000000000e+1 +lon_0=1.0000000000000000e+1 +k=1 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs]]></geoReference>
<geoReference><![CDATA[+proj=utm +zone=32 +datum=WGS84 +units=m +no_defs]]></geoReference>

@ramdort ramdort closed this as completed Nov 12, 2024
@smaierhofer
Copy link
Contributor

I also just tried the develop branch again and for me the following code snippet works.
Maybe the Python environment is corrupted and somehow and older version of the scenario-designer is used.

import os
from pathlib import Path

from commonroad.planning.planning_problem import PlanningProblemSet
from commonroad.scenario.scenario import Tag

from crdesigner.common.config.opendrive_config import open_drive_config
from crdesigner.common.file_writer import CRDesignerFileWriter, OverwriteExistingFile
from crdesigner.map_conversion.map_conversion_interface import opendrive_to_commonroad

input_path = Path("/path/to/file/Town01.xodr")
output_path = Path("/path/to/file/Town01.xml")

config = open_drive_config
config.proj_string_odr = None

# load OpenDRIVE file, parse it, and convert it to a CommonRoad scenario
scenario = opendrive_to_commonroad(input_path, odr_conf=config)

# store converted file as CommonRoad scenario
writer = CRDesignerFileWriter(
    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(str(output_path), OverwriteExistingFile.ALWAYS)

Updating, the geo-reference might lead to wrong results.
From my experience, removing it completely is the better option (corresponds to setting the config.proj_string_odr = None in our code).

@ramdort
Copy link
Author

ramdort commented Nov 13, 2024

It works fine but another problem appeard the file is no longer readable by JOSM.
josm Town02.osm Using /usr/lib/jvm/java-21-openjdk-amd64/bin/java to execute josm. 2024-11-13 12:21:43.004 INFO: Log level is at INFO (INFO, 800) 2024-11-13 12:21:43.452 INFO: Detected usable IPv6 network, preferring IPv6 over IPv4. 2024-11-13 12:21:44.949 INFO: Obtained 168 Tag2Link rules from resource://META-INF/resources/webjars/tag2link/2024.10.21/index.json 2024-11-13 12:21:46.121 SEVERE: Failed to locate image 'presets/vehicle/firebrigade.svg' 2024-11-13 12:21:46.122 WARNING: Emergency lane: Could not get presets icon presets/vehicle/firebrigade.svg 2024-11-13 12:21:46.126 SEVERE: Failed to locate image 'road_border.png' 2024-11-13 12:21:46.127 WARNING: Road border: Could not get presets icon road_border.png 2024-11-13 12:21:46.127 SEVERE: Failed to locate image '101.png' 2024-11-13 12:21:46.127 WARNING: Generic traffic sign: Could not get presets icon 101.png 2024-11-13 12:21:46.128 SEVERE: Failed to locate image 'pf-g.png' 2024-11-13 12:21:46.128 WARNING: Arrow: Could not get presets icon pf-g.png 2024-11-13 12:21:46.258 INFO: Could not load tool definition splitway 2024-11-13 12:21:46.263 WARNING: Cannot lock cache directory. Will not use disk cache 2024-11-13 12:21:46.384 INFO: Changeset updater active (checks every 60 minutes if open changesets have been closed) 2024-11-13 12:21:46.434 INFO: Open file: /path/to/Town02.osm (2376461 bytes) 2024-11-13 12:21:46.437 INFO: Undefined element 'commonRoad' found in input stream. Skipping. 2024-11-13 12:21:46.921 INFO: Open file: /home/ /path/to/Town02.osm (2376461 bytes) completed in 488 ms

@smaierhofer
Copy link
Contributor

I just converted Town02 to Lanelet2 and for me loading the map in JOSM works.

@ramdort
Copy link
Author

ramdort commented Dec 19, 2024

I want to add a point. I have converted the maps using the following command
crdesigner --input-file Town01.xodr --output-file Town01new.osm odrlanelet2
when I want to use some lanelet2 functionalities regrading distances I got a wrong high value. specifically findNearest function. In lanelet the points are projected to x,y before calling findNearest and I think that some wrong conversion from crdesigner please have on this issue
thanks

@ramdort ramdort reopened this Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants