ros/src/tl_detector/tl_detector.py
def is_within_detection_distance(self, waypoints, wp1, wp2):
        """
        return true if the distance between the two waypoints is
        close enough to activate the traffic light classifier.

        """
        if wp1 is None or wp2 is None:
            return True
        dist = 0
        dl = lambda a, b: math.sqrt((a.x-b.x)**2 + (a.y-b.y)**2  + (a.z-b.z)**2)
        # jumping every 3 wps because we just need a coarse estimate
        for i in range(wp1, wp2+1, 3):
            dist += dl(waypoints[wp1].pose.pose.position, waypoints[i].pose.pose.position)
            wp1 = i
            if dist > TL_DETECTION_DISTANCE_THRESHOLD:
                return False
        return True

        return true if the distance between the two waypoints is
        close enough to activate the traffic light classifier.

        
return true if the distance between the two waypoints is
close enough to activate the traffic light classifier.
return true if the distance between the two waypoints is close enough to activate the traffic light classifier .
def is_within_detection_distance(self, waypoints, wp1, wp2):
        if wp1 is None or wp2 is None:
            return True
        dist = 0
        dl = lambda a, b: math.sqrt((a.x-b.x)**2 + (a.y-b.y)**2  + (a.z-b.z)**2)
        for i in range(wp1, wp2+1, 3):
            dist += dl(waypoints[wp1].pose.pose.position, waypoints[i].pose.pose.position)
            wp1 = i
            if dist > TL_DETECTION_DISTANCE_THRESHOLD:
                return False
        return True
def is_within_detection_distance ( self , waypoints , wp1 , wp2 ) : if wp1 is None or wp2 is None : return True dist = 0 dl = lambda a , b : math . sqrt ( ( a . x - b . x ) ** 2 + ( a . y - b . y ) ** 2 + ( a . z - b . z ) ** 2 ) for i in range ( wp1 , wp2 + 1 , 3 ) : dist += dl ( waypoints [ wp1 ] . pose . pose . position , waypoints [ i ] . pose . pose . position ) wp1 = i if dist > TL_DETECTION_DISTANCE_THRESHOLD : return False return True
return true if the distance between the two waypoints is
close enough to activate the traffic light classifier.
return true if the distance between the two waypoints is close enough to activate the traffic light classifier .
"""
        return true if the distance between the two waypoints is
        close enough to activate the traffic light classifier.

        """ # jumping every 3 wps because we just need a coarse estimate
self
waypoints
wp1
wp2