Constructor method. :param vehicle: actor to apply to local planner logic onto
(self, vehicle)
| 28 | """Base class to define agents in CARLA""" |
| 29 | |
| 30 | def __init__(self, vehicle): |
| 31 | """ |
| 32 | Constructor method. |
| 33 | |
| 34 | :param vehicle: actor to apply to local planner logic onto |
| 35 | """ |
| 36 | self._vehicle = vehicle |
| 37 | self._proximity_tlight_threshold = 5.0 # meters |
| 38 | self._proximity_vehicle_threshold = 10.0 # meters |
| 39 | self._local_planner = None |
| 40 | self._world = self._vehicle.get_world() |
| 41 | try: |
| 42 | self._map = self._world.get_map() |
| 43 | except RuntimeError as error: |
| 44 | print('RuntimeError: {}'.format(error)) |
| 45 | print(' The server could not send the OpenDRIVE (.xodr) file:') |
| 46 | print(' Make sure it exists, has the same name of your town, and is correct.') |
| 47 | sys.exit(1) |
| 48 | self._last_traffic_light = None |
| 49 | |
| 50 | def get_local_planner(self): |
| 51 | """Get method for protected member local planner""" |