def apply_wrappers()

in robogym/envs/dactyl/reach.py [0:0]


    def apply_wrappers(self, **wrapper_params):
        """
        Apply wrappers to the environment.
        """
        self.constants: ReachEnvConstants

        env = util.ClipActionWrapper(self)

        if self.constants.active_finger is not None:
            env = dactyl.FingerSeparationWrapper(
                env, active_finger=self.constants.active_finger
            )

        if self.constants.randomize:
            env = randomizations.RandomizedActionLatency(env)
            env = randomizations.RandomizedBodyInertiaWrapper(env)
            env = randomizations.RandomizedTimestepWrapper(env)
            env = randomizations.RandomizedRobotFrictionWrapper(env)
            env = randomizations.RandomizedGravityWrapper(env)
            env = dactyl.RandomizedPhasespaceFingersWrapper(env)
            env = dactyl.RandomizedRobotDampingWrapper(env)
            env = dactyl.RandomizedRobotKpWrapper(env)
            noise_levels = DEFAULT_NOISE_LEVELS
        else:
            noise_levels = NO_NOISE_LEVELS

        # must happen before angle observation wrapper
        env = randomizations.RandomizeObservationWrapper(env, levels=noise_levels)

        if self.constants.randomize:
            env = dactyl.FingersFreezingPhasespaceMarkers(env)
            env = randomizations.ActionNoiseWrapper(env)

        env = util.SmoothActionWrapper(
            env
        )  # this get's applied before noise is added (important)
        env = util.RelativeGoalWrapper(env)
        env = util.UnifiedGoalObservationWrapper(env, goal_parts=["fingertip_pos"])
        env = util.ClipObservationWrapper(env)
        env = util.ClipRewardWrapper(env)
        env = util.PreviousActionObservationWrapper(env)
        env = util.DiscretizeActionWrapper(
            env, n_action_bins=self.constants.n_action_bins
        )

        # Note: Recording wrapper is removed here to favor simplicity.
        return env