srunner/tools/scenario_helper.py
def generate_target_waypoint_list(waypoint, turn=0):
    """
    This method follow waypoints to a junction and choose path based on turn input.
    Turn input: LEFT -> -1, RIGHT -> 1, STRAIGHT -> 0
    @returns a waypoint list from the starting point to the end point according to turn input
    """
    reached_junction = False
    threshold = math.radians(0.1)
    plan = []
    while True:
        wp_choice = waypoint.next(2)
        if len(wp_choice) > 1:
            reached_junction = True
            waypoint = choose_at_junction(waypoint, wp_choice, turn)
        else:
            waypoint = wp_choice[0]
        plan.append((waypoint, RoadOption.LANEFOLLOW))
        #   End condition for the behavior
        if turn != 0 and reached_junction and len(plan) >= 3:
            v_1 = vector(
                plan[-2][0].transform.location,
                plan[-1][0].transform.location)
            v_2 = vector(
                plan[-3][0].transform.location,
                plan[-2][0].transform.location)
            angle_wp = math.acos(
                np.dot(v_1, v_2) / abs((np.linalg.norm(v_1) * np.linalg.norm(v_2))))
            if angle_wp < threshold:
                break
        elif reached_junction and not plan[-1][0].is_intersection:
            break

    return plan, plan[-1][0]

    This method follow waypoints to a junction and choose path based on turn input.
    Turn input: LEFT -> -1, RIGHT -> 1, STRAIGHT -> 0
    @returns a waypoint list from the starting point to the end point according to turn input
    
This method follow waypoints to a junction and choose path based on turn input.
Turn input: LEFT -> -1, RIGHT -> 1, STRAIGHT -> 0
@returns a waypoint list from the starting point to the end point according to turn input
This method follow waypoints to a junction and choose path based on turn input . Turn input : LEFT - > - 1 RIGHT - > 1 STRAIGHT - > 0 @returns a waypoint list from the starting point to the end point according to turn input
def generate_target_waypoint_list(waypoint, turn=0):
    reached_junction = False
    threshold = math.radians(0.1)
    plan = []
    while True:
        wp_choice = waypoint.next(2)
        if len(wp_choice) > 1:
            reached_junction = True
            waypoint = choose_at_junction(waypoint, wp_choice, turn)
        else:
            waypoint = wp_choice[0]
        plan.append((waypoint, RoadOption.LANEFOLLOW))
        if turn != 0 and reached_junction and len(plan) >= 3:
            v_1 = vector(
                plan[-2][0].transform.location,
                plan[-1][0].transform.location)
            v_2 = vector(
                plan[-3][0].transform.location,
                plan[-2][0].transform.location)
            angle_wp = math.acos(
                np.dot(v_1, v_2) / abs((np.linalg.norm(v_1) * np.linalg.norm(v_2))))
            if angle_wp < threshold:
                break
        elif reached_junction and not plan[-1][0].is_intersection:
            break
    return plan, plan[-1][0]
def generate_target_waypoint_list ( waypoint , turn = 0 ) : reached_junction = False threshold = math . radians ( 0.1 ) plan = [ ] while True : wp_choice = waypoint . next ( 2 ) if len ( wp_choice ) > 1 : reached_junction = True waypoint = choose_at_junction ( waypoint , wp_choice , turn ) else : waypoint = wp_choice [ 0 ] plan . append ( ( waypoint , RoadOption . LANEFOLLOW ) ) if turn != 0 and reached_junction and len ( plan ) >= 3 : v_1 = vector ( plan [ - 2 ] [ 0 ] . transform . location , plan [ - 1 ] [ 0 ] . transform . location ) v_2 = vector ( plan [ - 3 ] [ 0 ] . transform . location , plan [ - 2 ] [ 0 ] . transform . location ) angle_wp = math . acos ( np . dot ( v_1 , v_2 ) / abs ( ( np . linalg . norm ( v_1 ) * np . linalg . norm ( v_2 ) ) ) ) if angle_wp < threshold : break elif reached_junction and not plan [ - 1 ] [ 0 ] . is_intersection : break return plan , plan [ - 1 ] [ 0 ]
This method follow waypoints to a junction and choose path based on turn input.
This method follow waypoints to a junction and choose path based on turn input .
"""
    This method follow waypoints to a junction and choose path based on turn input.
    Turn input: LEFT -> -1, RIGHT -> 1, STRAIGHT -> 0
    @returns a waypoint list from the starting point to the end point according to turn input
    """ #   End condition for the behavior
waypoint
turn