Skip to content

Commit

Permalink
Type-hints as comments only
Browse files Browse the repository at this point in the history
Backward compatibility
  • Loading branch information
Daraan committed Jun 21, 2024
1 parent 921310e commit bab4fc3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions PythonAPI/carla/agents/navigation/basic_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def __init__(self, vehicle, opt_dict=BasicAgentSettings(), map_inst=None, grp_in
:param grp_inst: GlobalRoutePlanner instance to avoid the expensive call of getting it.
"""
self._vehicle = vehicle
self._vehicle = vehicle # type: carla.Vehicle
self._world = self._vehicle.get_world()
if map_inst:
if isinstance(map_inst, carla.Map):
Expand Down Expand Up @@ -73,9 +73,10 @@ def __init__(self, vehicle, opt_dict=BasicAgentSettings(), map_inst=None, grp_in
# Get the static elements of the scene
self._lights_list = self._world.get_actors().filter("*traffic_light*")
# Dictionary mapping a traffic light to a Waypoint corresponding to its trigger volume location
self._lights_map: "dict[int, carla.Waypoint]" = {}
self._lights_map = {} # type: "dict[int, carla.Waypoint]"

def add_emergency_stop(self, control: carla.VehicleControl):
def add_emergency_stop(self, control):
# type: (carla.VehicleControl) -> carla.VehicleControl
"""
Overwrites the throttle a brake values of a control to perform an emergency stop.
The steering is kept the same to avoid going out of the lane when stopping during turns
Expand Down Expand Up @@ -157,7 +158,8 @@ def set_global_plan(self, plan, stop_waypoint_creation=True, clean_queue=True):
clean_queue=clean_queue
)

def trace_route(self, start_waypoint: carla.Waypoint, end_waypoint: carla.Waypoint):
def trace_route(self, start_waypoint, end_waypoint):
# type: (carla.Waypoint, carla.Waypoint) -> list[carla.Waypoint]
"""
Calculates the shortest route between a starting and ending waypoint.
Expand Down

0 comments on commit bab4fc3

Please sign in to comment.