Fix: ur solver now can support ik nearest weight.#374
Merged
Conversation
yuecideng
approved these changes
Jul 11, 2026
Contributor
There was a problem hiding this comment.
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_weightwhen 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 | ||
| ) |
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 | ||
| ) |
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 | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fix: ur solver now can support ik nearest weight.
Type of change
Checklist
black .command to format the code base.