Refactor argument synch -> sync

This commit is contained in:
Daniel Santos-Olivan 2021-07-29 16:22:32 +02:00 committed by bernat
parent bc386b35da
commit b9bfa88fab
1 changed files with 5 additions and 5 deletions

View File

@ -105,7 +105,7 @@ def main():
type=int, type=int,
help='Port to communicate with TM (default: 8000)') help='Port to communicate with TM (default: 8000)')
argparser.add_argument( argparser.add_argument(
'--asynch', '--async',
action='store_true', action='store_true',
help='Activate asynchronous mode execution') help='Activate asynchronous mode execution')
argparser.add_argument( argparser.add_argument(
@ -164,7 +164,7 @@ def main():
traffic_manager.set_random_device_seed(args.seed) traffic_manager.set_random_device_seed(args.seed)
settings = world.get_settings() settings = world.get_settings()
if not args.asynch: if not args.async:
traffic_manager.set_synchronous_mode(True) traffic_manager.set_synchronous_mode(True)
if not settings.synchronous_mode: if not settings.synchronous_mode:
synchronous_master = True synchronous_master = True
@ -309,7 +309,7 @@ def main():
all_actors = world.get_actors(all_id) all_actors = world.get_actors(all_id)
# wait for a tick to ensure client receives the last transform of the walkers we have just created # wait for a tick to ensure client receives the last transform of the walkers we have just created
if args.asynch or not synchronous_master: if args.async or not synchronous_master:
world.wait_for_tick() world.wait_for_tick()
else: else:
world.tick() world.tick()
@ -331,14 +331,14 @@ def main():
traffic_manager.global_percentage_speed_difference(30.0) traffic_manager.global_percentage_speed_difference(30.0)
while True: while True:
if not args.asynch and synchronous_master: if not args.async and synchronous_master:
world.tick() world.tick()
else: else:
world.wait_for_tick() world.wait_for_tick()
finally: finally:
if not args.asynch and synchronous_master: if not args.async and synchronous_master:
settings = world.get_settings() settings = world.get_settings()
settings.synchronous_mode = False settings.synchronous_mode = False
settings.no_rendering_mode = False settings.no_rendering_mode = False