whenever you copy a type, the id of the new type must not have been used before. In your case vType_1 already exists because you loaded it from xml.
Am Mi., 28. Apr. 2021 um 13:01 Uhr schrieb ali mirzaei <[email protected] >: > Dear Jakob, > After your hint, I changed my code as follow: > if step == 20: > traci.vehicle.add('vehicle_0','route_0','vType_0') > if step == 30: > traci.vehicletype.copy('vType_0','vType_1') > traci.vehicle.add('vehicle_1','route_0','vType_1') > simultaneously, I added new type in .rou.xml file : > <vType id="vType_0" vClass="passenger"/> > <vType id="vType_1" vClass="taxi"/> > After running the script, the Error: Answered with error to command 0xc5: > could not add type vType_1 stopped the simulation. > Then, what is wrong with my job. > > Thank you, > Ali > > > > > > > On Wed, Apr 28, 2021 at 2:16 PM Jakob Erdmann <[email protected]> > wrote: > >> traci.vehicletype.copy("DEFAULT_VEHTYPE", "newType") >> traci.vehicletype.setMaxSpeed("newType") # or whatever attributes you >> wish to define >> traci.vehicle.add("v0", "route_0", "newType") >> >> Am Mi., 28. Apr. 2021 um 11:34 Uhr schrieb ali mirzaei < >> [email protected]>: >> >>> Hi everyone, >>> Let me explain what I mean with an example. >>> traci.vehicle.add('vehicle_0','route_0','vType_0') >>> This is a piece of my script in which vType has been defined in advance >>> in .rou.file by <vType id="vType_0" vClass="trailer"/> . >>> I am looking for a method to define vType directly via TraCI without >>> having to pass through the .rou.xml file. >>> >>> Regards, >>> Ali >>> >>> On Tue, Apr 27, 2021 at 11:29 PM Jakob Erdmann <[email protected]> >>> wrote: >>> >>>> You can use traci.vehicletype.copy to create a new type from an >>>> existing one and then modify it's attributes as needed. >>>> >>>> Am Di., 27. Apr. 2021 um 18:57 Uhr schrieb ali mirzaei < >>>> [email protected]>: >>>> >>>>> Hi everyone, >>>>> Is it possible to define a vehicle type in TraCI directly or it must >>>>> be pre-registered in route file? >>>>> >>>>> Regards, >>>>> Ali >>>>> _______________________________________________ >>>>> sumo-user mailing list >>>>> [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 >>>> >>> _______________________________________________ >>> sumo-user mailing list >>> [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 >> > _______________________________________________ > sumo-user mailing list > [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
