(self, vehicle, carla_world, intensity_threshold=0.0,
min_area_of_collision=3, max_area_of_collision=5, max_id_time=5)
| 5 | |
| 6 | class Collision(): |
| 7 | def __init__(self, vehicle, carla_world, intensity_threshold=0.0, |
| 8 | min_area_of_collision=3, max_area_of_collision=5, max_id_time=5): |
| 9 | blueprint = carla_world.get_blueprint_library().find('sensor.other.collision') |
| 10 | self._collision_sensor = carla_world.spawn_actor(blueprint, carla.Transform(), attach_to=vehicle) |
| 11 | self._collision_sensor.listen(lambda event: self._on_collision(weakref.ref(self), event)) |
| 12 | self._collision_info = None |
| 13 | |
| 14 | self.registered_collisions = [] |
| 15 | self.last_id = None |
| 16 | self.collision_time = None |
| 17 | |
| 18 | # If closer than this distance, the collision is ignored |
| 19 | self._min_area_of_collision = min_area_of_collision |
| 20 | # If further than this distance, the area is forgotten |
| 21 | self._max_area_of_collision = max_area_of_collision |
| 22 | # Amount of time the last collision if is remembered |
| 23 | self._max_id_time = max_id_time |
| 24 | # intensity_threshold, LBC uses 400, leaderboard does not use it (set to 0) |
| 25 | self._intensity_threshold = intensity_threshold |
| 26 | |
| 27 | def tick(self, vehicle, timestamp): |
| 28 | ev_loc = vehicle.get_location() |
nothing calls this directly
no test coverage detected