Hi,
I want to project one prim to the transform of another one.
Like in this post: How to set prim location in isaac sim - #3 by joshchiu
However, I receive an error message that says that I need to pass an dynamic control transform instead of an Gf4dMatrix. Did the API change or is there an error on my side?
This is the code
def adapt_transform_to_prim(self, path):
tracked_prim = self.current_stage.GetPrimAtPath(self.stagepath_tracker)
matrix = omni.usd.get_world_transform_matrix(tracked_prim)
prim = self.current_stage.GetPrimAtPath(self.toolPath)
rigid_body = self.dc.get_rigid_body(path)
self.dc.set_rigid_body_pose(rigid_body, matrix)
I tried to solve that by getting the dynamic control transform of the rigidboy I want to project, but then I receive an error that the pose is not valid.:
def adapt_transform_to_prim(self, path):
tracked_prim = self.current_stage.GetPrimAtPath(self.stagepath_tracker)
matrix = omni.usd.get_world_transform_matrix(tracked_prim)
prim = self.current_stage.GetPrimAtPath(self.toolPath)
rigid_body = self.dc.get_rigid_body(path)
current_pose = self.dc.get_rigid_body_pose(rigid_body)
# Override Current Post with values of the transformation matrix
overriden_pose = current_pose
translation = [matrix[3][0], matrix[3][1], matrix[3][2]]
rotation = [gfMatrix4d.ExtractRotationQuat().GetReal(), gfMatrix4d.ExtractRotationQuat().GetImaginary()
overriden_pose.p.x = translation [0]
overriden_pose.p.y = translation [1]
overriden_pose.p.z = translation [2]
overriden_pose.r.w = rotation[0]
overriden_pose.r.x = rotation[1][0]
overriden_pose.r.y = rotation[1][1]
overriden_pose.r.z = rotation[1][2]
self.dc.set_rigid_body_pose(rigid_body, overriden_pose )