()
| 1033 | |
| 1034 | |
| 1035 | def main(): |
| 1036 | argparser = argparse.ArgumentParser( |
| 1037 | description='CARLA Manual Control Client') |
| 1038 | argparser.add_argument( |
| 1039 | '-v', '--verbose', |
| 1040 | action='store_true', |
| 1041 | dest='debug', |
| 1042 | help='print debug information') |
| 1043 | argparser.add_argument( |
| 1044 | '--host', |
| 1045 | metavar='H', |
| 1046 | default='127.0.0.1', |
| 1047 | help='IP of the host server (default: 127.0.0.1)') |
| 1048 | argparser.add_argument( |
| 1049 | '-p', '--port', |
| 1050 | metavar='P', |
| 1051 | default=2000, |
| 1052 | type=int, |
| 1053 | help='TCP port to listen to (default: 2000)') |
| 1054 | argparser.add_argument( |
| 1055 | '-a', '--autopilot', |
| 1056 | action='store_true', |
| 1057 | help='enable autopilot') |
| 1058 | argparser.add_argument( |
| 1059 | '--res', |
| 1060 | metavar='WIDTHxHEIGHT', |
| 1061 | default='1280x720', |
| 1062 | help='window resolution (default: 1280x720)') |
| 1063 | argparser.add_argument( |
| 1064 | '--filter', |
| 1065 | metavar='PATTERN', |
| 1066 | default='vehicle.*', |
| 1067 | help='actor filter (default: "vehicle.*")') |
| 1068 | argparser.add_argument( |
| 1069 | '--rolename', |
| 1070 | metavar='NAME', |
| 1071 | default='hero', |
| 1072 | help='actor role name (default: "hero")') |
| 1073 | argparser.add_argument( |
| 1074 | '--gamma', |
| 1075 | default=2.2, |
| 1076 | type=float, |
| 1077 | help='Gamma correction of the camera (default: 2.2)') |
| 1078 | args = argparser.parse_args() |
| 1079 | |
| 1080 | args.width, args.height = [int(x) for x in args.res.split('x')] |
| 1081 | |
| 1082 | log_level = logging.DEBUG if args.debug else logging.INFO |
| 1083 | logging.basicConfig(format='%(levelname)s: %(message)s', level=log_level) |
| 1084 | |
| 1085 | logging.info('listening to server %s:%s', args.host, args.port) |
| 1086 | |
| 1087 | print(__doc__) |
| 1088 | |
| 1089 | try: |
| 1090 | |
| 1091 | game_loop(args) |
| 1092 |
no test coverage detected