(self, vehicle, timestamp)
| 25 | self._intensity_threshold = intensity_threshold |
| 26 | |
| 27 | def tick(self, vehicle, timestamp): |
| 28 | ev_loc = vehicle.get_location() |
| 29 | new_registered_collisions = [] |
| 30 | # Loops through all the previous registered collisions |
| 31 | for collision_location in self.registered_collisions: |
| 32 | distance = ev_loc.distance(collision_location) |
| 33 | # If far away from a previous collision, forget it |
| 34 | if distance <= self._max_area_of_collision: |
| 35 | new_registered_collisions.append(collision_location) |
| 36 | |
| 37 | self.registered_collisions = new_registered_collisions |
| 38 | |
| 39 | if self.last_id and timestamp['relative_simulation_time'] - self.collision_time > self._max_id_time: |
| 40 | self.last_id = None |
| 41 | |
| 42 | info = self._collision_info |
| 43 | self._collision_info = None |
| 44 | if info is not None: |
| 45 | info['step'] -= timestamp['start_frame'] |
| 46 | info['simulation_time'] -= timestamp['start_simulation_time'] |
| 47 | return info |
| 48 | |
| 49 | @staticmethod |
| 50 | def _on_collision(weakself, event): |
nothing calls this directly
no test coverage detected