carla-simulator / carla

Open-source simulator for autonomous driving research.
http://carla.org
MIT License
11.19k stars 3.61k forks source link

Bug: Wrong type for `steps` when calling local planner in BehaviorAgent #6966

Open abol-karimi opened 10 months ago

abol-karimi commented 10 months ago

In https://github.com/carla-simulator/carla/blob/d7b45c1e159e6d13296f7a3a4e8b13e6c2d62c18/PythonAPI/carla/agents/navigation/behavior_agent.py#L76C1-L79C42 we have:

self._look_ahead_steps = int((self._speed_limit) / 10)

self._incoming_waypoint, self._incoming_direction = self._local_planner.get_incoming_waypoint_and_direction(
        steps=self._look_ahead_steps)

and in https://github.com/carla-simulator/carla/blob/d7b45c1e159e6d13296f7a3a4e8b13e6c2d62c18/PythonAPI/carla/agents/navigation/local_planner.py#L284C1-L284C48 we have:

            return self._waypoints_queue[steps]

so sometimes I get the following error:

IndexError: cannot fit 'int' into an index-sized integer
abol-karimi commented 10 months ago

The root cause might be here: https://github.com/carla-simulator/carla/blob/d7b45c1e159e6d13296f7a3a4e8b13e6c2d62c18/PythonAPI/carla/agents/navigation/behavior_agent.py#L70 since it's not clear what get_speed_limit() returns right after spawning.