@@ -75,15 +75,25 @@ def _update_information(self):
7575 This method updates the information regarding the ego
7676 vehicle based on the surrounding world.
7777 """
78+ # Speed
7879 self .config .live_info .current_speed = get_speed (self ._vehicle )
7980 self .config .live_info .current_speed_limit = self ._vehicle .get_speed_limit ()
8081 self ._local_planner .set_speed (self .config .live_info .current_speed_limit ) # note: currently redundant, but will print warning.
82+
83+ # Location
84+ self .config .live_info .current_location = self ._vehicle .get_location ()
85+ self .config .live_info .current_waypoint = self ._map .get_waypoint (self .config .live_info .current_location )
86+
87+ # Direction
88+ # NOTE: This is set at local_planner.run_step and the executed direction from the *last* step
8189 self ._direction = self ._local_planner .target_road_option
8290 if self ._direction is None :
8391 self ._direction = RoadOption .LANEFOLLOW
8492
93+ # Upcoming direction
8594 self ._look_ahead_steps = int ((self .config .live_info .current_speed_limit ) / 10 )
8695
96+ # Will take the direction that is a few meters in front of the vehicle depending on the speed
8797 self ._incoming_waypoint , self ._incoming_direction = self ._local_planner .get_incoming_waypoint_and_direction (
8898 steps = self ._look_ahead_steps )
8999 if self ._incoming_direction is None :
@@ -266,8 +276,8 @@ def run_step(self, debug=False):
266276 if self ._tailgate_counter > 0 :
267277 self ._tailgate_counter -= 1
268278
269- ego_vehicle_loc = self ._vehicle . get_location ()
270- ego_vehicle_wp = self ._map . get_waypoint ( ego_vehicle_loc )
279+ ego_vehicle_loc = self .config . live_info . current_location
280+ ego_vehicle_wp = self .config . live_info . current_waypoint
271281
272282 # 1: Red lights and stops behavior
273283 if self .traffic_light_manager ():
0 commit comments