From 1a0d635386818434f74598c86919fe8bc2e13fb9 Mon Sep 17 00:00:00 2001 From: Alexis Duburcq Date: Sat, 22 Aug 2020 13:27:53 +0200 Subject: [PATCH] [Gym] Fix telemetry not enable by default for replay. Fix tempory log file extension and deletion. --- gym_jiminy/gym_jiminy/common/robots.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/gym_jiminy/gym_jiminy/common/robots.py b/gym_jiminy/gym_jiminy/common/robots.py index 76b2cf243..0a96e752c 100644 --- a/gym_jiminy/gym_jiminy/common/robots.py +++ b/gym_jiminy/gym_jiminy/common/robots.py @@ -80,7 +80,7 @@ def __init__(self, self._log_data = None if self.debug is not None: self._log_file = tempfile.NamedTemporaryFile( - prefix="log_", suffix=".png") + prefix="log_", suffix=".data", delete=(not debug)) else: self._log_file = None @@ -146,22 +146,27 @@ def _setup_environment(self): robot_options = self.robot.get_options() engine_options = self.engine_py.get_engine_options() - # Disable completely the telemetry in non debug mode to speed up the simulation + # Disable part of the telemetry in non debug mode, to speed up + # the simulation. Only the required data for log replay are enabled. + # It is up to the user to overload this method if logging more data + # is necessary for terminal reward computation. for field in robot_options["telemetry"].keys(): robot_options["telemetry"][field] = self.debug for field in engine_options["telemetry"].keys(): if field[:6] == 'enable': engine_options["telemetry"][field] = self.debug + engine_options['telemetry']['enableConfiguration'] = True - # Set the position and velocity bounds of the robot + # Enable the position and velocity bounds of the robot robot_options["model"]["joints"]["enablePositionLimit"] = True robot_options["model"]["joints"]["enableVelocityLimit"] = True - # Set the effort limits of the motors + # Enable the effort limits of the motors for motor_name in robot_options["motors"].keys(): robot_options["motors"][motor_name]["enableEffortLimit"] = True - # Configure the stepper update period, and disable max number of iterations and timeout + # Configure the stepper update period, and disable max number of + # iterations and timeout. engine_options["stepper"]["iterMax"] = -1 engine_options["stepper"]["timeout"] = -1 engine_options["stepper"]["sensorsUpdatePeriod"] = self.dt