Skip to content

Fix [xyz, quat] format pose ik computation for robot#149

Merged
yuecideng merged 2 commits intomainfrom
yueci/fix-robot-ik
Feb 26, 2026
Merged

Fix [xyz, quat] format pose ik computation for robot#149
yuecideng merged 2 commits intomainfrom
yueci/fix-robot-ik

Conversation

@yuecideng
Copy link
Contributor

@yuecideng yuecideng commented Feb 26, 2026

Description

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I have run the black . command to format the code base.
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • Dependencies have been updated, if applicable.

Copilot AI review requested due to automatic review settings February 26, 2026 09:17
@yuecideng yuecideng added bug Something isn't working robot Module related to robot labels Feb 26, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a critical bug in the inverse kinematics (IK) computation when using the 7-element [x, y, z, w, x, y, z] pose format (position + quaternion). The original code incorrectly called quat_from_matrix() on quaternion values, which expects a 3x3 rotation matrix as input. The fix properly uses matrix_from_quat() to convert quaternions to rotation matrices before building the 4x4 homogeneous transformation matrix.

Changes:

  • Fixed compute_ik method to properly convert [xyz, quat] format poses to 4x4 matrices
  • Fixed compute_batch_ik method with the same quaternion-to-matrix conversion logic
  • Added test coverage to verify IK produces identical results for both matrix and [xyz, quat] pose formats

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
embodichain/lab/sim/objects/robot.py Fixed quaternion-to-matrix conversion in compute_ik and compute_batch_ik methods by replacing incorrect quat_from_matrix calls with correct matrix_from_quat calls, and importing the required function
tests/sim/solvers/test_opw_solver.py Added test case to verify IK computation produces consistent results for both 4x4 matrix and 7-element [xyz, quat] pose formats

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@yuecideng yuecideng merged commit 7512ac4 into main Feb 26, 2026
9 of 10 checks passed
@yuecideng yuecideng deleted the yueci/fix-robot-ik branch February 26, 2026 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working robot Module related to robot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants