-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
decorator to assert error when gpu is initialized for calling functio…
…ns user should not call.
- Loading branch information
1 parent
8546326
commit 0cf0baa
Showing
9 changed files
with
66 additions
and
169 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
def before_gpu_init(func): | ||
""" | ||
decorator to throw an error if a function is called when gpu sim has been initialized already. Used for functions such as setting friction values which currently | ||
cannot be changed once the gpu simulation has started. | ||
""" | ||
|
||
def wrapper(self, *args, **kwargs): | ||
assert ( | ||
self._scene._gpu_sim_initialized == False | ||
), f"{func} can only be called when the GPU simulation has not been initialized yet" | ||
return func(self, *args, **kwargs) | ||
|
||
return wrapper |
Oops, something went wrong.