diff --git a/scenario_runner.py b/scenario_runner.py index 07e635e19..b31c53d09 100755 --- a/scenario_runner.py +++ b/scenario_runner.py @@ -64,7 +64,6 @@ class ScenarioRunner(object): # Tunable parameters client_timeout = 10.0 # in seconds wait_for_world = 20.0 # in seconds - frame_rate = 20.0 # in Hz # CARLA world and scenario handlers world = None @@ -336,7 +335,7 @@ def _load_and_wait_for_world(self, town, ego_vehicles=None): if self._args.sync: settings = self.world.get_settings() settings.synchronous_mode = True - settings.fixed_delta_seconds = 1.0 / self.frame_rate + settings.fixed_delta_seconds = 1.0 / self._args.frameRate self.world.apply_settings(settings) CarlaDataProvider.set_client(self.client) @@ -566,6 +565,8 @@ def main(): parser.add_argument('--sync', action='store_true', help='Forces the simulation to run synchronously') parser.add_argument('--list', action="store_true", help='List all supported scenarios and exit') + parser.add_argument('--frameRate', default='20', type=float, + help='Frame rate (Hz) to use in \'sync\' mode (default: 20)') parser.add_argument( '--scenario', help='Name of the scenario to be executed. Use the preposition \'group:\' to run all scenarios of one class, e.g. ControlLoss or FollowLeadingVehicle') @@ -646,4 +647,4 @@ def main(): if __name__ == "__main__": - sys.exit(main()) + sys.exit(main()) \ No newline at end of file