MCPcopy Create free account
hub / github.com/OpenDriveLab/DriveAdapter / __init__

Method __init__

agents/navigation/behavior_agent.py:36–75  ·  view source on GitHub ↗

Constructor method. :param vehicle: actor to apply to local planner logic onto :param ignore_traffic_light: boolean to ignore any traffic light :param behavior: type of agent to apply

(self, vehicle, ignore_traffic_light=False, behavior='normal')

Source from the content-addressed store, hash-verified

34 """
35
36 def __init__(self, vehicle, ignore_traffic_light=False, behavior='normal'):
37 """
38 Constructor method.
39
40 :param vehicle: actor to apply to local planner logic onto
41 :param ignore_traffic_light: boolean to ignore any traffic light
42 :param behavior: type of agent to apply
43 """
44
45 super(BehaviorAgent, self).__init__(vehicle)
46 self.vehicle = vehicle
47 self.ignore_traffic_light = ignore_traffic_light
48 self._local_planner = LocalPlanner(self)
49 self._grp = None
50 self.look_ahead_steps = 0
51
52 # Vehicle information
53 self.speed = 0
54 self.speed_limit = 0
55 self.direction = None
56 self.incoming_direction = None
57 self.incoming_waypoint = None
58 self.start_waypoint = None
59 self.end_waypoint = None
60 self.is_at_traffic_light = 0
61 self.light_state = "Green"
62 self.light_id_to_ignore = -1
63 self.min_speed = 5
64 self.behavior = None
65 self._sampling_resolution = 4.5
66
67 # Parameters for agent behavior
68 if behavior == 'cautious':
69 self.behavior = Cautious()
70
71 elif behavior == 'normal':
72 self.behavior = Normal()
73
74 elif behavior == 'aggressive':
75 self.behavior = Aggressive()
76
77 def update_information(self, world):
78 """

Callers

nothing calls this directly

Calls 4

LocalPlannerClass · 0.90
CautiousClass · 0.90
NormalClass · 0.90
AggressiveClass · 0.90

Tested by

no test coverage detected