Fixed bug "'World' object has no attribute 'player'" when using BehaviorAgent with an instance of carla.libcarla.World class.
This commit is contained in:
parent
fcb291e0e3
commit
5ce501d079
|
@ -74,15 +74,13 @@ class BehaviorAgent(Agent):
|
|||
elif behavior == 'aggressive':
|
||||
self.behavior = Aggressive()
|
||||
|
||||
def update_information(self, world):
|
||||
def update_information(self):
|
||||
"""
|
||||
This method updates the information regarding the ego
|
||||
vehicle based on the surrounding world.
|
||||
|
||||
:param world: carla.world object
|
||||
"""
|
||||
self.speed = get_speed(self.vehicle)
|
||||
self.speed_limit = world.player.get_speed_limit()
|
||||
self.speed_limit = self.vehicle.get_speed_limit()
|
||||
self._local_planner.set_speed(self.speed_limit)
|
||||
self.direction = self._local_planner.target_road_option
|
||||
if self.direction is None:
|
||||
|
@ -95,7 +93,7 @@ class BehaviorAgent(Agent):
|
|||
if self.incoming_direction is None:
|
||||
self.incoming_direction = RoadOption.LANEFOLLOW
|
||||
|
||||
self.is_at_traffic_light = world.player.is_at_traffic_light()
|
||||
self.is_at_traffic_light = self.vehicle.is_at_traffic_light()
|
||||
if self.ignore_traffic_light:
|
||||
self.light_state = "Green"
|
||||
else:
|
||||
|
|
|
@ -733,7 +733,7 @@ def game_loop(args):
|
|||
control.manual_gear_shift = False
|
||||
world.player.apply_control(control)
|
||||
else:
|
||||
agent.update_information(world)
|
||||
agent.update_information()
|
||||
|
||||
world.tick(clock)
|
||||
world.render(display)
|
||||
|
|
Loading…
Reference in New Issue