code: def __init__(
      self,
      goal_reaching_thresholds=np.array([0.075, 0.075, 0.75]),
      goal_not_reached_penalty=-1,
      goal_reached_reward=0,
      terminate_on_goal_reaching=True,
      time_limit=1000,
      frameskip=1,
      random_goals_instead_of_standing_goal=False,
      polar_coordinates: bool = False,
  ):
      super().__init__()
      dir = os.path.dirname(__file__)
      model = load_model_from_path(dir + "/pendulum_with_goals.xml")
  
      self.sim = MjSim(model)
      self.viewer = None
      self.rgb_viewer = None
  
      self.frameskip = frameskip
      self.goal = None
      self.goal_reaching_thresholds = goal_reaching_thresholds
      self.goal_not_reached_penalty = goal_not_reached_penalty
      self.goal_reached_reward = goal_reached_reward
      self.terminate_on_goal_reaching = terminate_on_goal_reaching
      self.time_limit = time_limit
      self.current_episode_steps_counter = 0
      self.random_goals_instead_of_standing_goal = (
          random_goals_instead_of_standing_goal
      )
      self.polar_coordinates = polar_coordinates
  
      # spaces definition
      self.action_space = spaces.Box(
          low=-self.sim.model.actuator_ctrlrange[:, 1],
          high=self.sim.model.actuator_ctrlrange[:, 1],
          dtype=np.float32,
      )
      if self.polar_coordinates:
          self.observation_space = spaces.Dict(
              {
                  "observation": spaces.Box(
                      low=np.array([-np.pi, -15]),
                      high=np.array([np.pi, 15]),
                      dtype=np.float32,
                  ),
                  "desired_goal": spaces.Box(
                      low=np.array([-np.pi, -15]),
                      high=np.array([np.pi, 15]),
                      dtype=np.float32,
                  ),
                  "achieved_goal": spaces.Box(
                      low=np.array([-np.pi, -15]),
                      high=np.array([np.pi, 15]),
                      dtype=np.float32,
                  ),
              }
          )
      else:
          self.observation_space = spaces.Dict(
              {
                  "observation": spaces.Box(
                      low=np.array([-1, -1, -15]),
                      high=np.array([1, 1, 15]),
                      dtype=np.float32,
                  ),
                  "desired_goal": spaces.Box(
                      low=np.array([-1, -1, -15]),
                      high=np.array([1, 1, 15]),
                      dtype=np.float32,
                  ),
                  "achieved_goal": spaces.Box(
                      low=np.array([-1, -1, -15]),
                      high=np.array([1, 1, 15]),
                      dtype=np.float32,
                  ),
              }
          )
  
      self.spec = EnvSpec("PendulumWithGoals-v0")
      self.spec.reward_threshold = (
          self.goal_not_reached_penalty * self.time_limit
      )
  
      self.reset()
  
file_path: coach/rl_coach/environments/mujoco/pendulum_with_goals.py
imports: import os
  import gym
  import numpy
  from gym import spaces
  from gym.envs.registration import EnvSpec
  from mujoco_py import load_model_from_path, MjSim, MjViewer, MjRenderContextOffscreen
label_desc: Use image node_id 1 to create a new PendulumWithGoals object from inherited base classes: gym with example: obj = PendulumWithGoals(goal_reaching_thresholds, goal_not_reached_penalty, goal_reached_reward, terminate_on_goal_reaching, time_limit, frameskip, random_goals_instead_of_standing_goal, polar_coordinates)