Skip to content
Discussion options

You must be logged in to vote

You are applying body_q directly to the mesh vertices to get world positions, but that ignores the shape transform offset which was passed to add_shape_mesh.

scene.add_shape_mesh(
    body=body_id,
    xform=wp.transform(wp.vec3([0.1, 0.1, 0.3]), ...),  # <-- shape offset from body origin
    mesh=self.mesh,
)

def extract_results(self):
    from scipy.spatial.transform import Rotation

    # Body world transform
    body_tf = self.state_0.body_q.numpy()[-1]
    body_pos = body_tf[:3]
    body_rot = body_tf[3:]  # xyzw

    # Shape transform (the xform you passed to add_shape_mesh)
    shape_tf = self.model.shape_transform.numpy()[-1]
    shape_pos = shape_tf[:3]
    shape_rot = shape_tf[…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@alyflex-fys
Comment options

Answer selected by alyflex-fys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants