Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)