leaderboard/scripts/set_new_scenarios.py
def main():
    """
    Used to help with the visualization of the scenario trigger points, as well as its
    modifications.
        --town: Selects the town
        --scenario: The scenario that will be printed. Use the number of the scenarios 1 2 3 ...
        --modify: Used to modify the trigger_points of the given scenario in args.scenarios.
          debug is auto-enabled here. It will be shown red if they aren't apart enough or green, if they are
        --debug: If debug is selected, the points will be shown one by one, and stored at --endpoint,
    in case some copy-pasting is required.
    """

    # general parameters
    parser = argparse.ArgumentParser(formatter_class=RawTextHelpFormatter)
    parser.add_argument('--town', default='Town08')
    parser.add_argument('--debug', action='store_true')
    parser.add_argument('--reload', action='store_true')
    parser.add_argument('--inipoint', default="")
    parser.add_argument('--endpoint', default="set_new_scenarios.json")
    parser.add_argument('--scenarios', nargs='+', default='Scenario7')
    parser.add_argument('--modify', action='store_true')
    parser.add_argument('--host', default='localhost', help='IP of the host server (default: localhost)')
    parser.add_argument('--port', default='2000', help='TCP port to listen to (default: 2000)')

    args = parser.parse_args()

    # 0) Set the world
    client = carla.Client(args.host, int(args.port))
    client.set_timeout(20)
    if args.reload:
        world = client.load_world(args.town)
    else:
        world = client.get_world()

    settings = world.get_settings()
    settings.fixed_delta_seconds = None
    settings.synchronous_mode = False
    world.apply_settings(settings)

    # 1) Read the json file
    data = fetch_dict(args.inipoint)
    data = data["available_scenarios"][0]

    town_data = data[args.town]

    new_args_scenario = []
    for ar_sc in args.scenarios:
        new_args_scenario.append("Scenario" + ar_sc)
    args.scenarios = new_args_scenario

    for scenarios in town_data:

        if args.modify:
            modify_junction_scenarios(world, scenarios, args)
        else:
            draw_scenarios(world, scenarios, args)

    print(" ---------------------------- ")
    for ar_sc in args.scenarios:
        print(" {} is colored as {}".format(ar_sc, SCENARIO_COLOR[ar_sc][1]))
    print(" ---------------------------- ")

    Used to help with the visualization of the scenario trigger points, as well as its
    modifications.
        --town: Selects the town
        --scenario: The scenario that will be printed. Use the number of the scenarios 1 2 3 ...
        --modify: Used to modify the trigger_points of the given scenario in args.scenarios.
          debug is auto-enabled here. It will be shown red if they aren't apart enough or green, if they are
        --debug: If debug is selected, the points will be shown one by one, and stored at --endpoint,
    in case some copy-pasting is required.
    
Used to help with the visualization of the scenario trigger points, as well as its
modifications.
town: Selects the town
scenario: The scenario that will be printed. Use the number of the scenarios 1 2 3
modify: Used to modify the trigger_points of the given scenario in args.scenarios.
debug is auto-enabled here. It will be shown red if they aren't apart enough or green, if they are
debug: If debug is selected, the points will be shown one by one, and stored at --endpoint,
in case some copy-pasting is required.
Used to help with the visualization of the scenario trigger points as well as its modifications . town : Selects the town scenario : The scenario that will be printed . Use the number of the scenarios 1 2 3 modify : Used to modify the trigger_points of the given scenario in args . scenarios . debug is auto - enabled here . It will be shown red if they aren ' t apart enough or green if they are debug : If debug is selected the points will be shown one by one and stored at -- endpoint in case some copy - pasting is required .
def main():
    parser = argparse.ArgumentParser(formatter_class=RawTextHelpFormatter)
    parser.add_argument('--town', default='Town08')
    parser.add_argument('--debug', action='store_true')
    parser.add_argument('--reload', action='store_true')
    parser.add_argument('--inipoint', default="")
    parser.add_argument('--endpoint', default="set_new_scenarios.json")
    parser.add_argument('--scenarios', nargs='+', default='Scenario7')
    parser.add_argument('--modify', action='store_true')
    parser.add_argument('--host', default='localhost', help='IP of the host server (default: localhost)')
    parser.add_argument('--port', default='2000', help='TCP port to listen to (default: 2000)')
    args = parser.parse_args()
    client = carla.Client(args.host, int(args.port))
    client.set_timeout(20)
    if args.reload:
        world = client.load_world(args.town)
    else:
        world = client.get_world()
    settings = world.get_settings()
    settings.fixed_delta_seconds = None
    settings.synchronous_mode = False
    world.apply_settings(settings)
    data = fetch_dict(args.inipoint)
    data = data["available_scenarios"][0]
    town_data = data[args.town]
    new_args_scenario = []
    for ar_sc in args.scenarios:
        new_args_scenario.append("Scenario" + ar_sc)
    args.scenarios = new_args_scenario
    for scenarios in town_data:
        if args.modify:
            modify_junction_scenarios(world, scenarios, args)
        else:
            draw_scenarios(world, scenarios, args)
    print(" ---------------------------- ")
    for ar_sc in args.scenarios:
        print(" {} is colored as {}".format(ar_sc, SCENARIO_COLOR[ar_sc][1]))
    print(" ---------------------------- ")
def main ( ) : parser = argparse . ArgumentParser ( formatter_class = RawTextHelpFormatter ) parser . add_argument ( '--town' , default = 'Town08' ) parser . add_argument ( '--debug' , action = 'store_true' ) parser . add_argument ( '--reload' , action = 'store_true' ) parser . add_argument ( '--inipoint' , default = "" ) parser . add_argument ( '--endpoint' , default = "set_new_scenarios.json" ) parser . add_argument ( '--scenarios' , nargs = '+' , default = 'Scenario7' ) parser . add_argument ( '--modify' , action = 'store_true' ) parser . add_argument ( '--host' , default = 'localhost' , help = 'IP of the host server (default: localhost)' ) parser . add_argument ( '--port' , default = '2000' , help = 'TCP port to listen to (default: 2000)' ) args = parser . parse_args ( ) client = carla . Client ( args . host , int ( args . port ) ) client . set_timeout ( 20 ) if args . reload : world = client . load_world ( args . town ) else : world = client . get_world ( ) settings = world . get_settings ( ) settings . fixed_delta_seconds = None settings . synchronous_mode = False world . apply_settings ( settings ) data = fetch_dict ( args . inipoint ) data = data [ "available_scenarios" ] [ 0 ] town_data = data [ args . town ] new_args_scenario = [ ] for ar_sc in args . scenarios : new_args_scenario . append ( "Scenario" + ar_sc ) args . scenarios = new_args_scenario for scenarios in town_data : if args . modify : modify_junction_scenarios ( world , scenarios , args ) else : draw_scenarios ( world , scenarios , args ) print ( " ---------------------------- " ) for ar_sc in args . scenarios : print ( " {} is colored as {}" . format ( ar_sc , SCENARIO_COLOR [ ar_sc ] [ 1 ] ) ) print ( " ---------------------------- " )
Used to help with the visualization of the scenario trigger points, as well as its
modifications.
Used to help with the visualization of the scenario trigger points as well as its modifications .
"""
    Used to help with the visualization of the scenario trigger points, as well as its
    modifications.
        --town: Selects the town
        --scenario: The scenario that will be printed. Use the number of the scenarios 1 2 3 ...
        --modify: Used to modify the trigger_points of the given scenario in args.scenarios.
          debug is auto-enabled here. It will be shown red if they aren't apart enough or green, if they are
        --debug: If debug is selected, the points will be shown one by one, and stored at --endpoint,
    in case some copy-pasting is required.
    """ # general parameters # 0) Set the world # 1) Read the json file