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

Method __init__

roach/criteria/collision.py:7–25  ·  view source on GitHub ↗
(self, vehicle, carla_world, intensity_threshold=0.0,
                 min_area_of_collision=3, max_area_of_collision=5, max_id_time=5)

Source from the content-addressed store, hash-verified

5
6class Collision():
7 def __init__(self, vehicle, carla_world, intensity_threshold=0.0,
8 min_area_of_collision=3, max_area_of_collision=5, max_id_time=5):
9 blueprint = carla_world.get_blueprint_library().find('sensor.other.collision')
10 self._collision_sensor = carla_world.spawn_actor(blueprint, carla.Transform(), attach_to=vehicle)
11 self._collision_sensor.listen(lambda event: self._on_collision(weakref.ref(self), event))
12 self._collision_info = None
13
14 self.registered_collisions = []
15 self.last_id = None
16 self.collision_time = None
17
18 # If closer than this distance, the collision is ignored
19 self._min_area_of_collision = min_area_of_collision
20 # If further than this distance, the area is forgotten
21 self._max_area_of_collision = max_area_of_collision
22 # Amount of time the last collision if is remembered
23 self._max_id_time = max_id_time
24 # intensity_threshold, LBC uses 400, leaderboard does not use it (set to 0)
25 self._intensity_threshold = intensity_threshold
26
27 def tick(self, vehicle, timestamp):
28 ev_loc = vehicle.get_location()

Callers

nothing calls this directly

Calls 2

_on_collisionMethod · 0.95
listenMethod · 0.80

Tested by

no test coverage detected