leaderboard/scripts/set_new_scenarios.py
def draw_scenarios(world, scenarios, args):
    """
    Draws all the points related to args.scenarios
    """
    z = 3

    if scenarios["scenario_type"] in args.scenarios:
        number = float(scenarios["scenario_type"][8:])
        color = SCENARIO_COLOR[scenarios["scenario_type"]][0]

        event_list = scenarios["available_event_configurations"]
        for i in range(len(event_list)):
            event = event_list[i]
            _waypoint = event['transform']  # trigger point of this scenario
            location = carla.Location(float(_waypoint["x"]), float(_waypoint["y"]), float(_waypoint["z"]))

            scenario_location = location + carla.Location(z=number / z)
            world.debug.draw_point(scenario_location, size=float(0.15), color=color)
            world.debug.draw_string(scenario_location + carla.Location(z=0.1), text=str(i+1), color=carla.Color(0, 0, 0), life_time=1000)

            if args.debug:
                save_from_dict(args.endpoint, _waypoint)
                spectator = world.get_spectator()
                spectator.set_transform(carla.Transform(location + carla.Location(z=50),
                                                            carla.Rotation(pitch=-90)))
                print(" Scenario [{}/{}]. Press Enter for the next scenario".format(i+1, len(event_list)))
                input()
        world.wait_for_tick()

    Draws all the points related to args.scenarios
    
Draws all the points related to args.scenarios
Draws all the points related to args . scenarios
def draw_scenarios(world, scenarios, args):
    z = 3
    if scenarios["scenario_type"] in args.scenarios:
        number = float(scenarios["scenario_type"][8:])
        color = SCENARIO_COLOR[scenarios["scenario_type"]][0]
        event_list = scenarios["available_event_configurations"]
        for i in range(len(event_list)):
            event = event_list[i]
            _waypoint = event['transform']  
            location = carla.Location(float(_waypoint["x"]), float(_waypoint["y"]), float(_waypoint["z"]))
            scenario_location = location + carla.Location(z=number / z)
            world.debug.draw_point(scenario_location, size=float(0.15), color=color)
            world.debug.draw_string(scenario_location + carla.Location(z=0.1), text=str(i+1), color=carla.Color(0, 0, 0), life_time=1000)
            if args.debug:
                save_from_dict(args.endpoint, _waypoint)
                spectator = world.get_spectator()
                spectator.set_transform(carla.Transform(location + carla.Location(z=50),
                                                            carla.Rotation(pitch=-90)))
                print(" Scenario [{}/{}]. Press Enter for the next scenario".format(i+1, len(event_list)))
                input()
        world.wait_for_tick()
def draw_scenarios ( world , scenarios , args ) : z = 3 if scenarios [ "scenario_type" ] in args . scenarios : number = float ( scenarios [ "scenario_type" ] [ 8 : ] ) color = SCENARIO_COLOR [ scenarios [ "scenario_type" ] ] [ 0 ] event_list = scenarios [ "available_event_configurations" ] for i in range ( len ( event_list ) ) : event = event_list [ i ] _waypoint = event [ 'transform' ] location = carla . Location ( float ( _waypoint [ "x" ] ) , float ( _waypoint [ "y" ] ) , float ( _waypoint [ "z" ] ) ) scenario_location = location + carla . Location ( z = number / z ) world . debug . draw_point ( scenario_location , size = float ( 0.15 ) , color = color ) world . debug . draw_string ( scenario_location + carla . Location ( z = 0.1 ) , text = str ( i + 1 ) , color = carla . Color ( 0 , 0 , 0 ) , life_time = 1000 ) if args . debug : save_from_dict ( args . endpoint , _waypoint ) spectator = world . get_spectator ( ) spectator . set_transform ( carla . Transform ( location + carla . Location ( z = 50 ) , carla . Rotation ( pitch = - 90 ) ) ) print ( " Scenario [{}/{}]. Press Enter for the next scenario" . format ( i + 1 , len ( event_list ) ) ) input ( ) world . wait_for_tick ( )
Draws all the points related to args.scenarios
Draws all the points related to args . scenarios
"""
    Draws all the points related to args.scenarios
    """ # trigger point of this scenario
world
scenarios
args