2019-01-24 18:43:13 +08:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
2019-03-29 17:58:05 +08:00
|
|
|
# Copyright (c) 2019 Computer Vision Center (CVC) at the Universitat Autonoma de
|
2019-01-24 18:43:13 +08:00
|
|
|
# Barcelona (UAB).
|
|
|
|
#
|
|
|
|
# This work is licensed under the terms of the MIT license.
|
|
|
|
# For a copy, see <https://opensource.org/licenses/MIT>.
|
|
|
|
|
|
|
|
import glob
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
|
|
|
|
try:
|
2019-03-29 02:15:13 +08:00
|
|
|
sys.path.append(glob.glob('../carla/dist/carla-*%d.%d-%s.egg' % (
|
2019-01-24 18:43:13 +08:00
|
|
|
sys.version_info.major,
|
|
|
|
sys.version_info.minor,
|
|
|
|
'win-amd64' if os.name == 'nt' else 'linux-x86_64'))[0])
|
|
|
|
except IndexError:
|
|
|
|
pass
|
|
|
|
|
|
|
|
import carla
|
|
|
|
|
|
|
|
import argparse
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
|
2019-02-21 19:13:48 +08:00
|
|
|
argparser = argparse.ArgumentParser(
|
|
|
|
description=__doc__)
|
|
|
|
argparser.add_argument(
|
|
|
|
'--host',
|
|
|
|
metavar='H',
|
|
|
|
default='127.0.0.1',
|
|
|
|
help='IP of the host server (default: 127.0.0.1)')
|
|
|
|
argparser.add_argument(
|
|
|
|
'-p', '--port',
|
|
|
|
metavar='P',
|
|
|
|
default=2000,
|
|
|
|
type=int,
|
|
|
|
help='TCP port to listen to (default: 2000)')
|
|
|
|
argparser.add_argument(
|
|
|
|
'-f', '--recorder_filename',
|
|
|
|
metavar='F',
|
|
|
|
default="test1.rec",
|
|
|
|
help='recorder filename (test1.rec)')
|
2019-03-28 18:48:14 +08:00
|
|
|
argparser.add_argument(
|
|
|
|
'-a', '--show_all',
|
|
|
|
action='store_true',
|
|
|
|
help='show detailed info about all frames content')
|
2020-09-22 21:20:52 +08:00
|
|
|
argparser.add_argument(
|
|
|
|
'-s', '--save_to_file',
|
|
|
|
metavar='S',
|
|
|
|
help='save result to file (specify name and extension)')
|
|
|
|
|
2019-02-21 19:13:48 +08:00
|
|
|
args = argparser.parse_args()
|
|
|
|
|
2019-01-24 18:43:13 +08:00
|
|
|
try:
|
|
|
|
|
2019-02-21 19:13:48 +08:00
|
|
|
client = carla.Client(args.host, args.port)
|
|
|
|
client.set_timeout(60.0)
|
2020-09-22 21:20:52 +08:00
|
|
|
if args.save_to_file:
|
|
|
|
doc = open(args.save_to_file, "w+")
|
|
|
|
doc.write(client.show_recorder_file_info(args.recorder_filename, args.show_all))
|
|
|
|
doc.close()
|
|
|
|
else:
|
|
|
|
print(client.show_recorder_file_info(args.recorder_filename, args.show_all))
|
2019-01-24 18:43:13 +08:00
|
|
|
|
|
|
|
|
|
|
|
finally:
|
|
|
|
pass
|
|
|
|
|
2019-03-19 19:20:59 +08:00
|
|
|
|
2019-01-24 18:43:13 +08:00
|
|
|
if __name__ == '__main__':
|
|
|
|
|
|
|
|
try:
|
|
|
|
main()
|
|
|
|
except KeyboardInterrupt:
|
|
|
|
pass
|
|
|
|
finally:
|
|
|
|
print('\ndone.')
|