carla
carla copied to clipboard
Bugfixes for python agents obstacle detection when empty vehicle_list is passed.
Description
Fixes a bug in the BasicAgent.py detect_vehicle code which manifests in two errors:
When an empty list is passed the current code fills the list with all vehicles.
if not vehicle_list: # adjusted to if vehicle_list is not None
vehicle_list = self._world.get_actors().filter("*vehicle*")
This is not intended and manifests in these two bugs:
-
This does not allow to pass an empty list to save performance, e.g. if no vehicles are currently nearby.
-
BehaviourAgent.py: On a map without pedestrians, the current code is also used with an empty list which then detects cars as pedestrians.
Where has this been tested?
- Platform(s): NA
- Python version(s): 3.7, 3.9
- Unreal Engine version(s): NA
Possible Drawbacks
In the case that people passed an empty list expecting it to be filled with all cars will fail to detect surrounding cars now. In my opinions sounds very unlikely.
Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would update our CHANGELOG.md based on your changes.