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

lanelet2 Graph #377

Closed
ramdort opened this issue Dec 12, 2024 · 4 comments
Closed

lanelet2 Graph #377

ramdort opened this issue Dec 12, 2024 · 4 comments

Comments

@ramdort
Copy link

ramdort commented Dec 12, 2024

Hello All,
I have a lanelet2 format of map1 of carla. I have converted it to graphfile .gv now each lanelet of the map is a node on the graph.
I want to find a way to know what does each node on a graph represent on the map. In other words, I need a function that takes the longitudinal and lateral coordinates and returns to me the corresponding node in the graph. does the API offer that, how can i make the graph keeps the geographical information to it ? any guiding for this task is appreciated

Regards,

@poggenhans
Copy link
Contributor

@ramdort
Copy link
Author

ramdort commented Dec 18, 2024

I am trying to use findNearest function however I got bad results probably due to some projections problem.
I have

  1. converted the opendrive map Town01.xodr to lanelet using commonroad running the following command,
    crdesigner --input-file Town01.xodr --output-file Town01.osm odrlanelet2 according to this it does not perform any coordinate conversions. Now we this 2 lines are from opendrive map
revMajor="1" revMinor="4" name="" version="1" date="2019-04-06T10:38:28" north="2.8349990809409476e+1" south="-3.5690998535156251e+2" east="4.226810576241>
        <!--<geoReference><![CDATA[+lat_0=4.9000000000000000e+1 +lon_0=8.0000000000000000e+0]]> </geoReference> -->
                <!-- this line causes a problem related to projection remove it and keep the below 2 lines -->
            <!-- the below 2 lines avoid that problem when executing the following command oin the terminal -->
            <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]]></geoRefe>
            <geoReference><![CDATA[+proj=utm +zone=32 +datum=WGS84 +units=m +no_defs]]></geoReference>
  1. defined my origin = lanelet2.io.Origin(50.99856538,10.0029222) and then use the UTM projector and then calling findNearst to find the closest lanelets to the origin, I got their distance non sense values
Distance: 4225194.346952304, Lanelet ID: 31183
  1. got more confused when I checked the JOSM projection setting and they were also different
  2. tried using pyproj to perform specific projections before calling findNearest and same thing I got non sense results as well.

there are 2 main question,
how to define my Origin of the map and how significant it is , and how should i change my procedure to get reasonable results when calling findNearest ?

Thanks

@smaierhofer
Copy link

smaierhofer commented Dec 19, 2024

since we are not using the lanelet2 API/tool, I cannot help here.

@ramdort
Copy link
Author

ramdort commented Jan 2, 2025

I wanna add a few comments. The wrong distance is due to projection error. I have solved this problem by , define the origin and project it and load the projected origin to the load function as the following lines

origin= lanelet2.io.Origin(50.997029,10.000145)
projected_origin = UtmProjector(origin)
lanelet_map_search = lanelet2.io.load(map_path_search, projected_origin) 

which makes this issue closed.
I want to ask if I can specify the type that the function findNearst returns like I want the Lanelet of attribute road not walkway or other attributes ? I used a naive approach of window search of lanelet till findNearts finds the first lanelet of attribute road

@ramdort ramdort closed this as completed Jan 2, 2025
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

3 participants