(veh_loc, color, dist_threshold=50.0)
| 179 | |
| 180 | @staticmethod |
| 181 | def get_stopline_vtx(veh_loc, color, dist_threshold=50.0): |
| 182 | if color == 0: |
| 183 | tl_state = carla.TrafficLightState.Green |
| 184 | elif color == 1: |
| 185 | tl_state = carla.TrafficLightState.Yellow |
| 186 | elif color == 2: |
| 187 | tl_state = carla.TrafficLightState.Red |
| 188 | |
| 189 | stopline_vtx = [] |
| 190 | for i in range(TrafficLightHandler.num_tl): |
| 191 | traffic_light = TrafficLightHandler.list_tl_actor[i] |
| 192 | tv_loc = TrafficLightHandler.list_tv_loc[i] |
| 193 | if tv_loc.distance(veh_loc) > dist_threshold: |
| 194 | continue |
| 195 | if traffic_light.state != tl_state: |
| 196 | continue |
| 197 | stopline_vtx += TrafficLightHandler.list_stopline_vtx[i] |
| 198 | |
| 199 | return stopline_vtx |
no test coverage detected