Well, you probably do what I suspected before: If your while loop is
executed multiple times (step > 1), then you add vehicles and routes with
the same ID over and over. This is not possible. If you really want to add
a new vehicle at every time step, do something like this:
traci.route.add("trip",['2_0', '3_1'])
while traci.simulation.getMinExpectedNumber() > 0:
traci.simulationStep()
traci.vehicle.add("vehicle_" + str(step), "trip", typeID=
"reroutingType")
step += 1
Best regards
Mirko
-----Original-Nachricht-----
Betreff: Re: [sumo-user] ADD VEHICLE AND ROUTES
Datum: 2022-10-24T13:18:57+0200
Von: "Tuğba Evci" <[email protected]>
An: "[email protected]" <[email protected]>, "Sumo project User
discussions" <[email protected]>
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'.
[email protected] <mailto:[email protected]> <
[email protected] <mailto:[email protected]> >, 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" <[email protected] <mailto:[email protected]> >
An: "[email protected] <mailto:[email protected]> " <
[email protected] <mailto:[email protected]> >
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
[email protected] <mailto:[email protected]>
To unsubscribe from this list, visit
<https://www.eclipse.org/mailman/listinfo/sumo-user>
_______________________________________________
sumo-user mailing list
[email protected]
To unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/sumo-user