MCPcopy Create free account
hub / github.com/OpenDriveLab/DriveAdapter / _should_brake

Method _should_brake

leaderboard/team_code/auto_pilot.py:197–210  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

195 return control
196
197 def _should_brake(self):
198 actors = self._world.get_actors()
199
200 vehicle = self._is_vehicle_hazard(actors.filter('*vehicle*'))
201 light = self._is_light_red(actors.filter('*traffic_light*'))
202 walker = self._is_walker_hazard(actors.filter('*walker*'))
203 stop_sign = self._is_stop_sign_hazard(actors.filter('*stop*'))
204
205 self.is_vehicle_present = 1 if vehicle is not None else 0
206 self.is_red_light_present = 1 if light is not None else 0
207 self.is_pedestrian_present = 1 if walker is not None else 0
208 self.is_stop_sign_present = 1 if stop_sign is not None else 0
209
210 return any(x is not None for x in [vehicle, light, walker, stop_sign])
211
212 def _point_inside_boundingbox(self, point, bb_center, bb_extent):
213 A = carla.Vector2D(bb_center.x - bb_extent.x, bb_center.y - bb_extent.y)

Callers 1

_get_controlMethod · 0.95

Calls 5

_is_vehicle_hazardMethod · 0.95
_is_light_redMethod · 0.95
_is_walker_hazardMethod · 0.95
_is_stop_sign_hazardMethod · 0.95
get_actorsMethod · 0.80

Tested by

no test coverage detected