carla icon indicating copy to clipboard operation
carla copied to clipboard

load external xodr cause segmentation fault

Open SdKay opened this issue 1 year ago • 7 comments
trafficstars

  • CARLA version: 0.9.13
  • Platform/OS: ubuntu20.04
  • Problem you have experienced: xodr load segmentation fault
  • What you expected to happen: xodr load success
  • Steps to reproduce:
    • test code:
import sys
import os
import carla

client = carla.Client('localhost', 2000)
client.set_timeout(10.0)

with open('town01.xodr', encoding='utf-8') as od_file:
#with open('faild.xodr', encoding='utf-8') as od_file:
    try:
        data = od_file.read()
    except OSError:
        print('file could not be readed.')
        sys.exit()

vertex_distance = 2.0  
max_road_length = 500.0 
wall_height = 1.0       
extra_width = 0.6      
world = client.generate_opendrive_world(
    data, 
    carla.OpendriveGenerationParameters(
        vertex_distance=vertex_distance,
        max_road_length=max_road_length,
        wall_height=wall_height,
        additional_width=extra_width,
        smooth_junctions=True,
        enable_mesh_visibility=True
    )
)

tm = client.get_trafficmanager(8000)   # segmentation fault here!!

town01.xodr can be generate world and call client.get_trafficmanager normally, but faild.xodr cracked when call client.get_trafficmanager

  • gdb debug info:

Screenshot from 2024-04-26 10-20-39

I found the problem code here in InMemoryMap.cpp:431, vector traversed_waypoints is empty,

              int16_t current_angle = static_cast<int16_t>(traversed_waypoints.front()->GetTransform().rotation.yaw);
              int16_t junction_end_angle = static_cast<int16_t>(traversed_waypoints.back()->GetTransform().rotation.yaw);

But why traversed_waypoints is empty, Does the faild.xodr file have anythong wrong?

here is the test map: xodr.zip

SdKay avatar Apr 26 '24 02:04 SdKay

Could you try this with 0.9.15 or latest dev branch?

Blyron avatar Apr 26 '24 08:04 Blyron

It is hard to check an openDRIVE file without a tool, because the file can get big fast. I normally check with https://odrviewer.io/ if the file can be loaded.

I let it run through a tool I wrote to check if the roads are right. I believe the faild.xodr file doesn't look right. (I could be wrong) image image

PatrickPromitzer avatar Apr 26 '24 09:04 PatrickPromitzer

I mean to run your script on latest version of CARLA

Blyron avatar Apr 26 '24 09:04 Blyron

Could you try this with 0.9.15 or latest dev branch?

Not yet, because we has develop lots of features based on 0.9.13 docker....Maybe I can test it on 0.9.15

SdKay avatar Apr 28 '24 08:04 SdKay

It is hard to check an openDRIVE file without a tool, because the file can get big fast. I normally check with https://odrviewer.io/ if the file can be loaded.

I let it run through a tool I wrote to check if the roads are right. I believe the faild.xodr file doesn't look right. (I could be wrong) image image

I also think there is a problem with xodr. I have also used this website to load it, but it is always in the loading state.

SdKay avatar Apr 28 '24 08:04 SdKay

With the first post you told that town01.xodr can be generated, and faild.xodr can't. With the website not be able to load it, and seeing the output of the tool I wrote, I believe the faild.xodr file it too broken to work in Carla. With how the roads look, I would try to make a new *xodr file, because repairing could take a lot of time.

PatrickPromitzer avatar Apr 29 '24 06:04 PatrickPromitzer

Yeah I agree with PatrickPromitzer

Blyron avatar Apr 29 '24 12:04 Blyron

Have you been able to verify your xodr was correct?

Blyron avatar May 03 '24 12:05 Blyron

Have you been able to verify your xodr was correct?

Yes, there is something wrong with it, I'm trying to find out where it is and how it comes.

SdKay avatar May 07 '24 10:05 SdKay

I am closing this issue as the error is in the xodr so feel free to open it if something comes up

Blyron avatar May 10 '24 08:05 Blyron