-
Notifications
You must be signed in to change notification settings - Fork 664
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add proper handling of function pointer types in autowrap.
Currently, all function pointers are marshaled as `ctypes.c_void_p`, and `set_callback` always wraps a Python callable into a CFUNCTYPE with a fixed signature. However, different MuJoCo callbacks have different function signatures. In particular, sensor and actuator callbacks take in an additional argument compared to the "generic" function pointer type. In this CL, we modify autowrap to generate code that wraps callbacks into CFUNCTYPE with the correct signature. The generated wrapper code exposes callbacks (both global ones and those that appear in UI-related structs) as Python properties, where the getters and setters automatically handles the wrapping of Python callables. PiperOrigin-RevId: 233789558
- Loading branch information
Showing
6 changed files
with
168 additions
and
102 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
Oops, something went wrong.