ros/src/tl_detector/tl_detector.py
def image_cb(self, msg):
        """Identifies red lights in the incoming camera image and publishes the index
            of the waypoint closest to the red light's stop line to /traffic_waypoint

        Args:
            msg (Image): image from car-mounted camera

        """
        self.has_image = True
        self.camera_image = msg
        light_wp, state = self.process_traffic_lights()

        '''
        Publish upcoming red lights at camera frequency.
        Each predicted state has to occur `STATE_COUNT_THRESHOLD` number
        of times till we start using it. Otherwise the previous stable state is
        used.
        '''
        if self.state != state:
            self.state_count = 0
            self.state = state
        elif self.state_count >= STATE_COUNT_THRESHOLD:
            self.last_state = self.state
            light_wp = light_wp if state == TrafficLight.RED \
                                   or state == TrafficLight.YELLOW else -1
            self.last_wp = light_wp
            self.upcoming_red_light_pub.publish(Int32(light_wp))
        else:
            self.upcoming_red_light_pub.publish(Int32(self.last_wp))

        self.state_count = self.state_count + 1
Identifies red lights in the incoming camera image and publishes the index
            of the waypoint closest to the red light's stop line to /traffic_waypoint

        Args:
            msg (Image): image from car-mounted camera

        
Identifies red lights in the incoming camera image and publishes the index
of the waypoint closest to the red light's stop line to /traffic_waypoint
Identifies red lights in the incoming camera image and publishes the index of the waypoint closest to the red light ' s stop line to / traffic_waypoint
def image_cb(self, msg):
        self.has_image = True
        self.camera_image = msg
        light_wp, state = self.process_traffic_lights()
        if self.state != state:
            self.state_count = 0
            self.state = state
        elif self.state_count >= STATE_COUNT_THRESHOLD:
            self.last_state = self.state
            light_wp = light_wp if state == TrafficLight.RED \
                                   or state == TrafficLight.YELLOW else -1
            self.last_wp = light_wp
            self.upcoming_red_light_pub.publish(Int32(light_wp))
        else:
            self.upcoming_red_light_pub.publish(Int32(self.last_wp))
        self.state_count = self.state_count + 1
def image_cb ( self , msg ) : self . has_image = True self . camera_image = msg light_wp , state = self . process_traffic_lights ( ) '''
        Publish upcoming red lights at camera frequency.
        Each predicted state has to occur `STATE_COUNT_THRESHOLD` number
        of times till we start using it. Otherwise the previous stable state is
        used.
        ''' if self . state != state : self . state_count = 0 self . state = state elif self . state_count >= STATE_COUNT_THRESHOLD : self . last_state = self . state light_wp = light_wp if state == TrafficLight . RED or state == TrafficLight . YELLOW else - 1 self . last_wp = light_wp self . upcoming_red_light_pub . publish ( Int32 ( light_wp ) ) else : self . upcoming_red_light_pub . publish ( Int32 ( self . last_wp ) ) self . state_count = self . state_count + 1
Identifies red lights in the incoming camera image and publishes the index
of the waypoint closest to the red light's stop line to /traffic_waypoint
Identifies red lights in the incoming camera image and publishes the index of the waypoint closest to the red light ' s stop line to / traffic_waypoint
"""Identifies red lights in the incoming camera image and publishes the index
            of the waypoint closest to the red light's stop line to /traffic_waypoint

        Args:
            msg (Image): image from car-mounted camera

        """ '''
        Publish upcoming red lights at camera frequency.
        Each predicted state has to occur `STATE_COUNT_THRESHOLD` number
        of times till we start using it. Otherwise the previous stable state is
        used.
        '''
self
msg
image from car-mounted camera
image from car - mounted camera