Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sumo-user] ADD VEHICLE AND ROUTES

Hi, 
I add net file and route file to run the SUMO.config. You can find the files attached to this email. I still get the same problem. You can Traci code and errors below.
Thanks in advance for your help
 Tugba



def run():
    step = 0
    while traci.simulation.getMinExpectedNumber() > 0:

        traci.simulationStep()
        traci.route.add("trip",['2_0', '3_1'])
        traci.vehicle.add("1", "trip", typeID="reroutingType")
        step += 1

    traci.close()
    sys.stdout.flush()

if __name__ == "__main__":
    options = get_options()

    # SUMO yu SUNUCU OLARAK BAŞLATIYORUZ
    if options.nogui:
        sumoBinary = checkBinary('sumo')
   
    else:
        sumoBinary = checkBinary('sumo-gui')


   

    # İSTEMCİ TRACI Yİ BAŞLATIYORUZ
    traci.start([sumoBinary, "-c", "kilis.sumocfg",
                             "--tripinfo-output", "tripinfo.xml",
                             "--quit-on-end",
                             "--delay","1000",
                             "--start"])
    sumo=traci
    #sumo.gui.setSchema(traci.gui.DEFAULT_VIEW, "real world")  
    run()
    traci.close()
   
   




Traceback (most recent call last):
  File "c:\Users\Admin\Desktop\kilis7903\tracidqn.py", line 81, in <module>
    run()
  File "c:\Users\Admin\Desktop\kilis7903\tracidqn.py", line 53, in run
    traci.route.add("trip",['2_0', '3_1'])
  File "C:\Program Files (x86)\Eclipse\Sumo\tools\traci\_route.py", line 43, in add
    self._setCmd(tc.ADD, routeID, "l", edges)
  File "C:\Program Files (x86)\Eclipse\Sumo\tools\traci\domain.py", line 162, in _setCmd
    self._connection._sendCmd(self._cmdSetID, varID, objectID, format, *values)
  File "C:\Program Files (x86)\Eclipse\Sumo\tools\traci\connection.py", line 185, in _sendCmd
    return self._sendExact()
  File "C:\Program Files (x86)\Eclipse\Sumo\tools\traci\connection.py", line 102, in _sendExact
    raise TraCIException(err, prefix[1], _RESULTS[prefix[2]])
traci.exceptions.TraCIException: Could not add route 'trip'.








m.barthauer@xxxxxxxxxxx <m.barthauer@xxxxxxxxxxx>, 17 Eki 2022 Pzt, 12:02 tarihinde şunu yazdı:

Hi,

 

I could not find anything problematic in your TraCI code excerpt with respect to the SUMO config. I executed the TraCI commands with success (using SUMO developer version). Do you add more than one route? Then be sure to choose a unique ID.

 

Best regards
Mirko

 

 

 

 

 

-----Original-Nachricht-----

Betreff: [sumo-user] ADD VEHICLE AND ROUTES

Datum: 2022-10-14T12:33:20+0200

Von: "Tuğba Evci" <tugbaaevci@xxxxxxxxx>

An: "sumo-user@xxxxxxxxxxx" <sumo-user@xxxxxxxxxxx>

 

 

 

Hİ,
I am new to SUMO and Traci so I get a lot of errors in my work. I don't think the tutorials on Sumo's website are detailed enough. So I hope you can help me.
I am trying to add vehicle and route using traci library. However I don't know if I need to make any changes to the XML files in this work that I want to do. For this reason, I am sending you the XML files as well. You can find the files attached to this email.
I couldn't find the cause of the error. I found posts on the internet stating that several people were getting  the same error, but I coludn't find a post with the results.You can see the codes and the errors below.
Thanks in advance for your help
 
        traci.route.add("trip",['2_0', '3_1'])
        traci.vehicle.add("1", "trip", typeID="reroutingType")
 
Traceback (most recent call last):
  File "c:\Users\Admin\Desktop\kilis7903\tracidqn.py", line 81, in <module>
    run()
  File "c:\Users\Admin\Desktop\kilis7903\tracidqn.py", line 53, in run
    traci.route.add("trip",['2_0', '3_1'])
  File "C:\Program Files (x86)\Eclipse\Sumo\tools\traci\_route.py", line 43, in add
    self._setCmd(tc.ADD, routeID, "l", edges)
  File "C:\Program Files (x86)\Eclipse\Sumo\tools\traci\domain.py", line 162, in _setCmd
    self._connection._sendCmd(self._cmdSetID, varID, objectID, format, *values)
  File "C:\Program Files (x86)\Eclipse\Sumo\tools\traci\connection.py", line 185, in _sendCmd
    return self._sendExact()
  File "C:\Program Files (x86)\Eclipse\Sumo\tools\traci\connection.py", line 102, in _sendExact
    raise TraCIException(err, prefix[1], _RESULTS[prefix[2]])
traci.exceptions.TraCIException: Could not add route 'trip'.

_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
<routes>
        <vType id="passenger" accel="0.8" decel="4.5" sigma="0.5" length="5" minGap="2.5" maxSpeed="16.67" guiShape="passenger"/>
        <vType id="bus" accel="0.8" decel="4.5" sigma="0.5" length="7" minGap="3" maxSpeed="70" guiShape="bus"/>
        <vType id="truck" accel="0.8" decel="4.5" sigma="0.5" length="9" minGap="3" maxSpeed="70" guiShape="truck"/>
        <vType id="motorcycle" accel="0.8" decel="4.5" sigma="0.5" length="2" minGap="2.5" maxSpeed="25" guiShape="motorcycle"/>
		<vType id="reroutingType" type="passenger" length="4.5" accel="3.5" decel="2.2" maxSpeed="8.0" color="1,1,0" sigma="0.5" guiShape="passenger/hatchback">

                              <param key="has.rerouting.device" value="true"/>

        </vType>
		<vType id="default"/>

        <route id="r1" edges="2_0 1_1" />
       
        <route id="r3" edges="2_0 3_1" />
       

   

        <route id="r9" edges="1_0 1_1" />
        <route id="r10" edges="1_0 2_1" />
        <route id="r11" edges="1_0 3_1" />
      

        <route id="r13" edges="3_0 1_1"  />
        <route id="r14" edges="3_0 2_1" />
        <route id="r15" edges="3_0 3_1" />
    <vehicle id="id_0" type="passenger" route="r13" depart="2"  color="0,1,0" >
	   <stop lane="3_0_0"  parking="true" duration="20" until="	1:12:0:0"/></vehicle>
    
</routes>
<?xml version="1.0" encoding="UTF-8"?>

<!-- generated on 2022-10-10 15:35:12 by Eclipse SUMO netedit Version 1.13.0
<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/netconvertConfiguration.xsd";>

    <input>
        <sumo-net-file value="C:\Users\Admin\Desktop\kilis7903\kilis7903.net.xml"/>
    </input>

    <output>
        <output-file value="C:\Users\Admin\Desktop\kilis7903\kilis7903.net.xml"/>
    </output>

    <processing>
        <geometry.min-radius.fix.railways value="false"/>
        <geometry.max-grade.fix value="false"/>
        <offset.disable-normalization value="true"/>
        <lefthand value="false"/>
    </processing>

    <junctions>
        <no-turnarounds value="true"/>
        <junctions.corner-detail value="5"/>
        <junctions.limit-turn-speed value="5.5"/>
        <rectangular-lane-cut value="false"/>
    </junctions>

    <pedestrian>
        <walkingareas value="false"/>
    </pedestrian>

    <report>
        <aggregate-warnings value="5"/>
    </report>

</configuration>
-->

<net version="1.9" junctionCornerDetail="5" limitTurnSpeed="5.50" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/net_file.xsd";>

    <location netOffset="0.00,0.00" convBoundary="0.00,-0.10,200.10,103.20" origBoundary="-10000000000.00,-10000000000.00,10000000000.00,10000000000.00" projParameter="!"/>

    <edge id=":J2_0" function="internal">
        <lane id=":J2_0_0" index="0" speed="13.89" length="20.80" shape="110.40,104.80 89.60,104.80"/>
        <lane id=":J2_0_1" index="1" speed="13.89" length="20.80" shape="110.40,101.60 89.60,101.60"/>
    </edge>
    <edge id=":J2_2" function="internal">
        <lane id=":J2_2_0" index="0" speed="9.26" length="19.35" shape="110.40,101.60 105.15,100.85 101.40,98.60 99.15,94.85 98.40,89.60"/>
    </edge>
    <edge id=":J2_3" function="internal">
        <lane id=":J2_3_0" index="0" speed="3.65" length="4.67" shape="110.40,101.60 109.20,100.80 108.80,100.00 109.20,99.20 110.40,98.40"/>
    </edge>
    <edge id=":J2_4" function="internal">
        <lane id=":J2_4_0" index="0" speed="6.51" length="9.03" shape="104.80,89.60 105.15,92.05 106.20,93.80 107.95,94.85 110.40,95.20"/>
    </edge>
    <edge id=":J2_5" function="internal">
        <lane id=":J2_5_0" index="0" speed="9.26" length="19.35" shape="101.60,89.60 100.85,94.85 98.60,98.60 94.85,100.85 89.60,101.60"/>
    </edge>
    <edge id=":J2_6" function="internal">
        <lane id=":J2_6_0" index="0" speed="6.51" length="9.03" shape="89.60,95.20 92.05,94.85 93.80,93.80 94.85,92.05 95.20,89.60"/>
    </edge>
    <edge id=":J2_7" function="internal">
        <lane id=":J2_7_0" index="0" speed="13.89" length="20.80" shape="89.60,95.20 110.40,95.20"/>
        <lane id=":J2_7_1" index="1" speed="13.89" length="20.80" shape="89.60,98.40 110.40,98.40"/>
    </edge>
    <edge id=":J2_9" function="internal">
        <lane id=":J2_9_0" index="0" speed="3.65" length="4.67" shape="89.60,98.40 90.80,99.20 91.20,100.00 90.80,100.80 89.60,101.60"/>
    </edge>

    <edge id="1_0" from="J1" to="J2" priority="-1" spreadType="center" length="200.00" shape="0.00,96.80 100.10,96.80">
        <lane id="1_0_0" index="0" speed="13.89" length="200.00" shape="0.00,95.20 89.60,95.20"/>
        <lane id="1_0_1" index="1" speed="13.89" length="200.00" shape="0.00,98.40 89.60,98.40"/>
    </edge>
    <edge id="1_1" from="J2" to="J1" priority="-1" spreadType="center" length="200.00" shape="100.10,103.20 0.00,103.20">
        <lane id="1_1_0" index="0" speed="13.89" length="200.00" shape="89.60,104.80 0.00,104.80"/>
        <lane id="1_1_1" index="1" speed="13.89" length="200.00" shape="89.60,101.60 0.00,101.60"/>
    </edge>
    <edge id="2_0" from="J3" to="J2" priority="-1" spreadType="center" length="200.00" shape="103.20,-0.10 103.20,100.00">
        <lane id="2_0_0" index="0" speed="13.89" length="200.00" shape="104.80,0.00 104.80,89.60"/>
        <lane id="2_0_1" index="1" speed="13.89" length="200.00" shape="101.60,0.00 101.60,89.60"/>
    </edge>
    <edge id="2_1" from="J2" to="J3" priority="-1" spreadType="center" length="200.00" shape="96.80,100.00 96.80,-0.10">
        <lane id="2_1_0" index="0" speed="13.89" length="200.00" shape="95.20,89.60 95.20,0.00"/>
        <lane id="2_1_1" index="1" speed="13.89" length="200.00" shape="98.40,89.60 98.40,0.00"/>
    </edge>
    <edge id="3_0" from="J4" to="J2" priority="-1" spreadType="center" length="200.00" shape="200.10,103.20 100.00,103.20">
        <lane id="3_0_0" index="0" speed="13.89" length="200.00" shape="200.10,104.80 110.40,104.80"/>
        <lane id="3_0_1" index="1" speed="13.89" length="200.00" shape="200.10,101.60 110.40,101.60"/>
    </edge>
    <edge id="3_1" from="J2" to="J4" priority="-1" spreadType="center" length="200.00" shape="100.00,96.80 200.10,96.80">
        <lane id="3_1_0" index="0" speed="13.89" length="200.00" shape="110.40,95.20 200.10,95.20"/>
        <lane id="3_1_1" index="1" speed="13.89" length="200.00" shape="110.40,98.40 200.10,98.40"/>
    </edge>

    <tlLogic id="J2" type="static" programID="0" offset="0">
        <phase duration="20" state="rrrrrrGGGg"/>
        <phase duration="3"  state="rrrrrryyyy"/>
        <phase duration="20" state="GGggrrrrrr"/>
        <phase duration="3"  state="yyyyrrrrrr"/>
        <phase duration="16" state="rrrrGGrrrr"/>
        <phase duration="3"  state="rrrryyrrrr"/>
    </tlLogic>

    <junction id="J1" type="dead_end" x="0.00" y="100.00" incLanes="1_1_0 1_1_1" intLanes="" shape="0.00,100.00 0.00,106.40 0.00,100.00"/>
    <junction id="J2" type="traffic_light" x="100.00" y="100.00" incLanes="3_0_0 3_0_1 2_0_0 2_0_1 1_0_0 1_0_1" intLanes=":J2_0_0 :J2_0_1 :J2_2_0 :J2_3_0 :J2_4_0 :J2_5_0 :J2_6_0 :J2_7_0 :J2_7_1 :J2_9_0" shape="110.40,106.40 110.40,93.60 108.18,93.16 107.40,92.60 106.84,91.82 106.51,90.82 106.40,89.60 93.60,89.60 93.16,91.82 92.60,92.60 91.82,93.16 90.82,93.49 89.60,93.60 89.60,106.40">
        <request index="0" response="0000000000" foes="1000100000" cont="0"/>
        <request index="1" response="0000000000" foes="1000100000" cont="0"/>
        <request index="2" response="0110000000" foes="0110100000" cont="0"/>
        <request index="3" response="0110000000" foes="0110000000" cont="0"/>
        <request index="4" response="0110000000" foes="0110000000" cont="0"/>
        <request index="5" response="0110000111" foes="1110000111" cont="0"/>
        <request index="6" response="0000000000" foes="0000000000" cont="0"/>
        <request index="7" response="0000000000" foes="0000111100" cont="0"/>
        <request index="8" response="0000000000" foes="0000111100" cont="0"/>
        <request index="9" response="0000100011" foes="0000100011" cont="0"/>
    </junction>
    <junction id="J3" type="dead_end" x="100.00" y="0.00" incLanes="2_1_0 2_1_1" intLanes="" shape="100.00,0.00 93.60,0.00 100.00,0.00"/>
    <junction id="J4" type="dead_end" x="200.00" y="100.00" incLanes="3_1_0 3_1_1" intLanes="" shape="200.00,100.00 200.00,93.60 200.00,100.00"/>

    <connection from="1_0" to="2_1" fromLane="0" toLane="0" via=":J2_6_0" tl="J2" linkIndex="6" dir="r" state="O"/>
    <connection from="1_0" to="3_1" fromLane="0" toLane="0" via=":J2_7_0" tl="J2" linkIndex="7" dir="s" state="O"/>
    <connection from="1_0" to="3_1" fromLane="1" toLane="1" via=":J2_7_1" tl="J2" linkIndex="8" dir="s" state="O"/>
    <connection from="1_0" to="1_1" fromLane="1" toLane="1" via=":J2_9_0" tl="J2" linkIndex="9" dir="t" state="o"/>
    <connection from="2_0" to="3_1" fromLane="0" toLane="0" via=":J2_4_0" tl="J2" linkIndex="4" dir="r" state="o"/>
    <connection from="2_0" to="1_1" fromLane="1" toLane="1" via=":J2_5_0" tl="J2" linkIndex="5" dir="l" state="o"/>
    <connection from="3_0" to="1_1" fromLane="0" toLane="0" via=":J2_0_0" tl="J2" linkIndex="0" dir="s" state="O"/>
    <connection from="3_0" to="1_1" fromLane="1" toLane="1" via=":J2_0_1" tl="J2" linkIndex="1" dir="s" state="O"/>
    <connection from="3_0" to="2_1" fromLane="1" toLane="1" via=":J2_2_0" tl="J2" linkIndex="2" dir="l" state="o"/>
    <connection from="3_0" to="3_1" fromLane="1" toLane="1" via=":J2_3_0" tl="J2" linkIndex="3" dir="t" state="o"/>

    <connection from=":J2_0" to="1_1" fromLane="0" toLane="0" dir="s" state="M"/>
    <connection from=":J2_0" to="1_1" fromLane="1" toLane="1" dir="s" state="M"/>
    <connection from=":J2_2" to="2_1" fromLane="0" toLane="1" dir="l" state="M"/>
    <connection from=":J2_3" to="3_1" fromLane="0" toLane="1" dir="t" state="M"/>
    <connection from=":J2_4" to="3_1" fromLane="0" toLane="0" dir="r" state="M"/>
    <connection from=":J2_5" to="1_1" fromLane="0" toLane="1" dir="l" state="M"/>
    <connection from=":J2_6" to="2_1" fromLane="0" toLane="0" dir="r" state="M"/>
    <connection from=":J2_7" to="3_1" fromLane="0" toLane="0" dir="s" state="M"/>
    <connection from=":J2_7" to="3_1" fromLane="1" toLane="1" dir="s" state="M"/>
    <connection from=":J2_9" to="1_1" fromLane="0" toLane="1" dir="t" state="M"/>

</net>

Attachment: kilis.sumocfg
Description: application/sumo


Back to the top