首页 > 解决方案 > 在examples/sumo/grid.py上模拟,有几个检测器,如何获取数据

问题描述

在示例程序examples/sumo/grid.py

在代码文件中,有关于这些探测器的任何代码。

标签: sumoflow-project

解决方案


关于如何添加检测器,我找到了解决方案:

在代码上:

tl_logic.add("center0", phases=phases, programID=1,detectorGap=1,showDetectors=True,tls_type="actuated")
    tl_logic.add("center1", phases=phases, programID=1,detectorGap=1,showDetectors=True,tls_type="actuated")
    tl_logic.add("center2", phases=phases, programID=1,detectorGap=1,showDetectors=True,tls_type="actuated")
    tl_logic.add("center3", phases=phases, programID=1,detectorGap=1,showDetectors=True,tls_type="actuated")
    tl_logic.add("center4", phases=phases, programID=1,detectorGap=1,showDetectors=True,tls_type="actuated")
    tl_logic.add("center5", phases=phases, programID=1,detectorGap=1,showDetectors=True,tls_type="actuated")

有一个小问题是关于detectorGap,关于params.py/TrafficLightParams,关于detectorGap的描述是:

detectorGap : int, optional
            used for actuated traffic lights
            determines the time distance between the (automatically generated)
            detector and the stop line in seconds (at each lanes maximum
            speed), **used for actuated traffic lights**

所以,我设置detectorGap =1,最大速度=35km/h,探测器的距离为:最大速度(km/h?)*detectorGap(s)。我的理解对吗?@nathanlct

结果是:在此处输入图像描述


推荐阅读