TraCI模块 - 运行traci.start(sumoCmd)的问题

时间:2017-02-16 08:16:12

标签: sumo

sumoBinary = "/usr/bin/sumo-gui"
sumoCmd = [sumoBinary, "-c", "map.sumo.cfg"]
import traci
traci.start(sumoCmd)

当我使用traci.start(sumoCmd)时,我收到以下错误:

AtributeError: 'module' object has no attribute 'start'

什么是合乎逻辑的,因为如果我搜索traci模块,并使用dir命令来分析根本没有启动函数:

['FatalTraCIError', 'Message', 'Storage', 'SubscriptionResults', 'TraCIException', '_DEBUG', '_RESULTS', '_STEPS2TIME', '_TIME2STEPS', '__builtins__', '__doc__', '__file__', '__name__', '__package__', '__path__', '_beginMessage', '_checkResult', '_connections', '_embedded', '_message', '_modules', '_readSubscription', '_recvExact', '_sendByteCmd', '_sendDoubleCmd', '_sendExact', '_sendIntCmd', '_sendReadOneStringCmd', '_sendStringCmd', '_subscribe', '_subscribeContext', 'areal', 'close', 'constants', 'edge', 'getParameterAccessors', 'getVersion', 'gui', 'inductionloop', 'init', 'isEmbedded', 'junction', 'lane', 'multientryexit', 'person', 'poi', 'polygon', 'print_function', 'route', 'simulation', 'simulationStep', 'socket', 'struct', 'switch', 'time', 'trafficlights', 'vehicle', 'vehicletype']

这个功能很好用,我认为它包含在traci模块中。

可以看出:http://www.sumo.dlr.de/wiki/TraCI/Interfacing_TraCI_from_Python

任何人都可以解释我如何找到它?感谢

另外因为omnet ++我使用的是sumo-0.25.0,traci.start是否包含在更高版本中?

1 个答案:

答案 0 :(得分:2)

将sumo traci模块更新为更新的模块(0.29)并且计算出来了。

不幸的是,sumo-0.25 traci模块没有traci.start(sumoCmd)函数