1
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 是否包含在更高版本中?

4

1 回答 1

2

将 sumo traci 模块更新为较新的模块(0.29),并且成功了。

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

于 2017-02-17T04:34:11.633 回答