我尝试使用以下问题(How can I get a traffic light that exists in sumo and change its phase in veins?)中提出的解决方案,但是,当我尝试更改程序时,关于命令“ myProgramGreenRed”对于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>
有人知道我该怎么做才能完成这项工作,或者我是否使用错误的方法来实现交通信号灯颜色的改变。
谢谢!
答案 0 :(得分:0)
如果我正确阅读了tls.tls.xml文件,则您的交通信号灯“ n7”实际上只有一个程序可供选择。只有交通信号灯“ 10”有三个程序可供选择。