diff --git a/PythonAPI/carla/agents/conf/agent_settings_backend.py b/PythonAPI/carla/agents/conf/agent_settings_backend.py index 90119eab6f3..e1efc15574f 100644 --- a/PythonAPI/carla/agents/conf/agent_settings_backend.py +++ b/PythonAPI/carla/agents/conf/agent_settings_backend.py @@ -254,20 +254,7 @@ class AutopilotSpeedSettings(AgentConfig): @dataclass class BasicAgentDistanceSettings(AgentConfig): - """ - Calculation of the minimum distance for # XXX - min_distance = base_min_distance + distance_ratio * vehicle_speed - - see local_planner.py `run_step` - """ - - base_min_distance : float = 3.0 - """ - Base value of the distance to keep - """ - - distance_ratio : float = 0.5 - """Increases minimum distance multiplied by speed""" + pass @dataclass @@ -554,6 +541,16 @@ class BasicAgentPlannerSettings(AgentConfig): Used with the Waypoint.next(sampling_radius) and distance between waypoints. """ + + min_distance_next_waypoint : float = 3.0 + """ + Removes waypoints from the queue that are too close to the vehicle. + + Usage: min_distance = min_distance_next_waypoint + next_waypoint_distance_ratio * vehicle_speed + """ + + next_waypoint_distance_ratio : float = 0.5 + """Increases the minimum distance to the next waypoint based on the vehicles speed.""" @dataclass diff --git a/PythonAPI/carla/agents/navigation/local_planner.py b/PythonAPI/carla/agents/navigation/local_planner.py index bd2a4066698..dc1961c4fd4 100644 --- a/PythonAPI/carla/agents/navigation/local_planner.py +++ b/PythonAPI/carla/agents/navigation/local_planner.py @@ -197,7 +197,7 @@ def run_step(self, debug=False): veh_location = self._vehicle.get_location() self.config.live_info.current_speed = get_speed(self._vehicle) # km/h # Could be removed if we assume that it was updated beforehand by the agent. vehicle_speed = self.config.live_info.current_speed / 3.6 # km/h -> m/s - self._min_distance = self.config.distance.base_min_distance + self.config.distance.distance_ratio * vehicle_speed + self._min_distance = self.config.planner.min_distance_next_waypoint + self.config.planner.next_waypoint_distance_ratio * vehicle_speed num_waypoint_removed = 0 for waypoint, _ in self._waypoints_queue: