Skip to content

Fix: ur solver now can support ik nearest weight.#374

Merged
yuecideng merged 3 commits into
mainfrom
cj/fix-ur-ik-near-weight
Jul 13, 2026
Merged

Fix: ur solver now can support ik nearest weight.#374
yuecideng merged 3 commits into
mainfrom
cj/fix-ur-ik-near-weight

Conversation

@matafela

Copy link
Copy Markdown
Collaborator

Description

Fix: ur solver now can support ik nearest weight.

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 left a comment

Copy link
Copy Markdown
Contributor

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 updates the UR IK solution selection heuristic so the “nearest-to-seed” choice can be weighted per joint, aligning URSolver behavior with other solvers that support ik_nearest_weight.

Changes:

  • Apply ik_nearest_weight when computing distances between IK candidate solutions and the seed joint configuration.
  • Refactor the distance computation into a multi-line torch.norm(...) call to incorporate weighting.

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

Comment on lines +209 to +211
distances = torch.norm(
self.ik_nearest_weight * (all_solutions - qpos_seed_expanded), dim=-1
)
Comment on lines +209 to +211
distances = torch.norm(
self.ik_nearest_weight * (all_solutions - qpos_seed_expanded), dim=-1
)
Copilot AI review requested due to automatic review settings July 12, 2026 08:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

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

Comment on lines +209 to +211
distances = torch.norm(
self.ik_nearest_weight * (all_solutions - qpos_seed_expanded), dim=-1
)
Comment on lines +209 to +211
distances = torch.norm(
self.ik_nearest_weight * (all_solutions - qpos_seed_expanded), dim=-1
)
Copilot AI review requested due to automatic review settings July 12, 2026 09:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

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

Comment on lines 207 to +211
# Select ik qpos based on the closest distance to the seed qpos
qpos_seed_expanded = qpos_seed.unsqueeze(1).expand(-1, N_SOL, -1)
distances = torch.norm(all_solutions - qpos_seed_expanded, dim=-1)
distances = torch.norm(
self.ik_nearest_weight * (all_solutions - qpos_seed_expanded), dim=-1
)
Comment on lines +209 to +211
distances = torch.norm(
self.ik_nearest_weight * (all_solutions - qpos_seed_expanded), dim=-1
)
@yuecideng yuecideng merged commit beea6e4 into main Jul 13, 2026
10 of 11 checks passed
@yuecideng yuecideng deleted the cj/fix-ur-ik-near-weight branch July 13, 2026 03:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants