(self, pose, vel)
return perturb_pose, perturb_vel
Apply random perturbations to the state pose and velocities.
Apply random perturbations to the state pose and velocities.
Apply random perturbations to the state pose and velocities .
def _apply_state_perturb(self, pose, vel):
    """Apply random perturbations to the state pose and velocities."""
    root_pos_std = 0.025
    root_rot_std = 0.025 * np.pi
    joint_pose_std = 0.05 * np.pi
    root_vel_std = 0.1
    root_ang_vel_std = 0.05 * np.pi
    joint_vel_std = 0.05 * np.pi

    perturb_pose = pose.copy()
    perturb_vel = vel.copy()

    motion = self.get_active_motion()
    root_pos = motion.get_frame_root_pos(perturb_pose)
    root_rot = motion.get_frame_root_rot(perturb_pose)
    joint_pose = motion.get_frame_joints(perturb_pose)
    root_vel = motion.get_frame_root_vel(perturb_vel)
    root_ang_vel = motion.get_frame_root_ang_vel(perturb_vel)
    joint_vel = motion.get_frame_joints_vel(perturb_vel)

    root_pos[0] += self._randn(0, root_pos_std)
    root_pos[1] += self._randn(0, root_pos_std)

    rand_axis = self._rand_uniform(-1, 1, size=[3])
    rand_axis /= np.linalg.norm(rand_axis)
    rand_theta = self._randn(0, root_rot_std)
    rand_rot = transformations.quaternion_about_axis(rand_theta, rand_axis)
    root_rot = transformations.quaternion_multiply(rand_rot, root_rot)

    joint_pose += self._randn(0, joint_pose_std, size=joint_pose.shape)

    root_vel[0] += self._randn(0, root_vel_std)
    root_vel[1] += self._randn(0, root_vel_std)
    root_ang_vel += self._randn(0, root_ang_vel_std, size=root_ang_vel.shape)
    joint_vel += self._randn(0, joint_vel_std, size=joint_vel.shape)

    motion.set_frame_root_pos(root_pos, perturb_pose)
    motion.set_frame_root_rot(root_rot, perturb_pose)
    motion.set_frame_joints(joint_pose, perturb_pose)
    motion.set_frame_root_vel(root_vel, perturb_vel)
    motion.set_frame_root_ang_vel(root_ang_vel, perturb_vel)
    motion.set_frame_joints_vel(joint_vel, perturb_vel)

    return perturb_pose, perturb_vel
def _apply_state_perturb ( self , pose , vel ) : root_pos_std = 0.025 root_rot_std = 0.025 * np . pi joint_pose_std = 0.05 * np . pi root_vel_std = 0.1 root_ang_vel_std = 0.05 * np . pi joint_vel_std = 0.05 * np . pi perturb_pose = pose . copy ( ) perturb_vel = vel . copy ( ) motion = self . get_active_motion ( ) root_pos = motion . get_frame_root_pos ( perturb_pose ) root_rot = motion . get_frame_root_rot ( perturb_pose ) joint_pose = motion . get_frame_joints ( perturb_pose ) root_vel = motion . get_frame_root_vel ( perturb_vel ) root_ang_vel = motion . get_frame_root_ang_vel ( perturb_vel ) joint_vel = motion . get_frame_joints_vel ( perturb_vel ) root_pos [ 0 ] += self . _randn ( 0 , root_pos_std ) root_pos [ 1 ] += self . _randn ( 0 , root_pos_std ) rand_axis = self . _rand_uniform ( - 1 , 1 , size = [ 3 ] ) rand_axis /= np . linalg . norm ( rand_axis ) rand_theta = self . _randn ( 0 , root_rot_std ) rand_rot = transformations . quaternion_about_axis ( rand_theta , rand_axis ) root_rot = transformations . quaternion_multiply ( rand_rot , root_rot ) joint_pose += self . _randn ( 0 , joint_pose_std , size = joint_pose . shape ) root_vel [ 0 ] += self . _randn ( 0 , root_vel_std ) root_vel [ 1 ] += self . _randn ( 0 , root_vel_std ) root_ang_vel += self . _randn ( 0 , root_ang_vel_std , size = root_ang_vel . shape ) joint_vel += self . _randn ( 0 , joint_vel_std , size = joint_vel . shape ) motion . set_frame_root_pos ( root_pos , perturb_pose ) motion . set_frame_root_rot ( root_rot , perturb_pose ) motion . set_frame_joints ( joint_pose , perturb_pose ) motion . set_frame_root_vel ( root_vel , perturb_vel ) motion . set_frame_root_ang_vel ( root_ang_vel , perturb_vel ) motion . set_frame_joints_vel ( joint_vel , perturb_vel ) return perturb_pose , perturb_vel