Find all actors of a certain type that are close to the vehicle Args: obstacle_type (str, optional): [description]. Defaults to '*traffic_light*'. Returns: [type]: [description]
(self, obstacle_type='*traffic_light*')
| 882 | return in_meters |
| 883 | |
| 884 | def _find_obstacle(self, obstacle_type='*traffic_light*'): |
| 885 | """Find all actors of a certain type that are close to the vehicle |
| 886 | |
| 887 | Args: |
| 888 | obstacle_type (str, optional): [description]. Defaults to '*traffic_light*'. |
| 889 | |
| 890 | Returns: |
| 891 | [type]: [description] |
| 892 | """ |
| 893 | obst = list() |
| 894 | |
| 895 | _actors = self._world.get_actors() |
| 896 | _obstacles = _actors.filter(obstacle_type) |
| 897 | |
| 898 | |
| 899 | for _obstacle in _obstacles: |
| 900 | trigger = _obstacle.trigger_volume |
| 901 | |
| 902 | _obstacle.get_transform().transform(trigger.location) |
| 903 | |
| 904 | distance_to_car = trigger.location.distance(self._vehicle.get_location()) |
| 905 | |
| 906 | a = np.sqrt( |
| 907 | trigger.extent.x ** 2 + |
| 908 | trigger.extent.y ** 2 + |
| 909 | trigger.extent.z ** 2) |
| 910 | b = np.sqrt( |
| 911 | self._vehicle.bounding_box.extent.x ** 2 + |
| 912 | self._vehicle.bounding_box.extent.y ** 2 + |
| 913 | self._vehicle.bounding_box.extent.z ** 2) |
| 914 | |
| 915 | s = a + b + 10 |
| 916 | |
| 917 | |
| 918 | if distance_to_car <= s: |
| 919 | # the actor is affected by this obstacle. |
| 920 | obst.append(_obstacle) |
| 921 | |
| 922 | return obst |
| 923 | |
| 924 | def _get_camera_to_car_calibration(self, sensor): |
| 925 | """returns the calibration matrix for the given sensor |
nothing calls this directly
no test coverage detected