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 Apr 16, 2024
1 parent edb20a1 commit 377d702
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions PythonAPI/carla/agents/navigation/basic_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,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 @@ -71,9 +71,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 @@ -111,7 +112,8 @@ def get_global_planner(self):
"""Get method for protected member local planner"""
return self._global_planner

def set_destination(self, end_location: carla.Location, start_location=None):
def set_destination(self, end_location, start_location=None):
# type: (carla.Location, carla.Location) -> None
"""
This method creates a list of waypoints between a starting and ending location,
based on the route returned by the global router, and adds it to the local planner.
Expand Down Expand Up @@ -149,7 +151,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 377d702

Please sign in to comment.