MCPcopy Create free account
hub / github.com/OpenDriveLab/TCP / main

Function main

scenario_runner/scenario_runner.py:493–582  ·  view source on GitHub ↗

main function

()

Source from the content-addressed store, hash-verified

491
492
493def main():
494 """
495 main function
496 """
497 description = ("CARLA Scenario Runner: Setup, Run and Evaluate scenarios using CARLA\n"
498 "Current version: " + VERSION)
499
500 # pylint: disable=line-too-long
501 parser = argparse.ArgumentParser(description=description,
502 formatter_class=RawTextHelpFormatter)
503 parser.add_argument('-v', '--version', action='version', version='%(prog)s ' + VERSION)
504 parser.add_argument('--host', default='127.0.0.1',
505 help='IP of the host server (default: localhost)')
506 parser.add_argument('--port', default='2000',
507 help='TCP port to listen to (default: 2000)')
508 parser.add_argument('--timeout', default="10.0",
509 help='Set the CARLA client timeout value in seconds')
510 parser.add_argument('--trafficManagerPort', default='8000',
511 help='Port to use for the TrafficManager (default: 8000)')
512 parser.add_argument('--sync', action='store_true',
513 help='Forces the simulation to run synchronously')
514 parser.add_argument('--list', action="store_true", help='List all supported scenarios and exit')
515
516 parser.add_argument(
517 '--scenario', help='Name of the scenario to be executed. Use the preposition \'group:\' to run all scenarios of one class, e.g. ControlLoss or FollowLeadingVehicle')
518 parser.add_argument('--openscenario', help='Provide an OpenSCENARIO definition')
519 parser.add_argument(
520 '--route', help='Run a route as a scenario (input: (route_file,scenario_file,[route id]))', nargs='+', type=str)
521
522 parser.add_argument(
523 '--agent', help="Agent used to execute the scenario. Currently only compatible with route-based scenarios.")
524 parser.add_argument('--agentConfig', type=str, help="Path to Agent's configuration file", default="")
525
526 parser.add_argument('--output', action="store_true", help='Provide results on stdout')
527 parser.add_argument('--file', action="store_true", help='Write results into a txt file')
528 parser.add_argument('--junit', action="store_true", help='Write results into a junit file')
529 parser.add_argument('--outputDir', default='', help='Directory for output files (default: this directory)')
530
531 parser.add_argument('--configFile', default='', help='Provide an additional scenario configuration file (*.xml)')
532 parser.add_argument('--additionalScenario', default='', help='Provide additional scenario implementations (*.py)')
533
534 parser.add_argument('--debug', action="store_true", help='Run with debug output')
535 parser.add_argument('--reloadWorld', action="store_true",
536 help='Reload the CARLA world before starting a scenario (default=True)')
537 parser.add_argument('--record', type=str, default='',
538 help='Path were the files will be saved, relative to SCENARIO_RUNNER_ROOT.\nActivates the CARLA recording feature and saves to file all the criteria information.')
539 parser.add_argument('--randomize', action="store_true", help='Scenario parameters are randomized')
540 parser.add_argument('--repetitions', default=1, type=int, help='Number of scenario executions')
541 parser.add_argument('--waitForEgo', action="store_true", help='Connect the scenario to an existing ego vehicle')
542
543 arguments = parser.parse_args()
544 # pylint: enable=line-too-long
545
546 if arguments.list:
547 print("Currently the following scenarios are supported:")
548 print(*ScenarioConfigurationParser.get_list_of_scenarios(arguments.configFile), sep='\n')
549 return 1
550

Callers 1

scenario_runner.pyFile · 0.70

Calls 4

runMethod · 0.95
destroyMethod · 0.95
ScenarioRunnerClass · 0.85
get_list_of_scenariosMethod · 0.80

Tested by

no test coverage detected