Add ip and port arguments to /tools/sim/bridge.py (#26011)

* Add ip and port arguments

* Add descriptions of ip and port arguments

* Update README.md

* Update README.md

* prefer host/port options

Co-authored-by: Cameron Clough <cameronjclough@gmail.com>
old-commit-hash: dbdb3a02a8
taco
wjxjmj 3 years ago committed by GitHub
parent 8dc2f5e427
commit dbd5cd3341
  1. 2
      tools/sim/README.md
  2. 8
      tools/sim/bridge.py

@ -39,6 +39,8 @@ Options:
--high_quality Set simulator to higher quality (requires good GPU) --high_quality Set simulator to higher quality (requires good GPU)
--town TOWN Select map to drive in --town TOWN Select map to drive in
--spawn_point NUM Number of the spawn point to start in --spawn_point NUM Number of the spawn point to start in
--host HOST Host address of Carla client (127.0.0.1 as default)
--port PORT Port of Carla client (2000 as default)
``` ```
To engage openpilot press 1 a few times while focused on bridge.py to increase the cruise speed. To engage openpilot press 1 a few times while focused on bridge.py to increase the cruise speed.

@ -39,6 +39,8 @@ def parse_args(add_args=None):
parser.add_argument('--dual_camera', action='store_true') parser.add_argument('--dual_camera', action='store_true')
parser.add_argument('--town', type=str, default='Town04_Opt') parser.add_argument('--town', type=str, default='Town04_Opt')
parser.add_argument('--spawn_point', dest='num_selected_spawn_point', type=int, default=16) parser.add_argument('--spawn_point', dest='num_selected_spawn_point', type=int, default=16)
parser.add_argument('--host', dest='host', type=str, default='127.0.0.1')
parser.add_argument('--port', dest='port', type=int, default=2000)
return parser.parse_args(add_args) return parser.parse_args(add_args)
@ -233,8 +235,8 @@ def can_function_runner(vs: VehicleState, exit_event: threading.Event):
i += 1 i += 1
def connect_carla_client(): def connect_carla_client(host: str, port: int):
client = carla.Client("127.0.0.1", 2000) client = carla.Client(host, port)
client.set_timeout(5) client.set_timeout(5)
return client return client
@ -291,7 +293,7 @@ class CarlaBridge:
self.close() self.close()
def _run(self, q: Queue): def _run(self, q: Queue):
client = connect_carla_client() client = connect_carla_client(self._args.host, self._args.port)
world = client.load_world(self._args.town) world = client.load_world(self._args.town)
settings = world.get_settings() settings = world.get_settings()

Loading…
Cancel
Save