MCPcopy Create free account
hub / github.com/AdaCompNUS/summit / __init__

Method __init__

PythonAPI/examples/manual_control.py:681–692  ·  view source on GitHub ↗
(self, parent_actor, hud)

Source from the content-addressed store, hash-verified

679
680class CollisionSensor(object):
681 def __init__(self, parent_actor, hud):
682 self.sensor = None
683 self.history = []
684 self._parent = parent_actor
685 self.hud = hud
686 world = self._parent.get_world()
687 bp = world.get_blueprint_library().find('sensor.other.collision')
688 self.sensor = world.spawn_actor(bp, carla.Transform(), attach_to=self._parent)
689 # We need to pass the lambda a weak reference to self to avoid circular
690 # reference.
691 weak_self = weakref.ref(self)
692 self.sensor.listen(lambda event: CollisionSensor._on_collision(weak_self, event))
693
694 def get_collision_history(self):
695 history = collections.defaultdict(int)

Callers

nothing calls this directly

Calls 3

spawn_actorMethod · 0.45
TransformMethod · 0.45
_on_collisionMethod · 0.45

Tested by

no test coverage detected