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

混江龙づ霸主 提交于 2019-12-24 15:49:40

问题


I've tried using the solution presented in the following question (How can I get a traffic light that exists in sumo and change its phase in veins?), however, the following error appears about the command "myProgramGreenRed" not existing for tl "n7", when I try to change the program

The traffic lights ids are n7, n8, and n9 and the piece of code that gives me trouble is :

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

and the tls.tls.xml file looks like the following

   <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>

Does anybody know what can I do to make this work, or if I'm using the wrong approach to achieve the changing of the traffic lights colours.

Thanks in advance!


回答1:


If I read your tls.tls.xml file right, your traffic light "n7" has, indeed, only one program to choose from. Only traffic light "10" has three programs to choose from.



来源:https://stackoverflow.com/questions/54992801/changing-traffic-light-colour-error-in-omnet-veins-sumo

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!