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

Method tick

roach/criteria/route_deviation.py:9–34  ·  view source on GitHub ↗
(self, vehicle, timestamp, ref_waypoint, distance_traveled, route_length)

Source from the content-addressed store, hash-verified

7 self._out_route_distance = 0.0
8
9 def tick(self, vehicle, timestamp, ref_waypoint, distance_traveled, route_length):
10 ev_loc = vehicle.get_location()
11
12 distance = ev_loc.distance(ref_waypoint.transform.location)
13
14 # fail if off_route is True
15 off_route_max = distance > self._offroad_max
16
17 # fail if off_safe_route more than 30% of total route length
18 off_route_min = False
19 if distance > self._offroad_min:
20 self._out_route_distance += distance_traveled
21 out_route_percentage = self._out_route_distance / route_length
22 if out_route_percentage > self._max_route_percentage:
23 off_route_min = True
24
25 info = None
26 if off_route_max or off_route_min:
27 info = {
28 'step': timestamp['step'],
29 'simulation_time': timestamp['relative_simulation_time'],
30 'ev_loc': [ev_loc.x, ev_loc.y, ev_loc.z],
31 'off_route_max': off_route_max,
32 'off_route_min': off_route_min
33 }
34 return info

Callers

nothing calls this directly

Calls 2

get_locationMethod · 0.80
distanceMethod · 0.80

Tested by

no test coverage detected