Skip to content

Commit

Permalink
No unnecessary inheritance from object and empty class brackets & other
Browse files Browse the repository at this point in the history
Removed empty variables
formatting
  • Loading branch information
Daraan committed Sep 9, 2024
1 parent 0664c4d commit f6bb133
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion PythonAPI/carla/agents/navigation/basic_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from agents.tools.hints import ObstacleDetectionResult, TrafficLightDetectionResult


class BasicAgent(object):
class BasicAgent:
"""
BasicAgent implements an agent that navigates the scene.
This agent respects traffic lights and other vehicles, but ignores stop signs.
Expand Down
1 change: 0 additions & 1 deletion PythonAPI/carla/agents/navigation/behavior_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
waypoints and avoiding other vehicles. The agent also responds to traffic lights,
traffic signs, and has different possible configurations. """

import random
import numpy as np
import carla
from agents.navigation.basic_agent import BasicAgent
Expand Down
6 changes: 3 additions & 3 deletions PythonAPI/carla/agents/navigation/behavior_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
""" This module contains the different parameters sets for each behavior. """


class Cautious(object):
class Cautious:
"""Class for Cautious agent."""
max_speed = 40
speed_lim_dist = 6
Expand All @@ -15,7 +15,7 @@ class Cautious(object):
tailgate_counter = 0


class Normal(object):
class Normal:
"""Class for Normal agent."""
max_speed = 50
speed_lim_dist = 3
Expand All @@ -26,7 +26,7 @@ class Normal(object):
tailgate_counter = 0


class Aggressive(object):
class Aggressive:
"""Class for Aggressive agent."""
max_speed = 70
speed_lim_dist = 1
Expand Down
6 changes: 3 additions & 3 deletions PythonAPI/carla/agents/navigation/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from agents.tools.misc import get_speed


class VehiclePIDController():
class VehiclePIDController:
"""
VehiclePIDController is the combination of two PID controllers
(lateral and longitudinal) to perform the
Expand Down Expand Up @@ -105,7 +105,7 @@ def set_offset(self, offset):
self._lat_controller.set_offset(offset)


class PIDLongitudinalController():
class PIDLongitudinalController:
"""
PIDLongitudinalController implements longitudinal control using a PID.
"""
Expand Down Expand Up @@ -171,7 +171,7 @@ def change_parameters(self, K_P, K_I, K_D, dt):
self._dt = dt


class PIDLateralController():
class PIDLateralController:
"""
PIDLateralController implements lateral control using a PID.
"""
Expand Down
15 changes: 9 additions & 6 deletions PythonAPI/carla/agents/navigation/global_route_planner.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,14 @@
else:
from typing_extensions import TypedDict, NotRequired

TopologyDict = TypedDict('TopologyDict', {'entry': carla.Waypoint,
'exit': carla.Waypoint,
'entryxyz': tuple[float, float, float],
'exitxyz': tuple[float, float, float],
'path': list[carla.Waypoint]})
TopologyDict = TypedDict('TopologyDict',
{
'entry': carla.Waypoint,
'exit': carla.Waypoint,
'entryxyz': tuple[float, float, float],
'exitxyz': tuple[float, float, float],
'path': list[carla.Waypoint]
})

EdgeDict = TypedDict('EdgeDict',
{
Expand All @@ -47,7 +50,7 @@
'change_waypoint': NotRequired[carla.Waypoint]
})

class GlobalRoutePlanner(object):
class GlobalRoutePlanner:
"""
This class provides a very high level route plan.
"""
Expand Down
4 changes: 2 additions & 2 deletions PythonAPI/carla/agents/navigation/local_planner.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class RoadOption(IntEnum):
CHANGELANERIGHT = 6


class LocalPlanner(object):
class LocalPlanner:
"""
LocalPlanner implements the basic behavior of following a
trajectory of waypoints that is generated on-the-fly.
Expand Down Expand Up @@ -287,7 +287,7 @@ def get_incoming_waypoint_and_direction(self, steps=3):
try:
wpt, direction = self._waypoints_queue[-1]
return wpt, direction
except IndexError as i:
except IndexError:
return None, RoadOption.VOID

def get_plan(self):
Expand Down

0 comments on commit f6bb133

Please sign in to comment.