[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [sumo-user] Vehicle type in TraCI
|
the automatic selecting of a guiShape for a given vClass only happens when loading from xml. Via traci you have to use traci.vehicleType.setShapeClass
When I assign 'tram' to the vClass attribute in route file(as vType_0) , the guiShape didn't change for vType_1. I changed 'tram' to 'taxi' and the changes became visible for vType_1.
Thank you,
Ali
This is working as expected in our test. The change should be visible in the gui (show type parameter) after the next call to simulationStep().
How did you verify the new vClass?
Dear Jakob,
Thank you in advance for the useful information. in the following, I want to change the class of the vehicle added after copying the vType_1 , for instance, to taxi. So, I used these methods as follows:
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')
traci.vehicletype.setVehicleClass('vType_1','taxi')
traci.vehicletype.setShapeClass('vType_1','passenger')
But the vehicle class of the vType_1 vehicle remains as same as the vehicle class of the vType_0 vehicle when the simulation is run in GUI. I would be thankful for any point in this case.
Regards,
Ali
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.
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
traci.vehicletype.copy("DEFAULT_VEHTYPE", "newType")
traci.vehicletype.setMaxSpeed("newType") # or whatever attributes you wish to define
traci.vehicle.add("v0", "route_0", "newType")
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
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user