-
Notifications
You must be signed in to change notification settings - Fork 2.6k
[FIX BUG]: Weld constraint in multi-env #1386
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
c176525
get_weld_contraints api and unit test
LeonLiu4 3cbc525
Merge branch 'main' into feature/get-weld
LeonLiu4 0cdd727
Merge branch 'main' into feature/get-weld
LeonLiu4 8d35d0e
dictionary return in get_weld
LeonLiu4 eb5eb84
mend
LeonLiu4 e463433
Merge branch 'main' into feature/get-weld
LeonLiu4 88fc6b9
Merge branch 'main' into feature/get-weld
LeonLiu4 17c3f82
taichi kernel and changed API
LeonLiu4 4837d9b
entity get_weld and unit test
LeonLiu4 3dc331d
multi-env weld constraint
LeonLiu4 c026d99
Update rigid_entity.py
LeonLiu4 c4b12fb
Update rigid_solver_decomp.py
LeonLiu4 2741986
Update test_rigid_physics.py
LeonLiu4 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4920,6 +4920,19 @@ def add_weld_constraint(self, link1_idx, link2_idx, envs_idx=None, *, unsafe=Fal | |
| _, link2_idx, envs_idx = self._sanitize_1D_io_variables( | ||
| None, link2_idx, self.n_links, envs_idx, idx_name="links_idx", skip_allocation=True, unsafe=unsafe | ||
| ) | ||
|
|
||
| if torch.is_tensor(link1_idx): | ||
| link1_idx = link1_idx.cpu().numpy() | ||
| if torch.is_tensor(link2_idx): | ||
| link2_idx = link2_idx.cpu().numpy() | ||
| if envs_idx is not None and torch.is_tensor(envs_idx): | ||
| envs_idx = envs_idx.cpu().numpy() | ||
|
|
||
| if envs_idx is not None and envs_idx.shape[0] > 1: | ||
| if link1_idx.shape[0] == 1: | ||
| link1_idx = np.repeat(link1_idx, envs_idx.shape[0]) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use torch.repeat
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By the way, no need to check if it is a tensor. It has been sanitized as torch tensor already. |
||
| if link2_idx.shape[0] == 1: | ||
| link2_idx = np.repeat(link2_idx, envs_idx.shape[0]) | ||
| self._kernel_add_weld_constraint(link1_idx, link2_idx, envs_idx) | ||
|
|
||
| @ti.kernel | ||
|
|
||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not cast from torch to numpy, this is irrelevant.