I changed “newCar” into “reroutingType” in order to do exactly as in the 
documentation, I already checked that correspondence, the line I use is:

traci.vehicle.add("car", "route1", typeID="reroutingType")

The error SUMO gives me is:

Error: Answered with error to command 0xc4: Invalid type 'reroutingType' for 
vehicle 'car'
Error: tcpip::Socket::recvAndCheck @ recv: Socket reset by peer
Quitting (on error).

Da: [email protected] <[email protected]> Per conto di 
Jakob Erdmann
Inviato: 03 July 2018 12:12
A: Sumo project User discussions <[email protected]>
Oggetto: Re: [sumo-user] R: TraCI creation of new vehicle and route

In your call to addVehicle you use the type id 'newCar'
traci.vehicle.add("car", "route1", typeID="newCar")
but you should use "reroutingType" instead.
As it is now, routing is not attempted and the error message only indicates 
that the edges are not directly connected.



2018-07-03 12:06 GMT+02:00 Stefano Niero 
<[email protected]<mailto:[email protected]>>:
Thank you very much. The route insertion was my mistake.
For what concerns the trip, I did read the documentation and I did equip the 
vehicle with a rerouting device: here is the additional file that describes the 
vehicle

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

Still, the error I get if I give two non consecutive edges is:

File "C:\Program Files (x86)\DLR\Sumo\tools\traci\connection.py", line 104, in 
_sendExact
    raise TraCIException(prefix[1], _RESULTS[prefix[2]], err)
traci.exceptions.TraCIException: Vehicle 'car' has no valid route. No 
connection between edge 'gneE2' and edge '-gneE9'.

Which is not true, as a matter of fact in the same simulation there is a flow 
of vehicles specifies in the .rou.xml file that goes through the same trip and 
it works for them. Am I missing anything?

Da: [email protected]<mailto:[email protected]> 
<[email protected]<mailto:[email protected]>> Per conto 
di Jakob Erdmann
Inviato: 02 July 2018 20:59
A: Sumo project User discussions 
<[email protected]<mailto:[email protected]>>
Oggetto: Re: [sumo-user] TraCI creation of new vehicle and route

Hello,
1) adding a route only succeeds if the name is not already used by another 
route. Therefore, adding the same route again and again in a loop cannot work. 
The resulting error is not fatal, however. You can catch the TraCIException and 
continue with your script.
2) adding a trip (a route with two non-consecutive edges) only works if the 
vehicle is equipped with a rerouting device. This is even explained in the 
documentation you linked: 
http://sumo.dlr.de/wiki/TraCI/Interfacing_TraCI_from_Python#Add_trips_.28incomplete_routes.29_dynamically
If no route is found between the two edges (because they are in disconnected 
parts of the network) you will get an exception but you can catch that as well.

regards,
Jakob

2018-07-02 19:18 GMT+02:00 Stefano Niero 
<[email protected]<mailto:[email protected]>>:
Dear SUMO Community,
I tried  generate a new trip and a new vehicle using the example written in the 
following page:
http://sumo.dlr.de/wiki/TraCI/Interfacing_TraCI_from_Python
At the beginning, to understand how it works I decided to keep things simple 
and used a minimal map (attached).
The line of codes I wrote are:

def run():
    step = 0
    while step < 1000:
        #traci.simulationStep()
        traci.route.add("route1", ["gneE2", "gneE5"])
        traci.vehicle.add("car", "route1", typeID="newCar")
        step +=1
    traci.close()
    sys.stdout.flush()

where the two edges are contiguous because if I select two edges that are far 
one from the other it tells me that no connection is available (why?). Starting 
the program it opens the GUI but playing the simulation it stops immediately 
saying:

----------------------------------------------------------------------------------------
Loading configuration... done.
***Starting server on port 56264 ***
Loading net-file from 'bus.net.xml'... done (2ms).
Loading additional-files from 'bus.add.xml'... done (0ms).
Loading done.
Simulation started with time: 0.00
Error: Answered with error to command 0xc6: Could not add route.
Error: tcpip::Socket::recvAndCheck @ recv: Socket reset by peer
Quitting (on error).
-------------------------
On SUMO-GUI, while PyCharm log gives me:

Loading configuration... done.
Traceback (most recent call last):
  File "C:/Stefano/For school/Tesi/TraCI/Simulation/runner.py", line 100, in 
<module>
    run()
  File "C:/Stefano/For school/Tesi/TraCI/Simulation/runner.py", line 67, in run
    traci.route.add("route1", ["gneE2", "gneE5"])
  File "C:\Program Files (x86)\DLR\Sumo\tools\traci\_route.py", line 46, in add
    self._connection._sendExact()
  File "C:\Program Files (x86)\DLR\Sumo\tools\traci\connection.py", line 104, 
in _sendExact
    raise TraCIException(prefix[1], _RESULTS[prefix[2]], err)
traci.exceptions.TraCIException: Could not add route.

Process finished with exit code 1

Can you tell me what I did wrong?
Thank you very much
Stefano Niero


_______________________________________________
sumo-user mailing list
[email protected]<mailto:[email protected]>
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/sumo-user


_______________________________________________
sumo-user mailing list
[email protected]<mailto:[email protected]>
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/sumo-user

_______________________________________________
sumo-user mailing list
[email protected]
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/sumo-user

Reply via email to