def __init__(self, env: gym.Env, gamma, max_d, max_t, lambda_dt, anoise_type=None, anoise_prob=0.0, anoise_std=0.0):
    gym.Wrapper.__init__(self, env)
    self.epsilon_std = 0.001
    self.gamma = gamma
    self.max_d = max_d
    self.max_t = max_t
    self.lambda_dt = lambda_dt
    self.anoise_type = anoise_type
    self.anoise_prob = anoise_prob
    self.anoise_std = anoise_std
    self.body_key = None
    part_keys = set(self.env.sim.model._body_name2id.keys())
    target_keys = ['torso', 'cart', 'body1']
    for target_key in target_keys:
        if (target_key in part_keys):
            self.body_key = target_key
            break
    if (self.anoise_type in ['ext_fpc']):
        low = np.concatenate([self.observation_space.low, ([(- np.inf)] * 3)])
        high = np.concatenate([self.observation_space.high, ([np.inf] * 3)])
        self.observation_space = spaces.Box(low=low, high=high, shape=((self.observation_space.shape[0] + 3),), dtype=self.observation_space.dtype)
        self.obs_dim = (self.observation_space.shape[0] + 3)
        self.cur_force = np.zeros(3)
    else:
        self.obs_dim = self.observation_space.shape[0]
    action_dim = self.env.action_space.shape[0]
    self.ori_action_dim = action_dim
    low = self.env.action_space.low
    high = self.env.action_space.high
    if ((self.max_d is not None) or (self.max_t is not None)):
        action_dim += 1
        low = np.r_[(low, (- 1.0))]
        high = np.r_[(high, 1.0)]
    self.action_space = spaces.Box(low=low, high=high, shape=(action_dim,), dtype=env.action_space.dtype)
    self.cur_obs = None
    self.obs_rms = RunningMeanStd(shape=self.observation_space.shape)
    self.reset_update_obs_estimate = False
    self.num_steps = 0
    self.eval_mode = False
def __init__(self, env: gym.Env, gamma, max_d, max_t, lambda_dt, anoise_type=None, anoise_prob=0.0, anoise_std=0.0):
    gym.Wrapper.__init__(self, env)
    self.epsilon_std = 0.001
    self.gamma = gamma
    self.max_d = max_d
    self.max_t = max_t
    self.lambda_dt = lambda_dt
    self.anoise_type = anoise_type
    self.anoise_prob = anoise_prob
    self.anoise_std = anoise_std
    self.body_key = None
    part_keys = set(self.env.sim.model._body_name2id.keys())
    target_keys = ['torso', 'cart', 'body1']
    for target_key in target_keys:
        if (target_key in part_keys):
            self.body_key = target_key
            break
    if (self.anoise_type in ['ext_fpc']):
        low = np.concatenate([self.observation_space.low, ([(- np.inf)] * 3)])
        high = np.concatenate([self.observation_space.high, ([np.inf] * 3)])
        self.observation_space = spaces.Box(low=low, high=high, shape=((self.observation_space.shape[0] + 3),), dtype=self.observation_space.dtype)
        self.obs_dim = (self.observation_space.shape[0] + 3)
        self.cur_force = np.zeros(3)
    else:
        self.obs_dim = self.observation_space.shape[0]
    action_dim = self.env.action_space.shape[0]
    self.ori_action_dim = action_dim
    low = self.env.action_space.low
    high = self.env.action_space.high
    if ((self.max_d is not None) or (self.max_t is not None)):
        action_dim += 1
        low = np.r_[(low, (- 1.0))]
        high = np.r_[(high, 1.0)]
    self.action_space = spaces.Box(low=low, high=high, shape=(action_dim,), dtype=env.action_space.dtype)
    self.cur_obs = None
    self.obs_rms = RunningMeanStd(shape=self.observation_space.shape)
    self.reset_update_obs_estimate = False
    self.num_steps = 0
    self.eval_mode = False