https://github.com/lab-key/zmujoco
A Thin Zig Wrapper For MuJoCo
https://github.com/lab-key/zmujoco
mujoco physics robotics zig-package zmujoco
Last synced: about 2 months ago
JSON representation
A Thin Zig Wrapper For MuJoCo
- Host: GitHub
- URL: https://github.com/lab-key/zmujoco
- Owner: lab-key
- License: apache-2.0
- Created: 2025-10-17T13:51:00.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-11-09T23:16:44.000Z (8 months ago)
- Last Synced: 2026-05-03T10:47:54.196Z (about 2 months ago)
- Topics: mujoco, physics, robotics, zig-package, zmujoco
- Language: C++
- Homepage:
- Size: 65.8 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# About
This repository contains the Zig bindings for the MuJoCo C API.
Zig version 0.15.x
MuJoCo version 3.3.8
**MuJoCo** stands for **Mu**lti-**Jo**int dynamics with **Co**ntact. It is a
general purpose physics engine that aims to facilitate research and development
in robotics, biomechanics, graphics and animation, machine learning, and other
areas which demand fast and accurate simulation of articulated structures
interacting with their environment.
https://github.com/user-attachments/assets/995fb256-6474-4927-a30c-a30a0602bb2f
Robotic Dog
https://github.com/user-attachments/assets/aac1e3ff-62da-447c-983c-6e3ec61d6b01
2D Self-Learning Agent. Works in 3D enviroments. Using a framework I am working on & integrating here as well. Coming soon.
***For more higher level and a ( *little bit of a* ) Desktop app making framework checkout [phyzx] ( Still early stages )***
This repository contains a thin wrapper for MuJoCo allowing for easier integration into other projects and direct programmatic usage of the C API.
MuJoCo has a C API and is intended for researchers and developers. The runtime
simulation module is tuned to maximize performance and operates on low-level
data structures that are preallocated by the built-in XML compiler.
MuJoCo further exposes a large number of utility functions for computing
physics-related quantities.
## Getting Started
You should be able to just:
```
git clone https://github.com/lab-key/zmujoco.git
# Everything in the examples directory gets built automatically
zig build
# So you can just
./zig-out/bin/control_model # Or load_model - until I integrate everything properly...
```
This repository is already setup so you don't really need the `setup.zig` & `cleanup.zig` it uses my [mujoco] `dev` branch as a git submodule to allow for updates.
In case you want to setup your own `zmujoco` basically you need to convert the `CMakeLists.txt` from [mujoco] into a `build.zig` and then configure everything into a Zig module. You can check the `setup.zig` there for some ideas as well.
## TODO
1. Examples & Tests
2. A nice clean way to integrate or point to third party modelfiles.
3. All the demos and most things I am internally working on are done very ' dirty ' with direct C interop need to either properly wrap it or reprogram it..
## Documentation
All the documenatation is in the docs/ directory.
I highly recommend you look at the tests directory as well as it contains a lot of examples as does the phyzx[link] project.
MuJoCo's documentation can be found at [mujoco.readthedocs.io]. Upcoming
features due for the next release can be found in the [changelog] in the
"latest" branch.
## Citation
If you use MuJoCo for published research, please cite:
```
@inproceedings{todorov2012mujoco,
title={MuJoCo: A physics engine for model-based control},
author={Todorov, Emanuel and Erez, Tom and Tassa, Yuval},
booktitle={2012 IEEE/RSJ International Conference on Intelligent Robots and Systems},
pages={5026--5033},
year={2012},
organization={IEEE},
doi={10.1109/IROS.2012.6386109}
}
```
## License and Disclaimer
Copyright 2021 DeepMind Technologies Limited.
Box collision code ([`engine_collision_box.c`](https://github.com/google-deepmind/mujoco/blob/main/src/engine/engine_collision_box.c))
is Copyright 2016 Svetoslav Kolev.
ReStructuredText documents, images, and videos in the `doc` directory are made
available under the terms of the Creative Commons Attribution 4.0 (CC BY 4.0)
license. You may obtain a copy of the License at
https://creativecommons.org/licenses/by/4.0/legalcode.
Source code is licensed under the Apache License, Version 2.0. You may obtain a
copy of the License at https://www.apache.org/licenses/LICENSE-2.0.
This is not an officially supported Google product.
[mujoco]: https://github.com/lab-key/mujoco
[phyzx]: https://github.com/lab-key/phyzx
[build from source]: https://mujoco.readthedocs.io/en/latest/programming#building-mujoco-from-source
[Getting Started]: https://mujoco.readthedocs.io/en/latest/programming#getting-started
[Unity]: https://unity.com/
[releases page]: https://github.com/google-deepmind/mujoco/releases
[mujoco.readthedocs.io]: https://mujoco.readthedocs.io
[changelog]: https://mujoco.readthedocs.io/en/latest/changelog.html
[Python bindings]: https://mujoco.readthedocs.io/en/stable/python.html#python-bindings
[PyPI]: https://pypi.org/project/mujoco/