docstr: :param level: (str)
      A string representing the control suite level to run. This can also be a LevelSelection object.
      For example, cartpole:swingup.
  
  :param frame_skip: (int)
      The number of frames to skip between any two actions given by the agent. The action will be repeated
      for all the skipped frames.
  
  :param visualization_parameters: (VisualizationParameters)
      The parameters used for visualizing the environment, such as the render flag, storing videos etc.
  
  :param target_success_rate: (float)
      Stop experiment if given target success rate was achieved.
  
  :param seed: (int)
      A seed to use for the random number generator when running the environment.
  
  :param human_control: (bool)
      A flag that allows controlling the environment using the keyboard keys.
  
  :param observation_type: (ObservationType)
      An enum which defines which observation to use. The current options are to use:
      * Measurements only - a vector of joint torques and similar measurements
      * Image only - an image of the environment as seen by a camera attached to the simulator
      * Measurements & Image - both type of observations will be returned in the state using the keys
      'measurements' and 'pixels' respectively.
  
  :param custom_reward_threshold: (float)
      Allows defining a custom reward that will be used to decide when the agent succeeded in passing the environment.
docstr_tok: [":","param","level",":","(","str",")","A","string","representing","the","control","suite","level","to","run",".","This","can","also","be","a","LevelSelection","object",".","For","example",",","cartpole",":","swingup",".",":","param","frame_skip",":","(","int",")","The","number","of","frames","to","skip","between","any","two","actions","given","by","the","agent",".","The","action","will","be","repeated","for","all","the","skipped","frames",".",":","param","visualization_parameters",":","(","VisualizationParameters",")","The","parameters","used","for","visualizing","the","environment",",","such","as","the","render","flag",",","storing","videos","etc",".",":","param","target_success_rate",":","(","float",")","Stop","experiment","if","given","target","success","rate","was","achieved",".",":","param","seed",":","(","int",")","A","seed","to","use","for","the","random","number","generator","when","running","the","environment",".",":","param","human_control",":","(","bool",")","A","flag","that","allows","controlling","the","environment","using","the","keyboard","keys",".",":","param","observation_type",":","(","ObservationType",")","An","enum","which","defines","which","observation","to","use",".","The","current","options","are","to","use",":","*","Measurements","only","-","a","vector","of","joint","torques","and","similar","measurements","*","Image","only","-","an","image","of","the","environment","as","seen","by","a","camera","attached","to","the","simulator","*","Measurements","&","Image","-","both","type","of","observations","will","be","returned","in","the","state","using","the","keys","'measurements","'","and","'pixels","'","respectively",".",":","param","custom_reward_threshold",":","(","float",")","Allows","defining","a","custom","reward","that","will","be","used","to","decide","when","the","agent","succeeded","in","passing","the","environment","."]
code: def __init__(
      self,
      level: LevelSelection,
      frame_skip: int,
      visualization_parameters: VisualizationParameters,
      target_success_rate: float = 1.0,
      seed: Union[None, int] = None,
      human_control: bool = False,
      observation_type: ObservationType = ObservationType.Measurements,
      custom_reward_threshold: Union[int, float] = None,
      **kwargs,
  ):
      """
      :param level: (str)
          A string representing the control suite level to run. This can also be a LevelSelection object.
          For example, cartpole:swingup.
  
      :param frame_skip: (int)
          The number of frames to skip between any two actions given by the agent. The action will be repeated
          for all the skipped frames.
  
      :param visualization_parameters: (VisualizationParameters)
          The parameters used for visualizing the environment, such as the render flag, storing videos etc.
  
      :param target_success_rate: (float)
          Stop experiment if given target success rate was achieved.
  
      :param seed: (int)
          A seed to use for the random number generator when running the environment.
  
      :param human_control: (bool)
          A flag that allows controlling the environment using the keyboard keys.
  
      :param observation_type: (ObservationType)
          An enum which defines which observation to use. The current options are to use:
          * Measurements only - a vector of joint torques and similar measurements
          * Image only - an image of the environment as seen by a camera attached to the simulator
          * Measurements & Image - both type of observations will be returned in the state using the keys
          'measurements' and 'pixels' respectively.
  
      :param custom_reward_threshold: (float)
          Allows defining a custom reward that will be used to decide when the agent succeeded in passing the environment.
  
      """
      super().__init__(
          level,
          seed,
          frame_skip,
          human_control,
          custom_reward_threshold,
          visualization_parameters,
          target_success_rate,
      )
  
      self.observation_type = observation_type
  
      # load and initialize environment
      domain_name, task_name = self.env_id.split(":")
      self.env = suite.load(
          domain_name=domain_name,
          task_name=task_name,
          task_kwargs={"random": seed},
      )
  
      if observation_type != ObservationType.Measurements:
          self.env = pixels.Wrapper(
              self.env,
              pixels_only=observation_type == ObservationType.Image,
          )
  
      # seed
      if self.seed is not None:
          np.random.seed(self.seed)
          random.seed(self.seed)
  
      self.state_space = StateSpace({})
  
      # image observations
      if observation_type != ObservationType.Measurements:
          self.state_space["pixels"] = ImageObservationSpace(
              shape=self.env.observation_spec()["pixels"].shape,
              high=255,
          )
  
      # measurements observations
      if observation_type != ObservationType.Image:
          measurements_space_size = 0
          measurements_names = []
          for (
              observation_space_name,
              observation_space,
          ) in self.env.observation_spec().items():
              if len(observation_space.shape) == 0:
                  measurements_space_size += 1
                  measurements_names.append(observation_space_name)
              elif len(observation_space.shape) == 1:
                  measurements_space_size += observation_space.shape[0]
                  measurements_names.extend(
                      [
                          "{}_{}".format(observation_space_name, i)
                          for i in range(observation_space.shape[0])
                      ]
                  )
          self.state_space["measurements"] = VectorObservationSpace(
              shape=measurements_space_size,
              measurements_names=measurements_names,
          )
  
      # actions
      self.action_space = BoxActionSpace(
          shape=self.env.action_spec().shape[0],
          low=self.env.action_spec().minimum,
          high=self.env.action_spec().maximum,
      )
  
      # initialize the state by getting a new state from the environment
      self.reset_internal_state(True)
  
      # render
      if self.is_rendered:
          image = self.get_rendered_image()
          scale = 1
          if self.human_control:
              scale = 2
          if not self.native_rendering:
              self.renderer.create_screen(
                  image.shape[1] * scale, image.shape[0] * scale
              )
  
      self.target_success_rate = target_success_rate
  
imports: import random
  from enum import Enum
  from typing import Union
  import numpy
  from rl_coach.base_parameters import VisualizationParameters
  from rl_coach.environments.environment import Environment, EnvironmentParameters, LevelSelection
  from rl_coach.filters.filter import NoInputFilter, NoOutputFilter
  from rl_coach.spaces import BoxActionSpace, ImageObservationSpace, VectorObservationSpace, StateSpace
label_desc: Use image node_id 1 to create a new ControlSuiteEnvironment object from inherited base classes: Environment with example: obj = ControlSuiteEnvironment(level, frame_skip, visualization_parameters, target_success_rate, seed, human_control, observation_type, custom_reward_threshold)