Contributing to the Package
The majority of the files in this package are auto-generated by a script which parses the original MuJoCo source code, found in gen/generator.jl
.
This script performs the following operations:
- Generates the C bindings using
Clang.jl
, based on the compiledMuJoCo_jll
package. - Scrapes the
introspect
Python module found in themujoco
source code, and parses these files to extract docstrings and types. - The C bindings are then cleaned to remove non-compiling generated expressions (due to the C macros)
- The documentation from step 2 is then injected to all the Julia generated methods and structs.
- Native Julia wrappers for the C level structs are written based on the MuJoCo C structs to make them easier to use in high-level Julia (including adding Garbage Collection)
- Next, the Named Access API is then automatically generated based on the
X
andXGROUP
macros in the original source code (mujoco/include/mujoco/mjxmacro.h
) - Finally, we parse the file at
mujoco/python/mujoco/functions.cc
to re-write some of the MuJoCo functions in the same way that the Python bindings do to ensure error checking when passing array objects to these functions. These checks will make sure the arrays of the correct size and type, even checking to make sure the arrays are stored in row-major.
All the files generated by this process contain a warning to not modify the files. If you would like to change something or add it to one of these files, modify the gen/generator.jl
script to include these. If the source code does not need to be automatically generated, consider adding a file or code directly into the src
directory.
The source code under the gen
folder is currently in need of a major refactor to make it more maintainable in the future. This refactoring work is expected to take place soon, but will not delay core use of the package.