How to use the robosuite.utils.transform_utils.rotation_matrix function in robosuite

To help you get started, we’ve selected a few robosuite examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SudeepDasari / visual_foresight / visual_mpc / envs / mujoco_env / sawyer_env / base_sawyer_env.py View on Github external
def _step(self, target_qpos):
        o = None
        delta_xyz = (target_qpos[:3] - self._eef_pos) / self._hp.substeps
        for i in range(self._hp.substeps):
            current_rot = self._env._right_hand_orn

            pitch, roll, yaw = 0, 0, target_qpos[3]
            drot1 = rotation_matrix(angle=-pitch, direction=[1., 0, 0], point=None)[:3, :3]
            drot2 = rotation_matrix(angle=roll, direction=[0, 1., 0], point=None)[:3, :3]
            drot3 = rotation_matrix(angle=yaw, direction=[0, 0, 1.], point=None)[:3, :3]
            desired_rot = start_rot.dot(drot1.dot(drot2.dot(drot3)))
            drotation = current_rot.T.dot(desired_rot)
            dquat = mat2quat(drotation)

            o = self._env.step(np.concatenate((delta_xyz, dquat, [target_qpos[-1]])))[0]
        self._previous_target_qpos = target_qpos
        return self._proc_obs(o)
github SudeepDasari / visual_foresight / visual_mpc / envs / mujoco_env / sawyer_env / base_sawyer_env.py View on Github external
def _step(self, target_qpos):
        o = None
        delta_xyz = (target_qpos[:3] - self._eef_pos) / self._hp.substeps
        for i in range(self._hp.substeps):
            current_rot = self._env._right_hand_orn

            pitch, roll, yaw = 0, 0, target_qpos[3]
            drot1 = rotation_matrix(angle=-pitch, direction=[1., 0, 0], point=None)[:3, :3]
            drot2 = rotation_matrix(angle=roll, direction=[0, 1., 0], point=None)[:3, :3]
            drot3 = rotation_matrix(angle=yaw, direction=[0, 0, 1.], point=None)[:3, :3]
            desired_rot = start_rot.dot(drot1.dot(drot2.dot(drot3)))
            drotation = current_rot.T.dot(desired_rot)
            dquat = mat2quat(drotation)

            o = self._env.step(np.concatenate((delta_xyz, dquat, [target_qpos[-1]])))[0]
        self._previous_target_qpos = target_qpos
        return self._proc_obs(o)