【问题标题】:sumo - traci start() and close() strange behaviorsumo - traci start() 和 close() 奇怪的行为
【发布时间】:2018-11-08 05:32:09
【问题描述】:

取自 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')

谢谢

【问题讨论】:

    标签: python python-3.6 sumo


    【解决方案1】:

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

    【讨论】:

    • 完美运行!谢谢。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-03-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多