gpt4 book ai didi

python - sumo - traci start() 和 close() 奇怪的行为

转载 作者:行者123 更新时间:2023-12-01 08:49:29 24 4
gpt4 key购买 nike

取自此处的文档 TraCI/Interfacing TraCI from Python ,我尝试创建一个简单的 Python 脚本来使用 traci 打开和关闭 Sumo:

cfg = os.path.abspath('..\\..\\..\\output\\scenarios\\batch_2018-11-07T085610\\sID_7\\sID_7.sumocfg')
traci.start(['sumo-gui', '-c', cfg])
print(traci.getVersion())
traci.close()
  1. traci.start() 处 Sumo 已启动,但脚本卡住了!
  2. 向命令添加 --start 标志可使脚本继续。但现在 traci.close() 并没有像应该那样关闭 Sumo: Command 0x7F: Close .

我使用的文档是否完全过时了?

traci.getVersion() 的输出:(18, 'SUMO 1.0.1')

谢谢

最佳答案

TraCI 文档指的是 sumo 的命令行版本,而不是 sumo-gui。要获得所需的行为,您需要将 --quit-on-end 添加到 sumo-gui 调用中。

关于python - sumo - traci start() 和 close() 奇怪的行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53185004/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com