(self, parent_actor, hud)
| 679 | |
| 680 | class CollisionSensor(object): |
| 681 | def __init__(self, parent_actor, hud): |
| 682 | self.sensor = None |
| 683 | self.history = [] |
| 684 | self._parent = parent_actor |
| 685 | self.hud = hud |
| 686 | world = self._parent.get_world() |
| 687 | bp = world.get_blueprint_library().find('sensor.other.collision') |
| 688 | self.sensor = world.spawn_actor(bp, carla.Transform(), attach_to=self._parent) |
| 689 | # We need to pass the lambda a weak reference to self to avoid circular |
| 690 | # reference. |
| 691 | weak_self = weakref.ref(self) |
| 692 | self.sensor.listen(lambda event: CollisionSensor._on_collision(weak_self, event)) |
| 693 | |
| 694 | def get_collision_history(self): |
| 695 | history = collections.defaultdict(int) |
nothing calls this directly
no test coverage detected