new flag in no_rendering_mode.py to actually switch off rendering if needed:

This commit is contained in:
germanros1987 2019-03-10 14:20:45 -07:00
parent 549d484d4e
commit 0826b307c2
2 changed files with 18 additions and 2 deletions

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

@ -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