carla icon indicating copy to clipboard operation
carla copied to clipboard

Bugfixes for python agents obstacle detection when empty vehicle_list is passed.

Open Daraan opened this issue 1 year ago • 1 comments

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:

  1. This does not allow to pass an empty list to save performance, e.g. if no vehicles are currently nearby.

  2. 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.

Daraan avatar Feb 09 '24 18:02 Daraan

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.

update-docs[bot] avatar Feb 09 '24 18:02 update-docs[bot]