在 Omnet++/Veins, SUMO 中更改红绿灯颜色错误

Changing Traffic Light Colour ERROR in Omnet++/Veins, SUMO

我已经尝试使用以下问题 () 中提供的解决方案,但是,出现以下错误关于命令 "myProgramGreenRed" not existing for tl "n7",当我尝试更改程序

红绿灯 ID 是 n7、n8 和 n9,给我带来麻烦的代码是:

tl.setProgram("myProgramGreenRed");
tl.setPhaseIndex(1);

并且 tls.tls.xml 文件如下所示

   <tls>
    <tlLogic id="10" type="static" programID="myProgramRed" offset="0">
        <phase duration="999" state="GggGGgrrr"/>
        <phase duration="999" state="GggGGgrrr"/>
    </tlLogic>

    <tlLogic id="10" type="static" programID="myProgramGreen" offset="0">
        <phase duration="999" state="rrrrrrGGG"/>
        <phase duration="999" state="rrrrrrGGG"/>
    </tlLogic>
    <tlLogic id="n7" type="static" programID="myProgramGreenRed" offset="0">
    <phase duration="999" state="rrrrrrrrr"/>
    <phase duration="999" state="rrrrrrrrr"/>
</tlLogic>
    <tlLogic id="10" type="static" programID="myProgramGreenRed" offset="0">
        <phase duration="999" state="rrrrrrGGG"/>
        <phase duration="999" state="GggGGgrrr"/>
    </tlLogic>

    <tlLogic id="n9" type="static" programID="myProgramCRL" offset="0">
        <phase duration="999" state="rrrrrrrrr"/>
        <phase duration="999" state="rrrrrrrrr"/>
    </tlLogic>
    <tlLogic id="n8" type="static" programID="myProgramCRL" offset="0">
        <phase duration="999" state="rrrrrrrrr"/>
        <phase duration="999" state="rrrrrrrrr"/>
    </tlLogic>
    <tlLogic id="n7" type="static" programID="myProgramCRL" offset="0">
        <phase duration="999" state="rrrrrrrrr"/>
        <phase duration="999" state="rrrrrrrrr"/>
    </tlLogic>
</tls>

有谁知道我该怎么做才能完成这项工作,或者我是否使用了错误的方法来实现交通信号灯颜色的改变。

提前致谢!

如果我没看错你的 tls.tls.xml 文件,你的红绿灯 "n7" 实际上只有一个程序可供选择。只有红绿灯“10”有三个程序可供选择。