Curvilinear Coordinate System

Hi all!
I went through the tutorial “06_curvilinear_coordinate_system.ipynb” but I have trouble to create a frame for a given lane-let.

Can you provide the code using e.g. the first lane as reference frame, and thereafter, transform all the other lanes into the corresponding frame? Is there a function that returns the lane number of a reference point?

Best regards and thank you,
Rudolf

Hi Rudolf,

if I understand correctly, you want to extract a lane (i.e., a sequence of lanelets) from the road network and then use the centerline to construct the coordinate frame.

If you have a desired initial start lanelet, you can generate a list of merged lanelets of the successors of the start lanelet by using the function all_lanelets_by_merging_successors_from_lanelet() from the Lanelet class in commonroad-io.

Another option: if you explicitly have the lanelet IDs you want to create a lane, you can also merge those directly. Below an example code snippet how one could do that (here for scenario USA_Peach-2_1_T-1.xml)

 # manually merge lanelets
starting_lanelet_id = 53792
lanelet_ids_to_merge = [53796 ,53802 ,53808 ,53814 ,53862 ,53894 ,53902 ,53842]

lanelet_network = scenario.lanelet_network
lane = lanelet_network.find_lanelet_by_id(starting_lanelet_id)
for lanelet_id_to_merge in lanelet_ids_to_merge:
    lanelet_to_merge = lanelet_network.find_lanelet_by_id(lanelet_id_to_merge)
    lane = Lanelet.merge_lanelets(lane, lanelet_to_merge)

# obtain centerline of concatenated lanelets
ref_path = lane.center_vertices

Hope this helps.

Best,
Gerald

1 Like

Thanks for the response!