From 09b00cec5d78d82425898a9cb37d878f75f09ce6 Mon Sep 17 00:00:00 2001 From: Abhishek Joshi Date: Mon, 17 Jun 2024 12:37:10 +0530 Subject: [PATCH] updating rotation matrix function for shapes --- python/mujoco/usd/shapes.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/python/mujoco/usd/shapes.py b/python/mujoco/usd/shapes.py index d89fd43d..614f49ba 100644 --- a/python/mujoco/usd/shapes.py +++ b/python/mujoco/usd/shapes.py @@ -159,8 +159,13 @@ def mesh_generator( if "transform" in config: if "rotate" in config["transform"]: - tmp = o3d.geometry.TriangleMesh.create_coordinate_frame() # TODO: add rotation matrix code gen to utils.py - R = tmp.get_rotation_matrix_from_xyz(config["transform"]["rotate"]) + R = np.zeros(9) + quat = np.zeros(4) + euler = config["transform"]["rotate"] + seq = 'xyz' + mujoco.mju_euler2Quat(quat, euler, seq) + mujoco.mju_quat2Mat(R, quat) + R = R.reshape((3,3)) prim_mesh.rotate(R, center=(0, 0, 0)) if "scale" in config["transform"]: prim_mesh.vertices = o3d.utility.Vector3dVector(