From 0826b307c2989bf60a9be75adbb0338a36d5dd37 Mon Sep 17 00:00:00 2001 From: germanros1987 Date: Sun, 10 Mar 2019 14:20:45 -0700 Subject: [PATCH] new flag in no_rendering_mode.py to actually switch off rendering if needed: --- .idea/vcs.xml | 6 ++++++ PythonAPI/no_rendering_mode.py | 14 ++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 .idea/vcs.xml diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 000000000..94a25f7f4 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PythonAPI/no_rendering_mode.py b/PythonAPI/no_rendering_mode.py index 41f155633..a8d6964b5 100755 --- a/PythonAPI/no_rendering_mode.py +++ b/PythonAPI/no_rendering_mode.py @@ -559,13 +559,14 @@ class MapImage(object): class ModuleWorld(object): - def __init__(self, name, host, port, timeout, actor_filter): + def __init__(self, name, host, port, timeout, actor_filter, no_rendering=True): self.client = None self.name = name self.host = host self.port = port self.timeout = timeout self.actor_filter = actor_filter + self.no_rendering = no_rendering self.server_fps = 0.0 self.simulation_time = 0 @@ -617,6 +618,10 @@ class ModuleWorld(object): def start(self): self.world, self.town_map = self._get_data_from_carla(self.host, self.port, self.timeout) + settings = self.world.get_settings() + settings.no_rendering_mode = self.no_rendering + self.world.apply_settings(settings) + # Create Surfaces self.map_image = MapImage(self.world, self.town_map, PIXELS_PER_METER) @@ -1154,7 +1159,7 @@ def game_loop(args): # Init modules input_module = ModuleInput(MODULE_INPUT) hud_module = ModuleHUD(MODULE_HUD, args.width, args.height) - world_module = ModuleWorld(MODULE_WORLD, args.host, args.port, 2.0, args.filter) + world_module = ModuleWorld(MODULE_WORLD, args.host, args.port, 2.0, args.filter, args.no_rendering) # Register Modules module_manager.register_module(world_module) @@ -1214,6 +1219,11 @@ def main(): metavar='PATTERN', default='vehicle.*', help='actor filter (default: "vehicle.*")') + argparser.add_argument( + '--no-rendering', + type=bool, + default=False, + help='Switch off server rendering?') args = argparser.parse_args() args.description = argparser.description