(self, action)
return self._get_observation(), reward, done, {}
Step forward the simulation, given the action.

    Args:
      action: Can be a list of desired motor angles for all motors when the
        robot is in position control mode; A list of desired motor torques. Or a
        list of tuples (q, qdot, kp, kd, tau) for hybrid control mode. The
        action must be compatible with the robot's motor control mode. Also, we
        are not going to use the leg space (swing/extension) definition at the
        gym level, since they are specific to Minitaur.

    Returns:
      observations: The observation dictionary. The keys are the sensor names
        and the values are the sensor readings.
      reward: The reward for the current state-action pair.
      done: Whether the episode has ended.
      info: A dictionary that stores diagnostic information.

    Raises:
      ValueError: The action dimension is not the same as the number of motors.
      ValueError: The magnitude of actions is out of bounds.
Step forward the simulation, given the action.
Step forward the simulation given the action .
def step(self, action):
    """Step forward the simulation, given the action.

    Args:
      action: Can be a list of desired motor angles for all motors when the
        robot is in position control mode; A list of desired motor torques. Or a
        list of tuples (q, qdot, kp, kd, tau) for hybrid control mode. The
        action must be compatible with the robot's motor control mode. Also, we
        are not going to use the leg space (swing/extension) definition at the
        gym level, since they are specific to Minitaur.

    Returns:
      observations: The observation dictionary. The keys are the sensor names
        and the values are the sensor readings.
      reward: The reward for the current state-action pair.
      done: Whether the episode has ended.
      info: A dictionary that stores diagnostic information.

    Raises:
      ValueError: The action dimension is not the same as the number of motors.
      ValueError: The magnitude of actions is out of bounds.
    """
    self._last_base_position = self._robot.GetBasePosition()
    self._last_action = action

    if self._is_render:
      # Sleep, otherwise the computation takes less time than real time,
      # which will make the visualization like a fast-forward video.
      time_spent = time.time() - self._last_frame_time
      self._last_frame_time = time.time()
      time_to_sleep = self._env_time_step - time_spent
      if time_to_sleep > 0:
        time.sleep(time_to_sleep)
      base_pos = self._robot.GetBasePosition()

      # Also keep the previous orientation of the camera set by the user.
      [yaw, pitch,
       dist] = self._pybullet_client.getDebugVisualizerCamera()[8:11]
      self._pybullet_client.resetDebugVisualizerCamera(dist, yaw, pitch,
                                                       base_pos)
      self._pybullet_client.configureDebugVisualizer(
          self._pybullet_client.COV_ENABLE_SINGLE_STEP_RENDERING, 1)
      alpha = 1.
      if self._show_reference_id>=0:
        alpha = self._pybullet_client.readUserDebugParameter(self._show_reference_id)
      
      ref_col = [1, 1, 1, alpha]
      if hasattr(self._task, '_ref_model'):
        self._pybullet_client.changeVisualShape(self._task._ref_model, -1, rgbaColor=ref_col)
        for l in range (self._pybullet_client.getNumJoints(self._task._ref_model)):
        	self._pybullet_client.changeVisualShape(self._task._ref_model, l, rgbaColor=ref_col)
    
      delay = self._pybullet_client.readUserDebugParameter(self._delay_id)
      if (delay>0):
        time.sleep(delay)

    for env_randomizer in self._env_randomizers:
      env_randomizer.randomize_step(self)

    # robot class and put the logics here.
    self._robot.Step(action)

    for s in self.all_sensors():
      s.on_step(self)

    if self._task and hasattr(self._task, 'update'):
      self._task.update(self)

    reward = self._reward()

    done = self._termination()
    self._env_step_counter += 1
    if done:
      self._robot.Terminate()
    return self._get_observation(), reward, done, {}
def step ( self , action ) : self . _last_base_position = self . _robot . GetBasePosition ( ) self . _last_action = action if self . _is_render : # Sleep, otherwise the computation takes less time than real time, # which will make the visualization like a fast-forward video. time_spent = time . time ( ) - self . _last_frame_time self . _last_frame_time = time . time ( ) time_to_sleep = self . _env_time_step - time_spent if time_to_sleep > 0 : time . sleep ( time_to_sleep ) base_pos = self . _robot . GetBasePosition ( ) # Also keep the previous orientation of the camera set by the user. [ yaw , pitch , dist ] = self . _pybullet_client . getDebugVisualizerCamera ( ) [ 8 : 11 ] self . _pybullet_client . resetDebugVisualizerCamera ( dist , yaw , pitch , base_pos ) self . _pybullet_client . configureDebugVisualizer ( self . _pybullet_client . COV_ENABLE_SINGLE_STEP_RENDERING , 1 ) alpha = 1. if self . _show_reference_id >= 0 : alpha = self . _pybullet_client . readUserDebugParameter ( self . _show_reference_id ) ref_col = [ 1 , 1 , 1 , alpha ] if hasattr ( self . _task , '_ref_model' ) : self . _pybullet_client . changeVisualShape ( self . _task . _ref_model , - 1 , rgbaColor = ref_col ) for l in range ( self . _pybullet_client . getNumJoints ( self . _task . _ref_model ) ) : self . _pybullet_client . changeVisualShape ( self . _task . _ref_model , l , rgbaColor = ref_col ) delay = self . _pybullet_client . readUserDebugParameter ( self . _delay_id ) if ( delay > 0 ) : time . sleep ( delay ) for env_randomizer in self . _env_randomizers : env_randomizer . randomize_step ( self ) # robot class and put the logics here. self . _robot . Step ( action ) for s in self . all_sensors ( ) : s . on_step ( self ) if self . _task and hasattr ( self . _task , 'update' ) : self . _task . update ( self ) reward = self . _reward ( ) done = self . _termination ( ) self . _env_step_counter += 1 if done : self . _robot . Terminate ( ) return self . _get_observation ( ) , reward , done , { }