Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sumo-user] Vehicle type in TraCI

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

On Thu, Apr 29, 2021 at 2:09 PM Jakob Erdmann <namdre.sumo@xxxxxxxxx> wrote:
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?

Am Mi., 28. Apr. 2021 um 23:54 Uhr schrieb ali mirzaei <alimrz222@xxxxxxxxx>:
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


On Wed, Apr 28, 2021 at 4:18 PM Jakob Erdmann <namdre.sumo@xxxxxxxxx> wrote:
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 <alimrz222@xxxxxxxxx>:
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 <namdre.sumo@xxxxxxxxx> 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 <alimrz222@xxxxxxxxx>:
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 <namdre.sumo@xxxxxxxxx> 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 <alimrz222@xxxxxxxxx>:
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
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
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user

Back to the top