(self,
               weight=1.0,
               terminal_condition=imitation_terminal_conditions.imitation_terminal_condition,
               ref_motion_filenames=None,
               enable_cycle_sync=True,
               clip_velocity=None,
               tar_frame_steps=None,
               clip_time_min=np.inf,
               clip_time_max=np.inf,
               ref_state_init_prob=1.0,
               enable_rand_init_time=True,
               warmup_time=0.0,
               pose_weight=0.5,
               velocity_weight=0.05,
               end_effector_weight=0.2,
               root_pose_weight=0.15,
               root_velocity_weight=0.1,
               pose_err_scale=5.0,
               velocity_err_scale=0.1,
               end_effector_err_scale=40,
               end_effector_height_err_scale=3.0,
               root_pose_err_scale=20,
               root_velocity_err_scale=2,
               perturb_init_state_prob=0.0,
               tar_obs_noise=None,
               draw_ref_model_alpha=0.5)
return
Initializes the task.

    Args:
      weight: Float. The scaling factor for the reward.
      terminal_condition: Callable object or function. Determines if the task is
        done.
      ref_motion_filenames: List of files containing reference motion data.
      enable_cycle_sync: Boolean indicating if the root of the reference motion
        should be synchronized with the root of the simulated robot at the start
        of every cycle to mitigate drift.
      clip_velocity: if not None, we will clip the velocity with this value.
      tar_frame_steps: The number of steps to sample each target frame to
        include in the target observations.
      clip_time_min: Minimum amount of time a reference motion clip is active
        before switching to another clip.
      clip_time_max: Maximum amount of time a reference motion clip is active
        before switching to another clip.
      ref_state_init_prob: Probability of initializing the robot to a state from
        the reference at the start of each episode. When not initializing to a
        reference state, the robot will be initialized to the default state.
      enable_rand_init_time: Flag for enabling randomly initializing to
        different points in time alont a reference motion.
      warmup_time: Amount of time for the robot to move from default pose to
        reference pose at the start of each episode. This helps for deployment,
        so that the robot doesn't try to move to the reference pose too quickly
        from its default pose.
      pose_weight: Pose reward weight.
      velocity_weight: Velocity reward weight.
      end_effector_weight: End effector reward weight.
      root_pose_weight: Root position and rotation reward weight.
      root_velocity_weight: Root linear and angular velocity reward weight.
      pose_err_scale: Pose error scale for calculating pose reward.
      velocity_err_scale: Velocity error scale for calculating velocity reward.
      end_effector_err_scale: End effector error scale for calculating end
        effector reward.
      end_effector_height_err_scale: End effector height error scale for
        calculating the end effector reward.
      root_pose_err_scale: Root position and rotation error scale for
        calculating root position and rotation reward.
      root_velocity_err_scale: Root linear and angular velocity error scale for
        calculating root linear and angular velocity reward.
      perturb_init_state_prob: Probability of applying random pertubations to
        the initial state.
      tar_obs_noise: List of the standard deviations of the noise to be applied
        to the target observations [base rotation std, base position std].
      draw_ref_model_alpha: Color transparency for drawing the reference model.
Initializes the task.
Initializes the task .
def __init__(self,
               weight=1.0,
               terminal_condition=imitation_terminal_conditions.imitation_terminal_condition,
               ref_motion_filenames=None,
               enable_cycle_sync=True,
               clip_velocity=None,
               tar_frame_steps=None,
               clip_time_min=np.inf,
               clip_time_max=np.inf,
               ref_state_init_prob=1.0,
               enable_rand_init_time=True,
               warmup_time=0.0,
               pose_weight=0.5,
               velocity_weight=0.05,
               end_effector_weight=0.2,
               root_pose_weight=0.15,
               root_velocity_weight=0.1,
               pose_err_scale=5.0,
               velocity_err_scale=0.1,
               end_effector_err_scale=40,
               end_effector_height_err_scale=3.0,
               root_pose_err_scale=20,
               root_velocity_err_scale=2,
               perturb_init_state_prob=0.0,
               tar_obs_noise=None,
               draw_ref_model_alpha=0.5):
    """Initializes the task.

    Args:
      weight: Float. The scaling factor for the reward.
      terminal_condition: Callable object or function. Determines if the task is
        done.
      ref_motion_filenames: List of files containing reference motion data.
      enable_cycle_sync: Boolean indicating if the root of the reference motion
        should be synchronized with the root of the simulated robot at the start
        of every cycle to mitigate drift.
      clip_velocity: if not None, we will clip the velocity with this value.
      tar_frame_steps: The number of steps to sample each target frame to
        include in the target observations.
      clip_time_min: Minimum amount of time a reference motion clip is active
        before switching to another clip.
      clip_time_max: Maximum amount of time a reference motion clip is active
        before switching to another clip.
      ref_state_init_prob: Probability of initializing the robot to a state from
        the reference at the start of each episode. When not initializing to a
        reference state, the robot will be initialized to the default state.
      enable_rand_init_time: Flag for enabling randomly initializing to
        different points in time alont a reference motion.
      warmup_time: Amount of time for the robot to move from default pose to
        reference pose at the start of each episode. This helps for deployment,
        so that the robot doesn't try to move to the reference pose too quickly
        from its default pose.
      pose_weight: Pose reward weight.
      velocity_weight: Velocity reward weight.
      end_effector_weight: End effector reward weight.
      root_pose_weight: Root position and rotation reward weight.
      root_velocity_weight: Root linear and angular velocity reward weight.
      pose_err_scale: Pose error scale for calculating pose reward.
      velocity_err_scale: Velocity error scale for calculating velocity reward.
      end_effector_err_scale: End effector error scale for calculating end
        effector reward.
      end_effector_height_err_scale: End effector height error scale for
        calculating the end effector reward.
      root_pose_err_scale: Root position and rotation error scale for
        calculating root position and rotation reward.
      root_velocity_err_scale: Root linear and angular velocity error scale for
        calculating root linear and angular velocity reward.
      perturb_init_state_prob: Probability of applying random pertubations to
        the initial state.
      tar_obs_noise: List of the standard deviations of the noise to be applied
        to the target observations [base rotation std, base position std].
      draw_ref_model_alpha: Color transparency for drawing the reference model.
    """
    self._weight = weight
    self._terminal_condition = terminal_condition
    self._last_base_position = None
    self._clip_velocity = clip_velocity
    self._action_history_sensor = None
    self._env = None

    assert ref_motion_filenames is not None
    self._ref_state_init_prob = ref_state_init_prob
    self._enable_rand_init_time = enable_rand_init_time
    self._warmup_time = warmup_time
    self._curr_episode_warmup = False
    self._tar_frame_steps = tar_frame_steps
    self._ref_motion_filenames = ref_motion_filenames
    self._ref_motions = None

    if self._tar_frame_steps is None:
      self._tar_frame_steps = [1, 2]

    self._clip_time_min = clip_time_min
    self._clip_time_max = clip_time_max
    self._clip_change_time = clip_time_min

    self._enable_cycle_sync = enable_cycle_sync
    self._active_motion_id = -1
    self._motion_time_offset = 0.0
    self._episode_start_time_offset = 0.0
    self._ref_model = None
    self._ref_pose = None
    self._ref_vel = None
    self._default_pose = None
    self._perturb_init_state_prob = perturb_init_state_prob
    self._tar_obs_noise = tar_obs_noise
    self._draw_ref_model_alpha = draw_ref_model_alpha

    self._prev_motion_phase = 0
    self._origin_offset_rot = np.array([0, 0, 0, 1])
    self._origin_offset_pos = np.zeros(motion_data.MotionData.POS_SIZE)

    # reward function parameters
    self._pose_weight = pose_weight
    self._velocity_weight = velocity_weight
    self._end_effector_weight = end_effector_weight
    self._root_pose_weight = root_pose_weight
    self._root_velocity_weight = root_velocity_weight

    self._pose_err_scale = pose_err_scale
    self._velocity_err_scale = velocity_err_scale
    self._end_effector_err_scale = end_effector_err_scale
    self._end_effector_height_err_scale = end_effector_height_err_scale
    self._root_pose_err_scale = root_pose_err_scale
    self._root_velocity_err_scale = root_velocity_err_scale

    return
def __init__ ( self , weight = 1.0 , terminal_condition = imitation_terminal_conditions . imitation_terminal_condition , ref_motion_filenames = None , enable_cycle_sync = True , clip_velocity = None , tar_frame_steps = None , clip_time_min = np . inf , clip_time_max = np . inf , ref_state_init_prob = 1.0 , enable_rand_init_time = True , warmup_time = 0.0 , pose_weight = 0.5 , velocity_weight = 0.05 , end_effector_weight = 0.2 , root_pose_weight = 0.15 , root_velocity_weight = 0.1 , pose_err_scale = 5.0 , velocity_err_scale = 0.1 , end_effector_err_scale = 40 , end_effector_height_err_scale = 3.0 , root_pose_err_scale = 20 , root_velocity_err_scale = 2 , perturb_init_state_prob = 0.0 , tar_obs_noise = None , draw_ref_model_alpha = 0.5 ) : self . _weight = weight self . _terminal_condition = terminal_condition self . _last_base_position = None self . _clip_velocity = clip_velocity self . _action_history_sensor = None self . _env = None assert ref_motion_filenames is not None self . _ref_state_init_prob = ref_state_init_prob self . _enable_rand_init_time = enable_rand_init_time self . _warmup_time = warmup_time self . _curr_episode_warmup = False self . _tar_frame_steps = tar_frame_steps self . _ref_motion_filenames = ref_motion_filenames self . _ref_motions = None if self . _tar_frame_steps is None : self . _tar_frame_steps = [ 1 , 2 ] self . _clip_time_min = clip_time_min self . _clip_time_max = clip_time_max self . _clip_change_time = clip_time_min self . _enable_cycle_sync = enable_cycle_sync self . _active_motion_id = - 1 self . _motion_time_offset = 0.0 self . _episode_start_time_offset = 0.0 self . _ref_model = None self . _ref_pose = None self . _ref_vel = None self . _default_pose = None self . _perturb_init_state_prob = perturb_init_state_prob self . _tar_obs_noise = tar_obs_noise self . _draw_ref_model_alpha = draw_ref_model_alpha self . _prev_motion_phase = 0 self . _origin_offset_rot = np . array ( [ 0 , 0 , 0 , 1 ] ) self . _origin_offset_pos = np . zeros ( motion_data . MotionData . POS_SIZE ) # reward function parameters self . _pose_weight = pose_weight self . _velocity_weight = velocity_weight self . _end_effector_weight = end_effector_weight self . _root_pose_weight = root_pose_weight self . _root_velocity_weight = root_velocity_weight self . _pose_err_scale = pose_err_scale self . _velocity_err_scale = velocity_err_scale self . _end_effector_err_scale = end_effector_err_scale self . _end_effector_height_err_scale = end_effector_height_err_scale self . _root_pose_err_scale = root_pose_err_scale self . _root_velocity_err_scale = root_velocity_err_scale return