carla-simulator / carla

Open-source simulator for autonomous driving research.
http://carla.org
MIT License
11.06k stars 3.56k forks source link

AttributeError: module 'traci' has no attribute 'sumolib' #5639

Open Chionanthus opened 2 years ago

Chionanthus commented 2 years ago

CARLA version: 0.9.13 Platform/OS: Linux

Hi there,

when i use sumo to run a co-simulation example in the carla-0.9.13/Co-Simulation/Sumo/examples folder , and it can run with no error.

But when i use my own .rou.xml file and .sumocfg file to run co-simulation, it said that in /Co-Simulation/Sumo/sumo_integration/sumo_simulation.py", line 304, , `module 'traci' has no attribute 'sumolib'

After i change the line 304 traci.sumolib.net.readNet(net_file) to sumolib.net.readNet(net_file) and no error is reported and the system works normally, and i wanna know is there a small bug in sumo_simulation.py?

image
jy723 commented 2 years ago

You can try to check the versions of sumo,the new version is different

DFCui commented 2 years ago

You can change traci.sumolib.net.readNet to sumolib.net.readNet to fix the error.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

oyontalas commented 5 months ago

File "/Carla/Co-Simulation/Sumo/sumo_integration/sumo_simulation.py", line 304, in _get_sumo_net sumo_net = traci.sumolib.net.readNet(net_file) AttributeError: module 'traci' has no attribute 'sumolib'

最终是找到了问题所在:

这是因为sumolib是独立的包,不在traci里面,你需要把carla/Co-Simulation/Sumo/sumo_integration/sumo_simulation.py的304行的这一句代码改成sumo_net = sumolib.net.readNet(net_file)

hotmedal commented 2 months ago

You can change traci.sumolib.net.readNet to sumolib.net.readNet to fix the error.

Can confirm this is still the case.