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

Function main

scenario_runner/manual_control.py:176–225  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

174
175
176def main():
177 argparser = argparse.ArgumentParser(
178 description='CARLA Manual Control Client')
179 argparser.add_argument(
180 '-v', '--verbose',
181 action='store_true',
182 dest='debug',
183 help='print debug information')
184 argparser.add_argument(
185 '--host',
186 metavar='H',
187 default='127.0.0.1',
188 help='IP of the host server (default: 127.0.0.1)')
189 argparser.add_argument(
190 '-p', '--port',
191 metavar='P',
192 default=2000,
193 type=int,
194 help='TCP port to listen to (default: 2000)')
195 argparser.add_argument(
196 '-a', '--autopilot',
197 action='store_true',
198 help='enable autopilot')
199 argparser.add_argument(
200 '--res',
201 metavar='WIDTHxHEIGHT',
202 default='1280x720',
203 help='window resolution (default: 1280x720)')
204 args = argparser.parse_args()
205
206 args.rolename = 'hero' # Needed for CARLA version
207 args.filter = "vehicle.*" # Needed for CARLA version
208 args.gamma = 2.2 # Needed for CARLA version
209 args.width, args.height = [int(x) for x in args.res.split('x')]
210
211 log_level = logging.DEBUG if args.debug else logging.INFO
212 logging.basicConfig(format='%(levelname)s: %(message)s', level=log_level)
213
214 logging.info('listening to server %s:%s', args.host, args.port)
215
216 print(__doc__)
217
218 try:
219
220 game_loop(args)
221
222 except KeyboardInterrupt:
223 print('\nCancelled by user. Bye!')
224 except Exception as error:
225 logging.exception(error)
226
227
228if __name__ == '__main__':

Callers 1

manual_control.pyFile · 0.70

Calls 1

game_loopFunction · 0.70

Tested by

no test coverage detected