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

Method __init__

PythonAPI/examples/automatic_control.py:425–435  ·  view source on GitHub ↗
(self, parent_actor, hud)

Source from the content-addressed store, hash-verified

423
424class LaneInvasionSensor(object):
425 def __init__(self, parent_actor, hud):
426 self.sensor = None
427 self._parent = parent_actor
428 self.hud = hud
429 world = self._parent.get_world()
430 bp = world.get_blueprint_library().find('sensor.other.lane_invasion')
431 self.sensor = world.spawn_actor(bp, carla.Transform(), attach_to=self._parent)
432 # We need to pass the lambda a weak reference to self to avoid circular
433 # reference.
434 weak_self = weakref.ref(self)
435 self.sensor.listen(lambda event: LaneInvasionSensor._on_invasion(weak_self, event))
436
437 @staticmethod
438 def _on_invasion(weak_self, event):

Callers

nothing calls this directly

Calls 3

spawn_actorMethod · 0.45
TransformMethod · 0.45
_on_invasionMethod · 0.45

Tested by

no test coverage detected