Improvements to manual_control.py

This commit is contained in:
nsubiron 2018-11-14 20:29:38 +01:00
parent 0a06dc7db6
commit 02be13d9e7
1 changed files with 8 additions and 3 deletions

View File

@ -175,7 +175,12 @@ class World(object):
self.hud.render(display)
def destroy(self):
for actor in [self.camera_manager.sensor, self.collision_sensor.sensor, self.vehicle]:
actors = [
self.camera_manager.sensor,
self.collision_sensor.sensor,
self.lane_invasion_sensor.sensor,
self.vehicle]
for actor in actors:
if actor is not None:
actor.destroy()
@ -496,8 +501,8 @@ class LaneInvasionSensor(object):
self = weak_self()
if not self:
return
text = ', '.join('%r' % x for x in event.crossed_lane_markings)
self._hud.notification('Crossed lane(s) %s' % text)
text = ['%r' % str(x).split()[-1] for x in set(event.crossed_lane_markings)]
self._hud.notification('Crossed lane %s' % ' and '.join(text))
# ==============================================================================