Skip to content

Commit

Permalink
Fixed agent crashes due to API changes in is_within_distance_ahead (#…
Browse files Browse the repository at this point in the history
…2386)

* Fixed agent crashes due to API changes in is_within_distance_ahead
  • Loading branch information
fabianoboril authored and germanros1987 committed Jan 23, 2020
1 parent 7bd95e4 commit 1f7669e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* New python clients:
- `weather.py`: allows weather changes using the new weather parameters
* Fixed typos
* Fixed agent failures due to API changes in is_within_distance_ahead()

## CARLA 0.9.7
* Upgraded parameters of Unreal/CarlaUE4/Config/DefaultInput.ini to prevent mouse freeze
Expand Down
10 changes: 4 additions & 6 deletions PythonAPI/carla/agents/navigation/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,8 @@ def _is_light_red_europe_style(self, lights_list):
object_waypoint.lane_id != ego_vehicle_waypoint.lane_id:
continue

loc = traffic_light.get_location()
if is_within_distance_ahead(loc, ego_vehicle_location,
self._vehicle.get_transform().rotation.yaw,
if is_within_distance_ahead(traffic_light.get_transform(),
self._vehicle.get_transform(),
self._proximity_threshold):
if traffic_light.state == carla.TrafficLightState.Red:
return (True, traffic_light)
Expand Down Expand Up @@ -184,9 +183,8 @@ def _is_vehicle_hazard(self, vehicle_list):
target_vehicle_waypoint.lane_id != ego_vehicle_waypoint.lane_id:
continue

loc = target_vehicle.get_location()
if is_within_distance_ahead(loc, ego_vehicle_location,
self._vehicle.get_transform().rotation.yaw,
if is_within_distance_ahead(target_vehicle.get_transform(),
self._vehicle.get_transform(),
self._proximity_threshold):
return (True, target_vehicle)

Expand Down

0 comments on commit 1f7669e

Please sign in to comment.