MCPcopy Create free account
hub / github.com/OpenDriveLab/DriveAdapter / tick

Method tick

roach/criteria/blocked.py:11–26  ·  view source on GitHub ↗
(self, vehicle, timestamp)

Source from the content-addressed store, hash-verified

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):

Callers

nothing calls this directly

Calls 3

_calculate_speedMethod · 0.95
get_velocityMethod · 0.80
get_locationMethod · 0.80

Tested by

no test coverage detected