COLLISIONS: retrieve the IDs of colliding vehicles and the number of collisions
Dear all, how can I retrieve the number of collisions at each step while running the training on the ring env? I saw in the base.py file
crash encodes whether the simulator experienced a collision
crash = self.k.simulation.check_collision()
crash is a Boolean variable that is true when there is a crash. I want to retrieve the number of collisions and the IDs of the colliding vehicles. How? Can you please help me?
self.k.simulation.check_collision() uses one of the two functions you need: the number of collisions. The other one you can find here: http://sumo.sourceforge.net/pydoc/traci._simulation.html you need to reference the kernel api to use them in your enviroment.
Thank you, @alexkou ! It worked. But I still have a problem: how to increase the probability of collisions in my env? I intentionally want to cause road accidents (collisions) in the ring.py env.
I just set
car_following_params=SumoCarFollowingParams( min_gap=0, speed_mode="aggressive", decel=1, accel=100, initial_speed=121 ),
and also "speed_limit": 150 in net=NetParams(additional_params={, but that's not enough.
What else can I do to let vehicles collide?