Skip to content

Commit

Permalink
Made close waypoint removal setting more clear and moved it to Planne…
Browse files Browse the repository at this point in the history
…r settings
  • Loading branch information
Daraan committed Mar 5, 2024
1 parent 3f587a8 commit 21acf57
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
25 changes: 11 additions & 14 deletions PythonAPI/carla/agents/conf/agent_settings_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion PythonAPI/carla/agents/navigation/local_planner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.distance.min_distance_next_waypoint + self.config.distance.next_waypoint_distance_ratio * vehicle_speed

num_waypoint_removed = 0
for waypoint, _ in self._waypoints_queue:
Expand Down

0 comments on commit 21acf57

Please sign in to comment.