(self, vehicle, timestamp)
| 9 | self._time_last_valid_state = None |
| 10 | |
| 11 | def tick(self, vehicle, timestamp): |
| 12 | info = None |
| 13 | linear_speed = self._calculate_speed(vehicle.get_velocity()) |
| 14 | |
| 15 | if linear_speed < self._speed_threshold and self._time_last_valid_state: |
| 16 | if (timestamp['relative_simulation_time'] - self._time_last_valid_state) > self._below_threshold_max_time: |
| 17 | # The actor has been "blocked" for too long |
| 18 | ev_loc = vehicle.get_location() |
| 19 | info = { |
| 20 | 'step': timestamp['step'], |
| 21 | 'simulation_time': timestamp['relative_simulation_time'], |
| 22 | 'ev_loc': [ev_loc.x, ev_loc.y, ev_loc.z] |
| 23 | } |
| 24 | else: |
| 25 | self._time_last_valid_state = timestamp['relative_simulation_time'] |
| 26 | return info |
| 27 | |
| 28 | @staticmethod |
| 29 | def _calculate_speed(carla_velocity): |
nothing calls this directly
no test coverage detected