-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
55 lines (41 loc) · 1.96 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env python
# Copyright (c) 2019 Computer Vision Center (CVC) at the Universitat Autonoma de
# Barcelona (UAB).
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
# Allows controlling a vehicle with a keyboard. For a simpler and more
# documented example, please take a look at tutorial.py.
import argparse
import logging
from src.agent import Agent
def main():
argparser = argparse.ArgumentParser(description="CARLA Manual Control Client")
argparser.add_argument("-v", "--verbose", action="store_true", dest="debug", help="print debug information")
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("-a", "--autopilot", action="store_true", help="enable autopilot")
argparser.add_argument(
"--res", metavar="WIDTHxHEIGHT", default="1280x720", help="window resolution (default: 1280x720)"
)
argparser.add_argument(
"--filter", metavar="PATTERN", default="vehicle.*", help='actor filter (default: "vehicle.*")'
)
argparser.add_argument("--rolename", metavar="NAME", default="hero", help='actor role name (default: "hero")')
argparser.add_argument("--gamma", default=2.2, type=float, help="Gamma correction of the camera (default: 2.2)")
args = argparser.parse_args()
args.width, args.height = [int(x) for x in args.res.split("x")]
log_level = logging.DEBUG if args.debug else logging.INFO
logging.basicConfig(format="%(levelname)s: %(message)s", level=log_level)
logging.info("listening to server %s:%s", args.host, args.port)
agent = Agent(args)
try:
agent.run()
except KeyboardInterrupt:
print("\nCancelled by user. Bye!")
if __name__ == "__main__":
main()